ensure the pid add/resend methods do not trigger the next registration steps

- keeps the previous behaviour
This commit is contained in:
Adam Brown 2022-03-02 17:27:54 +00:00
parent 3fa415007c
commit 434ee67982
2 changed files with 14 additions and 3 deletions

View File

@ -276,9 +276,14 @@ class OnboardingViewModel @AssistedInject constructor(
kotlin.runCatching { registrationActionHandler.handleRegisterAction(registrationWizard, action) }
.fold(
onSuccess = {
when (it) {
is RegistrationResult.Success -> onSessionCreated(it.session, isAccountCreated = true)
is RegistrationResult.FlowResponse -> onFlowResponse(it.flowResult)
when {
action.ignoresResult() -> {
// do nothing
}
else -> when (it) {
is RegistrationResult.Success -> onSessionCreated(it.session, isAccountCreated = true)
is RegistrationResult.FlowResponse -> onFlowResponse(it.flowResult)
}
}
},
onFailure = {

View File

@ -55,6 +55,12 @@ sealed interface RegisterAction {
object RegisterDummy : RegisterAction
}
fun RegisterAction.ignoresResult() = when (this) {
is RegisterAction.AddThreePid -> true
is RegisterAction.SendAgainThreePid -> true
else -> false
}
fun RegisterAction.hasLoadingState() = when (this) {
is RegisterAction.CheckIfEmailHasBeenValidated -> false
else -> true