Convert accessRootFolderRemoteOperation method in AsyncTask
authormasensio <masensio@solidgear.es>
Mon, 9 Feb 2015 13:13:40 +0000 (14:13 +0100)
committermasensio <masensio@solidgear.es>
Mon, 9 Feb 2015 13:13:40 +0000 (14:13 +0100)
owncloud-android-library
src/com/owncloud/android/authentication/AuthenticatorActivity.java

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