Improve custom handling

This commit is contained in:
Mario Danic 2017-03-28 13:02:02 +02:00 committed by tobiasKaminsky
parent 9ea45c74a7
commit 1ea6607186
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
8 changed files with 12 additions and 74 deletions

View file

@ -94,14 +94,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
return e.getFailureBundle();
}
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 intent = new Intent(mContext, AuthenticatorActivity.class);
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
intent.putExtra(KEY_REQUIRED_FEATURES, requiredFeatures);
@ -145,14 +138,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
return e.getFailureBundle();
}
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 intent = new Intent(mContext, AuthenticatorActivity.class);
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE,
response);
intent.putExtra(KEY_ACCOUNT, account);
@ -203,13 +189,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
}
/// if not stored, return Intent to access the AuthenticatorActivity and UPDATE the token for the account
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 intent = new Intent(mContext, AuthenticatorActivity.class);
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
intent.putExtra(KEY_LOGIN_OPTIONS, options);
@ -240,13 +220,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
Account account, String authTokenType, Bundle options)
throws NetworkErrorException {
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 intent = new Intent(mContext, AuthenticatorActivity.class);
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
intent.putExtra(KEY_ACCOUNT, account);
intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);

View file

@ -41,7 +41,6 @@ import android.util.Pair;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.authentication.ModifiedAuthenticatorActivity;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.OwnCloudAccount;
@ -580,14 +579,7 @@ public class FileDownloader extends Service
if (needsToUpdateCredentials) {
// let the user update credentials with one click
Intent updateAccountCredentials;
if (!getResources().getBoolean(R.bool.push_enabled)
&& !getResources().getBoolean(R.bool.analytics_enabled)) {
updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
} else {
updateAccountCredentials = new Intent(this, ModifiedAuthenticatorActivity.class);
}
Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT,
download.getAccount());
updateAccountCredentials.putExtra(

View file

@ -48,7 +48,6 @@ import android.util.Pair;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.authentication.ModifiedAuthenticatorActivity;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.ThumbnailsCacheManager;
@ -1082,13 +1081,7 @@ public class FileUploader extends Service
if (needsToUpdateCredentials) {
// let the user update credentials with one click
// let the user update credentials with one click
Intent updateAccountCredentials;
if (!getResources().getBoolean(R.bool.push_enabled)
&& !getResources().getBoolean(R.bool.analytics_enabled)) {
updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
} else {
updateAccountCredentials = new Intent(this, ModifiedAuthenticatorActivity.class);
}
Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
updateAccountCredentials.putExtra(
AuthenticatorActivity.EXTRA_ACCOUNT, upload.getAccount()
);

View file

@ -37,7 +37,6 @@ import android.support.v4.app.NotificationCompat;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.authentication.ModifiedAuthenticatorActivity;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
@ -401,14 +400,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
if (needsToUpdateCredentials) {
// let the user update credentials with one click
// let the user update credentials with one click
Intent updateAccountCredentials;
if (!getContext().getResources().getBoolean(R.bool.push_enabled)
&& !getContext().getResources().getBoolean(R.bool.analytics_enabled)) {
updateAccountCredentials = new Intent(getContext(), AuthenticatorActivity.class);
} else {
updateAccountCredentials = new Intent(getContext(), ModifiedAuthenticatorActivity.class);
}
Intent updateAccountCredentials = new Intent(getContext(), AuthenticatorActivity.class);
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, getAccount());
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION,
AuthenticatorActivity.ACTION_UPDATE_EXPIRED_TOKEN);

View file

@ -40,7 +40,6 @@ import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.authentication.ModifiedAuthenticatorActivity;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.ui.helpers.FileOperationsHelper;
import com.owncloud.android.files.services.FileDownloader;
@ -397,13 +396,7 @@ public abstract class FileActivity extends DrawerActivity
}
/// step 2 - request credentials to user
Intent updateAccountCredentials;
if (!getResources().getBoolean(R.bool.push_enabled) &&
!getResources().getBoolean(R.bool.analytics_enabled)) {
updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
} else {
updateAccountCredentials = new Intent(this, ModifiedAuthenticatorActivity.class);
}
Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, account);
updateAccountCredentials.putExtra(
AuthenticatorActivity.EXTRA_ACTION,

View file

@ -48,7 +48,6 @@ import android.widget.TextView;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.authentication.ModifiedAuthenticatorActivity;
import com.owncloud.android.lib.common.UserInfo;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
@ -286,14 +285,7 @@ public class UserInfoActivity extends FileActivity {
private void changeAccountPassword(Account account) {
// let the user update credentials with one click
Intent updateAccountCredentials;
if (!getResources().getBoolean(R.bool.push_enabled) &&
!getResources().getBoolean(R.bool.analytics_enabled)) {
updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
} else {
updateAccountCredentials = new Intent(this, ModifiedAuthenticatorActivity.class);
}
Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, account);
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION,
AuthenticatorActivity.ACTION_UPDATE_TOKEN);

View file

@ -1,6 +1,7 @@
package com.owncloud.android.authentication;
import android.os.Bundle;
import android.util.Log;
import com.owncloud.android.utils.GooglePlayUtils;
@ -29,6 +30,7 @@ public class ModifiedAuthenticatorActivity extends AuthenticatorActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d("MARIO", "HERE");
GooglePlayUtils.checkPlayServices(this);
}

View file

@ -112,7 +112,7 @@
<!-- analytics enabled -->
<bool name="analytics_enabled">false</bool>
<bool name="push_enabled">true</bool>
<bool name="push_enabled">false</bool>
<!-- Files becomes Home -->
<bool name="use_home">true</bool>