mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-25 19:05:56 +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 OnResetPasswordBreakerConfirmed : OnboardingViewEvents()
|
||||||
object OnResetPasswordComplete : 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 OnSendMsisdnSuccess(val msisdn: String) : OnboardingViewEvents()
|
||||||
|
|
||||||
data class OnWebLoginError(val errorCode: Int, val description: String, val failingUrl: 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)
|
overrideNextStage?.invoke() ?: _viewEvents.post(OnboardingViewEvents.DisplayStartRegistration)
|
||||||
}
|
}
|
||||||
RegistrationActionHandler.Result.UnsupportedStage -> _viewEvents.post(OnboardingViewEvents.DisplayRegistrationFallback)
|
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.SendMsisdnSuccess -> _viewEvents.post(OnboardingViewEvents.OnSendMsisdnSuccess(it.msisdn.msisdn))
|
||||||
is RegistrationActionHandler.Result.Error -> _viewEvents.post(OnboardingViewEvents.Failure(it.cause))
|
is RegistrationActionHandler.Result.Error -> _viewEvents.post(OnboardingViewEvents.Failure(it.cause))
|
||||||
RegistrationActionHandler.Result.MissingNextStage -> {
|
RegistrationActionHandler.Result.MissingNextStage -> {
|
||||||
|
@ -486,7 +488,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
||||||
try {
|
try {
|
||||||
if (registrationWizard.isRegistrationStarted()) {
|
if (registrationWizard.isRegistrationStarted()) {
|
||||||
currentThreePid?.let {
|
currentThreePid?.let {
|
||||||
handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnSendEmailSuccess(it)))
|
handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnSendEmailSuccess(it, isRestoredSession = true)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
|
|
|
@ -196,7 +196,7 @@ class FtueAuthVariant(
|
||||||
activity.popBackstack()
|
activity.popBackstack()
|
||||||
}
|
}
|
||||||
is OnboardingViewEvents.OnSendEmailSuccess -> {
|
is OnboardingViewEvents.OnSendEmailSuccess -> {
|
||||||
openWaitForEmailVerification(viewEvents.email)
|
openWaitForEmailVerification(viewEvents.email, viewEvents.isRestoredSession)
|
||||||
}
|
}
|
||||||
is OnboardingViewEvents.OnSendMsisdnSuccess -> {
|
is OnboardingViewEvents.OnSendMsisdnSuccess -> {
|
||||||
openMsisdnConfirmation(viewEvents.msisdn)
|
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)
|
supportFragmentManager.popBackStack(FRAGMENT_REGISTRATION_STAGE_TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||||
when {
|
when {
|
||||||
vectorFeatures.isOnboardingCombinedRegisterEnabled() -> addRegistrationStageFragmentToBackstack(
|
vectorFeatures.isOnboardingCombinedRegisterEnabled() -> addRegistrationStageFragmentToBackstack(
|
||||||
FtueAuthWaitForEmailFragment::class.java,
|
FtueAuthWaitForEmailFragment::class.java,
|
||||||
FtueAuthWaitForEmailFragmentArgument(email),
|
FtueAuthWaitForEmailFragmentArgument(email, isRestoredSession),
|
||||||
)
|
)
|
||||||
else -> addRegistrationStageFragmentToBackstack(
|
else -> addRegistrationStageFragmentToBackstack(
|
||||||
FtueAuthLegacyWaitForEmailFragment::class.java,
|
FtueAuthLegacyWaitForEmailFragment::class.java,
|
||||||
FtueAuthWaitForEmailFragmentArgument(email),
|
FtueAuthWaitForEmailFragmentArgument(email, isRestoredSession),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,8 @@ import javax.inject.Inject
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data class FtueAuthWaitForEmailFragmentArgument(
|
data class FtueAuthWaitForEmailFragmentArgument(
|
||||||
val email: String
|
val email: String,
|
||||||
|
val isRestoredSession: Boolean,
|
||||||
) : Parcelable
|
) : Parcelable
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue