adding back sign mode setting to fix crash when using legacy other flow

This commit is contained in:
Adam Brown 2022-04-14 12:37:46 +01:00
parent be22be53df
commit 55c981f18b

View File

@ -349,12 +349,7 @@ class OnboardingViewModel @AssistedInject constructor(
}
private fun handleUpdateSignMode(action: OnboardingAction.UpdateSignMode) {
setState {
copy(
signMode = action.signMode
)
}
updateSignMode(action.signMode)
when (action.signMode) {
SignMode.SignUp -> handleRegisterAction(RegisterAction.StartRegistration, ::emitFlowResultViewEvent)
SignMode.SignIn -> startAuthenticationFlow()
@ -363,6 +358,10 @@ class OnboardingViewModel @AssistedInject constructor(
}
}
private fun updateSignMode(signMode: SignMode) {
setState { copy(signMode = signMode) }
}
private fun handleUpdateUseCase(action: OnboardingAction.UpdateUseCase) {
setState { copy(useCase = action.useCase) }
when (vectorFeatures.isOnboardingCombinedRegisterEnabled()) {
@ -644,8 +643,14 @@ class OnboardingViewModel @AssistedInject constructor(
updateServerSelection(config, serverTypeOverride, authResult)
if (authResult.selectedHomeserver.preferredLoginMode.supportsSignModeScreen()) {
when (awaitState().onboardingFlow) {
OnboardingFlow.SignIn -> internalRegisterAction(RegisterAction.StartRegistration, ::emitFlowResultViewEvent)
OnboardingFlow.SignUp -> internalRegisterAction(RegisterAction.StartRegistration, ::emitFlowResultViewEvent)
OnboardingFlow.SignIn -> {
updateSignMode(SignMode.SignIn)
internalRegisterAction(RegisterAction.StartRegistration, ::emitFlowResultViewEvent)
}
OnboardingFlow.SignUp -> {
updateSignMode(SignMode.SignUp)
internalRegisterAction(RegisterAction.StartRegistration, ::emitFlowResultViewEvent)
}
OnboardingFlow.SignInSignUp,
null -> {
_viewEvents.post(OnboardingViewEvents.OnLoginFlowRetrieved)