replacing comment extracted function (also convered by a test case)
This commit is contained in:
parent
ba18c6f3e2
commit
ef1356f4dd
@ -54,14 +54,16 @@ class RegistrationActionHandler @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun processFlowResult(result: RegistrationResult.NextStep, state: SelectedHomeserverState): Result {
|
private suspend fun processFlowResult(result: RegistrationResult.NextStep, state: SelectedHomeserverState): Result {
|
||||||
// If dummy stage is mandatory, and password is already sent, do the dummy stage now
|
return if (shouldFastTrackDummyAction(result)) {
|
||||||
return if (authenticationService.isRegistrationStarted() && result.flowResult.missingStages.hasMandatoryDummy()) {
|
|
||||||
processAction(state, RegisterAction.RegisterDummy)
|
processAction(state, RegisterAction.RegisterDummy)
|
||||||
} else {
|
} else {
|
||||||
handleNextStep(state, result.flowResult)
|
handleNextStep(state, result.flowResult)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun shouldFastTrackDummyAction(result: RegistrationResult.NextStep) = authenticationService.isRegistrationStarted() &&
|
||||||
|
result.flowResult.missingStages.hasMandatoryDummy()
|
||||||
|
|
||||||
private suspend fun handleNextStep(state: SelectedHomeserverState, flowResult: FlowResult): Result {
|
private suspend fun handleNextStep(state: SelectedHomeserverState, flowResult: FlowResult): Result {
|
||||||
return when {
|
return when {
|
||||||
flowResult.registrationShouldFallback() -> Result.UnsupportedStage
|
flowResult.registrationShouldFallback() -> Result.UnsupportedStage
|
||||||
|
Loading…
Reference in New Issue
Block a user