aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-02-17 21:12:40 +0100
committerChristian Schneppe <christian@pix-art.de>2018-02-17 21:12:40 +0100
commit26bb133b103ee393218316bcabbea4431b96708e (patch)
treeb5a28839172c54f1d3b0c3baab3ad50c83374faf
parente35610c88df1869059eb2a9ef0fb6093274e1421 (diff)
Don't add account if user cancels
-rw-r--r--src/main/java/de/pixart/messenger/ui/EditAccountActivity.java17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
index 7ed6e79ff..24218be4e 100644
--- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
@@ -278,7 +278,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
@Override
public void onClick(final View v) {
- deleteMagicCreatedAccountAndReturnIfNecessary();
+ deleteAccountAndReturnIfNecessary();
finish();
}
};
@@ -311,22 +311,21 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
@Override
public boolean onNavigateUp() {
- deleteMagicCreatedAccountAndReturnIfNecessary();
+ deleteAccountAndReturnIfNecessary();
return super.onNavigateUp();
}
@Override
public void onBackPressed() {
- deleteMagicCreatedAccountAndReturnIfNecessary();
+ deleteAccountAndReturnIfNecessary();
super.onBackPressed();
}
- private void deleteMagicCreatedAccountAndReturnIfNecessary() {
- if (Config.MAGIC_CREATE_DOMAIN != null
- && mAccount != null
- && mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE)
- && mAccount.isOptionSet(Account.OPTION_REGISTER)
- && xmppConnectionService.getAccounts().size() == 1) {
+ private void deleteAccountAndReturnIfNecessary() {
+ if (mInitMode && mAccount != null && !mAccount.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY)) {
+ xmppConnectionService.deleteAccount(mAccount);
+ }
+ if (xmppConnectionService.getAccounts().size() == 0) {
xmppConnectionService.deleteAccount(mAccount);
Intent intent = new Intent(EditAccountActivity.this, WelcomeActivity.class);
WelcomeActivity.addInviteUri(intent, getIntent());