mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 17:35:54 +03:00
allowing the child ftue fragments to determine if they're the back action is a hard exit
This commit is contained in:
parent
abab2a0db7
commit
c66b1885ad
1 changed files with 2 additions and 1 deletions
|
@ -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
|
// Due to async, we keep a boolean to avoid displaying twice the cancellation dialog
|
||||||
private var displayCancelDialog = true
|
private var displayCancelDialog = true
|
||||||
|
protected open fun backIsHardExit() = true
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
@ -115,7 +116,7 @@ abstract class AbstractFtueAuthFragment<VB : ViewBinding> : VectorBaseFragment<V
|
||||||
|
|
||||||
override fun onBackPressed(toolbarButton: Boolean): Boolean {
|
override fun onBackPressed(toolbarButton: Boolean): Boolean {
|
||||||
return when {
|
return when {
|
||||||
displayCancelDialog && viewModel.isRegistrationStarted -> {
|
displayCancelDialog && viewModel.isRegistrationStarted && backIsHardExit() -> {
|
||||||
// Ask for confirmation before cancelling the registration
|
// Ask for confirmation before cancelling the registration
|
||||||
MaterialAlertDialogBuilder(requireActivity())
|
MaterialAlertDialogBuilder(requireActivity())
|
||||||
.setTitle(R.string.login_signup_cancel_confirmation_title)
|
.setTitle(R.string.login_signup_cancel_confirmation_title)
|
||||||
|
|
Loading…
Reference in a new issue