replacing comment extracted function (also convered by a test case)

This commit is contained in:
Adam Brown 2022-05-18 13:59:36 +01:00
parent ba18c6f3e2
commit ef1356f4dd

View File

@ -54,14 +54,16 @@ class RegistrationActionHandler @Inject constructor(
}
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 (authenticationService.isRegistrationStarted() && result.flowResult.missingStages.hasMandatoryDummy()) {
return if (shouldFastTrackDummyAction(result)) {
processAction(state, RegisterAction.RegisterDummy)
} else {
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 {
return when {
flowResult.registrationShouldFallback() -> Result.UnsupportedStage