avoiding cancelling the polling job when resending verification email

This commit is contained in:
Adam Brown 2022-05-12 16:44:26 +01:00
parent bc5ebb20b5
commit 47635aae6e

View file

@ -256,13 +256,22 @@ class OnboardingViewModel @AssistedInject constructor(
}
private fun handleRegisterAction(action: RegisterAction, onNextRegistrationStepAction: (FlowResult) -> Unit) {
currentJob = viewModelScope.launch {
val job = viewModelScope.launch {
if (action.hasLoadingState()) {
setState { copy(isLoading = true) }
}
internalRegisterAction(action, onNextRegistrationStepAction)
setState { copy(isLoading = false) }
}
when (action) {
is RegisterAction.SendAgainThreePid -> {
// avoid cancelling the current job which is polling for verification complete
}
else -> {
currentJob = job
}
}
}
private suspend fun internalRegisterAction(action: RegisterAction, onNextRegistrationStepAction: (FlowResult) -> Unit) {