Internal refactorization of AccountAuthenticatorActivity (and related dependencies)

This commit is contained in:
David A. Velasco 2014-04-04 14:18:42 +02:00
parent 5611205f1d
commit 7cf05f3647
8 changed files with 433 additions and 413 deletions

View file

@ -67,7 +67,7 @@
android:text="@string/auth_check_server"
android:visibility="gone" />
<TextView
android:id="@+id/auth_message"
android:id="@+id/instructions_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="fill_horizontal"

View file

@ -54,7 +54,7 @@
android:visibility="gone" />
<TextView
android:id="@+id/auth_message"
android:id="@+id/instructions_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="fill_horizontal"

View file

@ -195,8 +195,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
intent.putExtra(KEY_LOGIN_OPTIONS, options);
intent.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, account);
intent.putExtra(AuthenticatorActivity.EXTRA_ENFORCED_UPDATE, true);
intent.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_TOKEN);
intent.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_EXPIRED_TOKEN);
final Bundle bundle = new Bundle();

View file

@ -478,8 +478,7 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
// let the user update credentials with one click
Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, download.getAccount());
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ENFORCED_UPDATE, true);
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_TOKEN);
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_EXPIRED_TOKEN);
updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
updateAccountCredentials.addFlags(Intent.FLAG_FROM_BACKGROUND);

View file

@ -785,8 +785,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
// let the user update credentials with one click
Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, upload.getAccount());
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ENFORCED_UPDATE, true);
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_TOKEN);
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_EXPIRED_TOKEN);
updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
updateAccountCredentials.addFlags(Intent.FLAG_FROM_BACKGROUND);

View file

@ -93,8 +93,8 @@ public class GetServerInfoOperation extends RemoteOperation {
if (result.isSuccess()) {
// second: get authentication method required by the server
mResultData.mVersion = (OwnCloudVersion)(result.getData().get(0));
boolean isSslConn = (result.getCode() == ResultCode.OK_SSL);
mResultData.mBaseUrl = normalizeProtocolPrefix(mUrl, isSslConn);
mResultData.mIsSslConn = (result.getCode() == ResultCode.OK_SSL);
mResultData.mBaseUrl = normalizeProtocolPrefix(mUrl, mResultData.mIsSslConn);
RemoteOperationResult detectAuthResult = detectAuthorizationMethod(client);
// third: merge results
@ -155,9 +155,10 @@ public class GetServerInfoOperation extends RemoteOperation {
public static class ServerInfo {
public OwnCloudVersion mVersion;
public String mBaseUrl;
public AuthenticationMethod mAuthMethod;
public OwnCloudVersion mVersion = null;
public String mBaseUrl = "";
public AuthenticationMethod mAuthMethod = AuthenticationMethod.UNKNOWN;
public boolean mIsSslConn = false;
}
}

View file

@ -397,8 +397,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
// let the user update credentials with one click
Intent updateAccountCredentials = new Intent(getContext(), AuthenticatorActivity.class);
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, getAccount());
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ENFORCED_UPDATE, true);
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_TOKEN);
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_EXPIRED_TOKEN);
updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
updateAccountCredentials.addFlags(Intent.FLAG_FROM_BACKGROUND);