reset database immediately when the new account is stored (otherwise this might lead to inconsistency)
This commit is contained in:
parent
f053229879
commit
842b7be3a3
1 changed files with 11 additions and 5 deletions
|
@ -252,6 +252,8 @@ public class LoginDialogActivity extends AppCompatActivity {
|
|||
editor.putBoolean(SettingsActivity.SW_USE_SINGLE_SIGN_ON, true);
|
||||
editor.commit();
|
||||
|
||||
resetDatabase();
|
||||
|
||||
SingleAccountHelper.setCurrentAccount(this, importedAccount.name);
|
||||
|
||||
mApi.initApi(new NextcloudAPI.ApiConnectedListener() {
|
||||
|
@ -337,6 +339,8 @@ public class LoginDialogActivity extends AppCompatActivity {
|
|||
editor.putBoolean(SettingsActivity.SW_USE_SINGLE_SIGN_ON, false);
|
||||
editor.commit();
|
||||
|
||||
resetDatabase();
|
||||
|
||||
final ProgressDialog dialogLogin = buildPendingDialogWhileLoggingIn();
|
||||
dialogLogin.show();
|
||||
|
||||
|
@ -357,6 +361,12 @@ public class LoginDialogActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
|
||||
private void resetDatabase() {
|
||||
//Reset Database
|
||||
DatabaseConnectionOrm dbConn = new DatabaseConnectionOrm(LoginDialogActivity.this);
|
||||
dbConn.resetDatabase();
|
||||
}
|
||||
|
||||
private void finishLogin(final ProgressDialog dialogLogin) {
|
||||
mApi.getAPI().version()
|
||||
.subscribeOn(Schedulers.newThread())
|
||||
|
@ -409,10 +419,6 @@ public class LoginDialogActivity extends AppCompatActivity {
|
|||
Log.v(TAG, "onComplete() called");
|
||||
|
||||
if(loginSuccessful) {
|
||||
//Reset Database
|
||||
DatabaseConnectionOrm dbConn = new DatabaseConnectionOrm(LoginDialogActivity.this);
|
||||
dbConn.resetDatabase();
|
||||
|
||||
Intent returnIntent = new Intent();
|
||||
setResult(RESULT_OK, returnIntent);
|
||||
|
||||
|
|
Loading…
Reference in a new issue