Эх сурвалжийг харах

Removed lost dependencies and unneeded parameters; updated library reference

David A. Velasco 10 жил өмнө
parent
commit
6619154839

+ 1 - 1
owncloud-android-library

@@ -1 +1 @@
-Subproject commit c01001b5a1b19ab4c6ff789730a6659b8f6bcbb5
+Subproject commit 179ef41f4c43c162a5fde2fe95594e9b70044b41

+ 7 - 21
src/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -723,9 +723,7 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
             Intent getServerInfoIntent = new Intent();
             getServerInfoIntent.setAction(OperationsService.ACTION_GET_SERVER_INFO);
             getServerInfoIntent.putExtra(OperationsService.EXTRA_SERVER_URL, uri);
-            getServerInfoIntent.putExtra(OperationsService.EXTRA_AUTH_TOKEN_TYPE, mAuthTokenType);
             if (mOperationsServiceBinder != null) {
-                //Log_OC.wtf(TAG, "checking server..." );
                 mWaitingForOpId = mOperationsServiceBinder.newOperation(getServerInfoIntent);
             } else {
               Log_OC.wtf(TAG, "Server check tried with OperationService unbound!" );
@@ -837,22 +835,16 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
                 IndeterminateProgressDialog.newInstance(R.string.auth_trying_to_login, true);
         dialog.show(getSupportFragmentManager(), WAIT_DIALOG_TAG);
 
-        /// test credentials accessing the root folder
-        String remotePath ="";
-        boolean successIfAbsent = false;
-        startExistenceCheckRemoteOperation(
-                remotePath, this, successIfAbsent, username, password);
+        /// validate credentials accessing the root folder
+        accessRootFolderRemoteOperation(username, password);
         
     }
 
-    private void startExistenceCheckRemoteOperation(
-            String remotePath, Context context, boolean successIfAbsent,
-            String username, String password) {
+    private void accessRootFolderRemoteOperation(String username, String password) {
         Intent existenceCheckIntent = new Intent();
         existenceCheckIntent.setAction(OperationsService.ACTION_EXISTENCE_CHECK);
         existenceCheckIntent.putExtra(OperationsService.EXTRA_SERVER_URL, mServerInfo.mBaseUrl);
-        existenceCheckIntent.putExtra(OperationsService.EXTRA_REMOTE_PATH, remotePath);
-        existenceCheckIntent.putExtra(OperationsService.EXTRA_SUCCESS_IF_ABSENT, successIfAbsent);
+        existenceCheckIntent.putExtra(OperationsService.EXTRA_REMOTE_PATH, "/");
         existenceCheckIntent.putExtra(OperationsService.EXTRA_USERNAME, username);
         existenceCheckIntent.putExtra(OperationsService.EXTRA_PASSWORD, password);
         existenceCheckIntent.putExtra(OperationsService.EXTRA_AUTH_TOKEN, mAuthToken);
@@ -900,11 +892,8 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
                 IndeterminateProgressDialog.newInstance(R.string.auth_trying_to_login, true);
         dialog.show(getSupportFragmentManager(), WAIT_DIALOG_TAG);
 
-        /// test credentials accessing the root folder
-        String remotePath ="";
-        boolean successIfAbsent = false;
-        startExistenceCheckRemoteOperation(
-                remotePath, this, successIfAbsent, "", "");
+        /// validate credentials accessing the root folder
+        accessRootFolderRemoteOperation("", "");
 
     }
 
@@ -1290,10 +1279,7 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
             //mAuthToken = ((OAuth2GetAccessToken)operation).getResultTokenMap().get(OAuth2Constants.KEY_ACCESS_TOKEN);
             Log_OC.d(TAG, "Got ACCESS TOKEN: " + mAuthToken);
             
-            String remotePath ="";
-            boolean successIfAbsent = false;
-            startExistenceCheckRemoteOperation(
-                    remotePath, this, successIfAbsent, "", "");
+            accessRootFolderRemoteOperation("", "");
 
         } else {
             updateAuthStatusIconAndText(result);

+ 1 - 3
src/com/owncloud/android/operations/DetectAuthenticationMethodOperation.java

@@ -64,7 +64,6 @@ public class DetectAuthenticationMethodOperation extends RemoteOperation {
     }
     
     private Context mContext;
-    private String mWebDavUrl;
     
     /**
      * Constructor
@@ -72,9 +71,8 @@ public class DetectAuthenticationMethodOperation extends RemoteOperation {
      * @param context       Android context of the caller.
      * @param webdavUrl
      */
-    public DetectAuthenticationMethodOperation(Context context, String webdavUrl) {
+    public DetectAuthenticationMethodOperation(Context context) {
         mContext = context;
-        mWebDavUrl = webdavUrl;
     }
     
 

+ 2 - 8
src/com/owncloud/android/operations/GetServerInfoOperation.java

@@ -53,7 +53,6 @@ public class GetServerInfoOperation extends RemoteOperation {
     private static final String TAG = GetServerInfoOperation.class.getSimpleName();
     
     private String mUrl;
-    private String mAuthTokenType;
     private Context mContext;
     
     private ServerInfo mResultData;
@@ -62,14 +61,11 @@ public class GetServerInfoOperation extends RemoteOperation {
      * Constructor.
      * 
      * @param url               URL to an ownCloud server.
-     * @param authTokenType     Identifies the authorization token supported by the caller;
-     *                          TODO ugly dependency, get rid of it. 
      * @param context           Android context; needed to check network state
      *                          TODO ugly dependency, get rid of it. 
      */
-    public GetServerInfoOperation(String url, String authTokenType, Context context) {
+    public GetServerInfoOperation(String url, Context context) {
         mUrl = trimWebdavSuffix(url);
-        mAuthTokenType = authTokenType;
         mContext = context;
         
         mResultData = new ServerInfo();
@@ -114,10 +110,8 @@ public class GetServerInfoOperation extends RemoteOperation {
 	
     private RemoteOperationResult detectAuthorizationMethod(OwnCloudClient client) {
         Log_OC.d(TAG, "Trying empty authorization to detect authentication method");
-        String webdav_path = AccountUtils.getWebdavPath(mResultData.mVersion, mAuthTokenType);
-        String webdav_url = mResultData.mBaseUrl + webdav_path;
         DetectAuthenticationMethodOperation operation = 
-                new DetectAuthenticationMethodOperation(mContext, webdav_url);
+                new DetectAuthenticationMethodOperation(mContext);
         return operation.execute(client);
     }
     

+ 8 - 9
src/com/owncloud/android/services/OperationsService.java

@@ -71,7 +71,6 @@ public class OperationsService extends Service {
     
     public static final String EXTRA_ACCOUNT = "ACCOUNT";
     public static final String EXTRA_SERVER_URL = "SERVER_URL";
-    public static final String EXTRA_AUTH_TOKEN_TYPE = "AUTH_TOKEN_TYPE";
     public static final String EXTRA_OAUTH2_QUERY_PARAMETERS = "OAUTH2_QUERY_PARAMETERS";
     public static final String EXTRA_REMOTE_PATH = "REMOTE_PATH";
     public static final String EXTRA_SEND_INTENT = "SEND_INTENT";
@@ -331,10 +330,7 @@ public class OperationsService extends Service {
                         
                     } else if (action.equals(ACTION_GET_SERVER_INFO)) { 
                         // check OC server and get basic information from it
-                        String authTokenType = 
-                                operationIntent.getStringExtra(EXTRA_AUTH_TOKEN_TYPE);
-                        operation = new GetServerInfoOperation(
-                                serverUrl, authTokenType, OperationsService.this);
+                        operation = new GetServerInfoOperation(serverUrl, OperationsService.this);
                         
                     } else if (action.equals(ACTION_OAUTH2_GET_ACCESS_TOKEN)) {
                         /// GET ACCESS TOKEN to the OAuth server
@@ -349,7 +345,7 @@ public class OperationsService extends Service {
                     } else if (action.equals(ACTION_EXISTENCE_CHECK)) {
                         // Existence Check 
                         String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
-                        boolean successIfAbsent = operationIntent.getBooleanExtra(EXTRA_SUCCESS_IF_ABSENT, true);
+                        boolean successIfAbsent = operationIntent.getBooleanExtra(EXTRA_SUCCESS_IF_ABSENT, false);
                         operation = new ExistenceCheckRemoteOperation(remotePath, OperationsService.this, successIfAbsent);
                         
                     } else if (action.equals(ACTION_GET_USER_NAME)) {
@@ -475,16 +471,19 @@ public class OperationsService extends Service {
                                         getContentResolver());
                     } else {
                         OwnCloudCredentials credentials = null;
-                        if (mLastTarget.mUsername != null) {
+                        if (mLastTarget.mUsername != null && 
+                                mLastTarget.mUsername.length() > 0) {
                             credentials = OwnCloudCredentialsFactory.newBasicCredentials(
                                     mLastTarget.mUsername, 
                                     mLastTarget.mPassword);  // basic
                             
-                        } else if (mLastTarget.mAuthToken != null) {
+                        } else if (mLastTarget.mAuthToken != null && 
+                                mLastTarget.mAuthToken.length() > 0) {
                             credentials = OwnCloudCredentialsFactory.newBearerCredentials(
                                     mLastTarget.mAuthToken);  // bearer token
                             
-                        } else if (mLastTarget.mCookie != null) {
+                        } else if (mLastTarget.mCookie != null &&
+                                mLastTarget.mCookie.length() > 0) {
                             credentials = OwnCloudCredentialsFactory.newSamlSsoCredentials(
                                     mLastTarget.mCookie); // SAML SSO
                         }