Don't add account if user cancels. Fixes #2797
This commit is contained in:
parent
3b7d9b39f7
commit
3fa205d463
|
@ -263,7 +263,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(final View v) {
|
public void onClick(final View v) {
|
||||||
deleteMagicCreatedAccountAndReturnIfNecessary();
|
deleteAccountAndReturnIfNecessary();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -296,23 +296,22 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onNavigateUp() {
|
public boolean onNavigateUp() {
|
||||||
deleteMagicCreatedAccountAndReturnIfNecessary();
|
deleteAccountAndReturnIfNecessary();
|
||||||
return super.onNavigateUp();
|
return super.onNavigateUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
deleteMagicCreatedAccountAndReturnIfNecessary();
|
deleteAccountAndReturnIfNecessary();
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteMagicCreatedAccountAndReturnIfNecessary() {
|
private void deleteAccountAndReturnIfNecessary() {
|
||||||
if (Config.MAGIC_CREATE_DOMAIN != null
|
if (mInitMode && mAccount != null && !mAccount.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY)) {
|
||||||
&& mAccount != null
|
|
||||||
&& mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE)
|
|
||||||
&& mAccount.isOptionSet(Account.OPTION_REGISTER)
|
|
||||||
&& xmppConnectionService.getAccounts().size() == 1) {
|
|
||||||
xmppConnectionService.deleteAccount(mAccount);
|
xmppConnectionService.deleteAccount(mAccount);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (xmppConnectionService.getAccounts().size() == 0) {
|
||||||
Intent intent = new Intent(EditAccountActivity.this, WelcomeActivity.class);
|
Intent intent = new Intent(EditAccountActivity.this, WelcomeActivity.class);
|
||||||
WelcomeActivity.addInviteUri(intent, getIntent());
|
WelcomeActivity.addInviteUri(intent, getIntent());
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
Loading…
Reference in New Issue