allowing the child ftue fragments to determine if they're the back action is a hard exit

This commit is contained in:
Adam Brown 2022-07-26 11:53:04 +01:00
parent abab2a0db7
commit c66b1885ad
1 changed files with 2 additions and 1 deletions

View File

@ -46,6 +46,7 @@ abstract class AbstractFtueAuthFragment<VB : ViewBinding> : VectorBaseFragment<V
// Due to async, we keep a boolean to avoid displaying twice the cancellation dialog
private var displayCancelDialog = true
protected open fun backIsHardExit() = true
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -115,7 +116,7 @@ abstract class AbstractFtueAuthFragment<VB : ViewBinding> : VectorBaseFragment<V
override fun onBackPressed(toolbarButton: Boolean): Boolean {
return when {
displayCancelDialog && viewModel.isRegistrationStarted -> {
displayCancelDialog && viewModel.isRegistrationStarted && backIsHardExit() -> {
// Ask for confirmation before cancelling the registration
MaterialAlertDialogBuilder(requireActivity())
.setTitle(R.string.login_signup_cancel_confirmation_title)