|
@@ -21,16 +21,19 @@
|
|
|
|
|
|
package com.owncloud.android.authentication;
|
|
|
|
|
|
-import com.owncloud.android.MainApp;
|
|
|
-import com.owncloud.android.R;
|
|
|
-
|
|
|
-import android.accounts.*;
|
|
|
+import android.accounts.AbstractAccountAuthenticator;
|
|
|
+import android.accounts.Account;
|
|
|
+import android.accounts.AccountAuthenticatorResponse;
|
|
|
+import android.accounts.AccountManager;
|
|
|
+import android.accounts.NetworkErrorException;
|
|
|
import android.content.Context;
|
|
|
import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
import android.os.Handler;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
+import com.owncloud.android.MainApp;
|
|
|
+import com.owncloud.android.R;
|
|
|
import com.owncloud.android.lib.common.accounts.AccountTypeUtils;
|
|
|
import com.owncloud.android.lib.common.utils.Log_OC;
|
|
|
|
|
@@ -90,8 +93,15 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
|
|
|
+ e.getMessage(), e);
|
|
|
return e.getFailureBundle();
|
|
|
}
|
|
|
-
|
|
|
- final Intent intent = new Intent(mContext, AuthenticatorActivity.class);
|
|
|
+
|
|
|
+ Intent intent;
|
|
|
+ if (!mContext.getResources().getBoolean(R.bool.push_enabled) &&
|
|
|
+ !mContext.getResources().getBoolean(R.bool.analytics_enabled)) {
|
|
|
+ intent = new Intent(mContext, AuthenticatorActivity.class);
|
|
|
+ } else {
|
|
|
+ intent = new Intent(mContext, ModifiedAuthenticatorActivity.class);
|
|
|
+ }
|
|
|
+
|
|
|
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
|
|
|
intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
|
|
|
intent.putExtra(KEY_REQUIRED_FEATURES, requiredFeatures);
|
|
@@ -134,7 +144,15 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
|
|
|
Log_OC.e(TAG, "Failed to validate account type " + account.type + ": " + e.getMessage(), e);
|
|
|
return e.getFailureBundle();
|
|
|
}
|
|
|
- Intent intent = new Intent(mContext, AuthenticatorActivity.class);
|
|
|
+
|
|
|
+ Intent intent;
|
|
|
+ if (!mContext.getResources().getBoolean(R.bool.push_enabled)
|
|
|
+ && !mContext.getResources().getBoolean(R.bool.analytics_enabled)) {
|
|
|
+ intent = new Intent(mContext, AuthenticatorActivity.class);
|
|
|
+ } else {
|
|
|
+ intent = new Intent(mContext, ModifiedAuthenticatorActivity.class);
|
|
|
+ }
|
|
|
+
|
|
|
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE,
|
|
|
response);
|
|
|
intent.putExtra(KEY_ACCOUNT, account);
|
|
@@ -185,7 +203,13 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
|
|
|
}
|
|
|
|
|
|
/// if not stored, return Intent to access the AuthenticatorActivity and UPDATE the token for the account
|
|
|
- final Intent intent = new Intent(mContext, AuthenticatorActivity.class);
|
|
|
+ Intent intent;
|
|
|
+ if (!mContext.getResources().getBoolean(R.bool.push_enabled)
|
|
|
+ && !mContext.getResources().getBoolean(R.bool.analytics_enabled)) {
|
|
|
+ intent = new Intent(mContext, AuthenticatorActivity.class);
|
|
|
+ } else {
|
|
|
+ intent = new Intent(mContext, ModifiedAuthenticatorActivity.class);
|
|
|
+ }
|
|
|
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
|
|
|
intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
|
|
|
intent.putExtra(KEY_LOGIN_OPTIONS, options);
|
|
@@ -215,7 +239,14 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
|
|
|
public Bundle updateCredentials(AccountAuthenticatorResponse response,
|
|
|
Account account, String authTokenType, Bundle options)
|
|
|
throws NetworkErrorException {
|
|
|
- final Intent intent = new Intent(mContext, AuthenticatorActivity.class);
|
|
|
+
|
|
|
+ Intent intent;
|
|
|
+ if (!mContext.getResources().getBoolean(R.bool.push_enabled) &&
|
|
|
+ !mContext.getResources().getBoolean(R.bool.analytics_enabled)) {
|
|
|
+ intent = new Intent(mContext, AuthenticatorActivity.class);
|
|
|
+ } else {
|
|
|
+ intent = new Intent(mContext, ModifiedAuthenticatorActivity.class);
|
|
|
+ }
|
|
|
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
|
|
|
intent.putExtra(KEY_ACCOUNT, account);
|
|
|
intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
|