瀏覽代碼

Convert accessRootFolderRemoteOperation method in AsyncTask

masensio 10 年之前
父節點
當前提交
0b217c465d
共有 2 個文件被更改,包括 22 次插入15 次删除
  1. 1 1
      owncloud-android-library
  2. 21 14
      src/com/owncloud/android/authentication/AuthenticatorActivity.java

+ 1 - 1
owncloud-android-library

@@ -1 +1 @@
-Subproject commit e87f5f25ad91950d47ec9b6fa01401360cd7ec8d
+Subproject commit 2f178c9c34e3dab507c46e718705913ed44db3c5

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

@@ -101,8 +101,9 @@ import com.owncloud.android.utils.DisplayUtils;
  * @author masensio
  */
 public class AuthenticatorActivity extends AccountAuthenticatorActivity
-implements  OnRemoteOperationListener, OnFocusChangeListener, OnEditorActionListener, 
-SsoWebViewClientListener, OnSslUntrustedCertListener {
+        implements  OnRemoteOperationListener, OnFocusChangeListener, OnEditorActionListener,
+        SsoWebViewClientListener, OnSslUntrustedCertListener,
+        AuthenticatorAsyncTask.OnAuthenticatorTaskListener {
 
     private static final String TAG = AuthenticatorActivity.class.getSimpleName();
 
@@ -892,18 +893,10 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
             mAccountMgr.setUserData(mAccount, Constants.KEY_COOKIES, null);
         }
 
-        Intent existenceCheckIntent = new Intent();
-        existenceCheckIntent.setAction(OperationsService.ACTION_EXISTENCE_CHECK);
-        existenceCheckIntent.putExtra(OperationsService.EXTRA_SERVER_URL, mServerInfo.mBaseUrl);
-        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);
-        
-        if (mOperationsServiceBinder != null) {
-            //Log_OC.wtf(TAG, "starting existenceCheckRemoteOperation..." );
-            mWaitingForOpId = mOperationsServiceBinder.queueNewOperation(existenceCheckIntent);
-        }
+        AuthenticatorAsyncTask asyncTask = new AuthenticatorAsyncTask(this);
+        String[] params = { mServerInfo.mBaseUrl, username, password, mAuthToken, mAuthTokenType};
+        asyncTask.execute(params);
+
     }
 
     /**
@@ -974,6 +967,7 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
             onGetOAuthAccessTokenFinish(result);
 
         } else if (operation instanceof ExistenceCheckRemoteOperation)  {
+            // TODO : remove this response??
             //Log_OC.wtf(TAG, "received detection response through callback" );
             if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).
                     equals(mAuthTokenType)) {
@@ -1900,4 +1894,17 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
     public void doNegativeAuthenticatioDialogClick(){
         mIsFirstAuthAttempt = true;
     }
+
+
+    @Override
+    public void onAuthenticatorTaskCallback(RemoteOperationResult result) {
+        //Log_OC.wtf(TAG, "received detection response through callback" );
+        if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).
+                equals(mAuthTokenType)) {
+            onSamlBasedFederatedSingleSignOnAuthorizationStart(result);
+
+        } else {
+            onAuthorizationCheckFinish(result);
+        }
+    }
 }