mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fix NPE and comments
This commit is contained in:
parent
61d1963301
commit
fa91b09b5b
2 changed files with 10 additions and 2 deletions
|
|
@ -75,19 +75,25 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
|||
boolean accountCreated = AccountManager.get(context).addAccountExplicitly(account, password, null);
|
||||
|
||||
Bundle extras = context.getIntent().getExtras();
|
||||
|
||||
|
||||
if (extras != null) {
|
||||
Log.d("LoginActivity", "Bundle of extras: " + extras.toString());
|
||||
if (accountCreated) { // Pass the new account back to the account manager
|
||||
AccountAuthenticatorResponse response = extras.getParcelable(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE);
|
||||
Bundle authResult = new Bundle();
|
||||
authResult.putString(AccountManager.KEY_ACCOUNT_NAME, username);
|
||||
authResult.putString(AccountManager.KEY_ACCOUNT_TYPE, WikiAccountAuthenticator.COMMONS_ACCOUNT_TYPE);
|
||||
//FIXME: NPE here sometimes, otherwise goes to Signup screen upon successful login...
|
||||
|
||||
if (response != null) {
|
||||
response.onResult(authResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
// FIXME: If the user turns it off, it shouldn't be auto turned back on
|
||||
ContentResolver.setSyncAutomatically(account, ContributionsContentProvider.AUTHORITY, true); // Enable sync by default!
|
||||
ContentResolver.setSyncAutomatically(account, ModificationsContentProvider.AUTHORITY, true); // Enable sync by default!
|
||||
//FIXME: This is taking users back to SignupActivity
|
||||
context.finish();
|
||||
} else {
|
||||
int response;
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ public class SignupActivity extends Activity {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (otherPage == true) {
|
||||
|
|
@ -72,4 +73,5 @@ public class SignupActivity extends Activity {
|
|||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue