From 4864137fa10482e9144c7c296530f24323606312 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 5 May 2021 23:13:56 +0200 Subject: [PATCH] Properly clean the back stack if the user cancel registration when waiting for email/msisdn validation --- CHANGES.md | 1 + .../java/im/vector/app/features/login/LoginActivity.kt | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 15c811c19b..b3f9615c70 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -23,6 +23,7 @@ Bugfix 🐛: - Fix missing sender information after edits (#3184) - Fix read marker not updating automatically (#3267) - Sent video does not contains duration (#3272) + - Properly clean the back stack if the user cancel registration when waiting for email validation Translations 🗣: - diff --git a/vector/src/main/java/im/vector/app/features/login/LoginActivity.kt b/vector/src/main/java/im/vector/app/features/login/LoginActivity.kt index 803fd38983..9fa560eb23 100644 --- a/vector/src/main/java/im/vector/app/features/login/LoginActivity.kt +++ b/vector/src/main/java/im/vector/app/features/login/LoginActivity.kt @@ -183,18 +183,24 @@ open class LoginActivity : VectorBaseActivity(), ToolbarCo // Go back to the login fragment supportFragmentManager.popBackStack(FRAGMENT_LOGIN_TAG, POP_BACK_STACK_EXCLUSIVE) } - is LoginViewEvents.OnSendEmailSuccess -> + is LoginViewEvents.OnSendEmailSuccess -> { + // Pop the enter email Fragment + supportFragmentManager.popBackStack(FRAGMENT_REGISTRATION_STAGE_TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE) addFragmentToBackstack(R.id.loginFragmentContainer, LoginWaitForEmailFragment::class.java, LoginWaitForEmailFragmentArgument(loginViewEvents.email), tag = FRAGMENT_REGISTRATION_STAGE_TAG, option = commonOption) - is LoginViewEvents.OnSendMsisdnSuccess -> + } + is LoginViewEvents.OnSendMsisdnSuccess -> { + // Pop the enter Msisdn Fragment + supportFragmentManager.popBackStack(FRAGMENT_REGISTRATION_STAGE_TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE) addFragmentToBackstack(R.id.loginFragmentContainer, LoginGenericTextInputFormFragment::class.java, LoginGenericTextInputFormFragmentArgument(TextInputFormFragmentMode.ConfirmMsisdn, true, loginViewEvents.msisdn), tag = FRAGMENT_REGISTRATION_STAGE_TAG, option = commonOption) + } is LoginViewEvents.Failure, is LoginViewEvents.Loading -> // This is handled by the Fragments