From 0b217c465dbf124c0f20b17b48d49e715e00603e Mon Sep 17 00:00:00 2001 From: masensio Date: Mon, 9 Feb 2015 14:13:40 +0100 Subject: [PATCH] Convert accessRootFolderRemoteOperation method in AsyncTask --- owncloud-android-library | 2 +- .../authentication/AuthenticatorActivity.java | 35 +++++++++++-------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/owncloud-android-library b/owncloud-android-library index e87f5f25ad..2f178c9c34 160000 --- a/owncloud-android-library +++ b/owncloud-android-library @@ -1 +1 @@ -Subproject commit e87f5f25ad91950d47ec9b6fa01401360cd7ec8d +Subproject commit 2f178c9c34e3dab507c46e718705913ed44db3c5 diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index 3a64076541..a7774ffc56 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/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); + } + } }