mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
only setting selected homeserver state after a successful start registration when editing
This commit is contained in:
parent
86b87e12d7
commit
197df34097
1 changed files with 17 additions and 8 deletions
|
@ -628,24 +628,33 @@ class OnboardingViewModel @AssistedInject constructor(
|
||||||
_viewEvents.post(OnboardingViewEvents.OutdatedHomeserver)
|
_viewEvents.post(OnboardingViewEvents.OutdatedHomeserver)
|
||||||
}
|
}
|
||||||
|
|
||||||
setState {
|
|
||||||
copy(
|
|
||||||
serverType = alignServerTypeAfterSubmission(config, serverTypeOverride),
|
|
||||||
selectedHomeserver = authResult.selectedHomeserver,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
val state = awaitState()
|
val state = awaitState()
|
||||||
|
|
||||||
when (lastAction) {
|
when (lastAction) {
|
||||||
is OnboardingAction.HomeServerChange.EditHomeServer -> {
|
is OnboardingAction.HomeServerChange.EditHomeServer -> {
|
||||||
when (state.onboardingFlow) {
|
when (state.onboardingFlow) {
|
||||||
OnboardingFlow.SignUp -> handleRegisterAction(RegisterAction.StartRegistration) { _ ->
|
OnboardingFlow.SignUp -> internalRegisterAction(RegisterAction.StartRegistration) { _ ->
|
||||||
|
setState {
|
||||||
|
copy(
|
||||||
|
serverType = alignServerTypeAfterSubmission(config, serverTypeOverride),
|
||||||
|
selectedHomeserver = authResult.selectedHomeserver,
|
||||||
|
)
|
||||||
|
}
|
||||||
_viewEvents.post(OnboardingViewEvents.OnHomeserverEdited)
|
_viewEvents.post(OnboardingViewEvents.OnHomeserverEdited)
|
||||||
}
|
}
|
||||||
else -> throw IllegalArgumentException("developer error")
|
else -> throw IllegalArgumentException("developer error")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is OnboardingAction.HomeServerChange.SelectHomeServer -> {
|
is OnboardingAction.HomeServerChange.SelectHomeServer -> {
|
||||||
if (state.selectedHomeserver.preferredLoginMode.supportsSignModeScreen()) {
|
setState {
|
||||||
|
copy(
|
||||||
|
serverType = alignServerTypeAfterSubmission(config, serverTypeOverride),
|
||||||
|
selectedHomeserver = authResult.selectedHomeserver,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (authResult.selectedHomeserver.preferredLoginMode.supportsSignModeScreen()) {
|
||||||
when (state.onboardingFlow) {
|
when (state.onboardingFlow) {
|
||||||
OnboardingFlow.SignIn -> internalRegisterAction(RegisterAction.StartRegistration, ::emitFlowResultViewEvent)
|
OnboardingFlow.SignIn -> internalRegisterAction(RegisterAction.StartRegistration, ::emitFlowResultViewEvent)
|
||||||
OnboardingFlow.SignUp -> internalRegisterAction(RegisterAction.StartRegistration, ::emitFlowResultViewEvent)
|
OnboardingFlow.SignUp -> internalRegisterAction(RegisterAction.StartRegistration, ::emitFlowResultViewEvent)
|
||||||
|
|
Loading…
Reference in a new issue