mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-25 10:55:55 +03:00
including knowledge of if the session was restored when fastforwarding to the waiting for email
This commit is contained in:
parent
e9bd271642
commit
abab2a0db7
4 changed files with 13 additions and 10 deletions
|
@ -53,7 +53,7 @@ sealed class OnboardingViewEvents : VectorViewEvents {
|
|||
object OnResetPasswordBreakerConfirmed : OnboardingViewEvents()
|
||||
object OnResetPasswordComplete : OnboardingViewEvents()
|
||||
|
||||
data class OnSendEmailSuccess(val email: String) : OnboardingViewEvents()
|
||||
data class OnSendEmailSuccess(val email: String, val isRestoredSession: Boolean) : OnboardingViewEvents()
|
||||
data class OnSendMsisdnSuccess(val msisdn: String) : OnboardingViewEvents()
|
||||
|
||||
data class OnWebLoginError(val errorCode: Int, val description: String, val failingUrl: String) : OnboardingViewEvents()
|
||||
|
|
|
@ -348,7 +348,9 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
overrideNextStage?.invoke() ?: _viewEvents.post(OnboardingViewEvents.DisplayStartRegistration)
|
||||
}
|
||||
RegistrationActionHandler.Result.UnsupportedStage -> _viewEvents.post(OnboardingViewEvents.DisplayRegistrationFallback)
|
||||
is RegistrationActionHandler.Result.SendEmailSuccess -> _viewEvents.post(OnboardingViewEvents.OnSendEmailSuccess(it.email))
|
||||
is RegistrationActionHandler.Result.SendEmailSuccess -> _viewEvents.post(
|
||||
OnboardingViewEvents.OnSendEmailSuccess(it.email, isRestoredSession = false)
|
||||
)
|
||||
is RegistrationActionHandler.Result.SendMsisdnSuccess -> _viewEvents.post(OnboardingViewEvents.OnSendMsisdnSuccess(it.msisdn.msisdn))
|
||||
is RegistrationActionHandler.Result.Error -> _viewEvents.post(OnboardingViewEvents.Failure(it.cause))
|
||||
RegistrationActionHandler.Result.MissingNextStage -> {
|
||||
|
@ -412,8 +414,8 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
authenticationService.cancelPendingLoginOrRegistration()
|
||||
setState {
|
||||
copy(
|
||||
isLoading = false,
|
||||
registrationState = RegistrationState(),
|
||||
isLoading = false,
|
||||
registrationState = RegistrationState(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -486,7 +488,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
try {
|
||||
if (registrationWizard.isRegistrationStarted()) {
|
||||
currentThreePid?.let {
|
||||
handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnSendEmailSuccess(it)))
|
||||
handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnSendEmailSuccess(it, isRestoredSession = true)))
|
||||
}
|
||||
}
|
||||
} catch (e: Throwable) {
|
||||
|
|
|
@ -196,7 +196,7 @@ class FtueAuthVariant(
|
|||
activity.popBackstack()
|
||||
}
|
||||
is OnboardingViewEvents.OnSendEmailSuccess -> {
|
||||
openWaitForEmailVerification(viewEvents.email)
|
||||
openWaitForEmailVerification(viewEvents.email, viewEvents.isRestoredSession)
|
||||
}
|
||||
is OnboardingViewEvents.OnSendMsisdnSuccess -> {
|
||||
openMsisdnConfirmation(viewEvents.msisdn)
|
||||
|
@ -413,16 +413,16 @@ class FtueAuthVariant(
|
|||
}
|
||||
}
|
||||
|
||||
private fun openWaitForEmailVerification(email: String) {
|
||||
private fun openWaitForEmailVerification(email: String, isRestoredSession: Boolean) {
|
||||
supportFragmentManager.popBackStack(FRAGMENT_REGISTRATION_STAGE_TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
when {
|
||||
vectorFeatures.isOnboardingCombinedRegisterEnabled() -> addRegistrationStageFragmentToBackstack(
|
||||
FtueAuthWaitForEmailFragment::class.java,
|
||||
FtueAuthWaitForEmailFragmentArgument(email),
|
||||
FtueAuthWaitForEmailFragmentArgument(email, isRestoredSession),
|
||||
)
|
||||
else -> addRegistrationStageFragmentToBackstack(
|
||||
FtueAuthLegacyWaitForEmailFragment::class.java,
|
||||
FtueAuthWaitForEmailFragmentArgument(email),
|
||||
FtueAuthWaitForEmailFragmentArgument(email, isRestoredSession),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@ import javax.inject.Inject
|
|||
|
||||
@Parcelize
|
||||
data class FtueAuthWaitForEmailFragmentArgument(
|
||||
val email: String
|
||||
val email: String,
|
||||
val isRestoredSession: Boolean,
|
||||
) : Parcelable
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue