Allow cancel onboarding
Stephen Paul Weber
created 2 years ago
If this is just a register not part of inversion, archive the conversation when
they say "no thanks" so they get back to their regular first start experience.
If this is part of inversion, remove the onboarding account since they aren't
going to use it and set a flag so we know to redirect to magic create instead of
back to the welcome screen. The flag also lets us know not to offer cheogram
again right after magic create like we normally would. Then we can clear the
flag out and move on as usual.
Change summary
src/cheogram/java/eu/siacs/conversations/utils/SignupUtils.java | 5
src/main/java/eu/siacs/conversations/entities/Conversation.java | 8
src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java | 4
3 files changed, 13 insertions(+), 4 deletions(-)
Detailed changes
@@ -62,7 +62,7 @@ public class SignupUtils {
if (Config.X509_VERIFICATION) {
intent = new Intent(activity, ManageAccountActivity.class);
} else if (Config.MAGIC_CREATE_DOMAIN != null) {
- intent = getSignUpIntent(activity);
+ intent = activity.xmppConnectionService.getPreferences().getBoolean("onboarding_canceled", false) ? new Intent(activity, MagicCreateActivity.class) : getSignUpIntent(activity);
} else {
intent = new Intent(activity, EditAccountActivity.class);
}
@@ -70,8 +70,7 @@ public class SignupUtils {
intent = new Intent(activity, StartConversationActivity.class);
}
}
- intent.putExtra("init", true);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
return intent;
}
-}
+}
@@ -2498,6 +2498,14 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
}
if (responseElement == null && command.getAttribute("status") != null && (command.getAttribute("status").equals("completed") || command.getAttribute("status").equals("canceled"))) {
+ if (mNode.equals("jabber:iq:register") && command.getAttribute("status").equals("canceled")) {
+ if (xmppConnectionService.isOnboarding()) {
+ xmppConnectionService.getPreferences().edit().putBoolean("onboarding_canceled", true).commit();
+ xmppConnectionService.deleteAccount(getAccount());
+ }
+ xmppConnectionService.archiveConversation(Conversation.this);
+ }
+
removeSession(this);
return;
}
@@ -917,7 +917,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
configureHomeButton();
Intent intent = pendingViewIntent.pop();
- if (intent != null && intent.getBooleanExtra("init", false)) {
+ if (intent != null && intent.getBooleanExtra("init", false) && !xmppConnectionService.getPreferences().getBoolean("onboarding_canceled", false)) {
Account selectedAccount = xmppConnectionService.getAccounts().get(0);
final String accountJid = intent.getStringExtra(EXTRA_ACCOUNT);
intent = null;
@@ -1033,6 +1033,8 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
}
}
+ xmppConnectionService.getPreferences().edit().remove("onboarding_canceled").commit();
+
if (intent != null && processViewIntent(intent)) {
filter(null);
} else {