From 47635aae6e134f3acc4d78cd6d97a12098020f6e Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Thu, 12 May 2022 16:44:26 +0100 Subject: [PATCH] avoiding cancelling the polling job when resending verification email --- .../app/features/onboarding/OnboardingViewModel.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt b/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt index ccd7eebe87..a6c16415d0 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt @@ -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) {