only reverting to the combined sign in/sign up screen when the currently login mode isn't supported

- eg for a SSO only flow or unknown/unsupported
This commit is contained in:
Adam Brown 2022-01-18 11:46:49 +00:00
parent 49761382c6
commit 69c05e63d4

View file

@ -852,7 +852,7 @@ class OnboardingViewModel @AssistedInject constructor(
}
withState {
if (it.serverType == ServerType.MatrixOrg) {
if (loginMode.supportsSignModeScreen()) {
when (it.onboardingFlow) {
OnboardingFlow.SignIn -> handleUpdateSignMode(OnboardingAction.UpdateSignMode(SignMode.SignIn))
OnboardingFlow.SignUp -> handleUpdateSignMode(OnboardingAction.UpdateSignMode(SignMode.SignUp))
@ -880,3 +880,13 @@ class OnboardingViewModel @AssistedInject constructor(
return authenticationService.getFallbackUrl(forSignIn, deviceId)
}
}
private fun LoginMode.supportsSignModeScreen(): Boolean {
return when (this) {
LoginMode.Password,
is LoginMode.SsoAndPassword -> true
is LoginMode.Sso,
LoginMode.Unknown,
LoginMode.Unsupported -> false
}
}