Don't delay when user clicks 'Next' in special folders screen

This commit is contained in:
cketti 2023-12-19 21:30:41 +01:00
parent 6fb4bfae00
commit 674932695f
2 changed files with 8 additions and 10 deletions

View file

@ -77,7 +77,11 @@ class SpecialFoldersViewModel(
isSuccess = true, isSuccess = true,
) )
} }
saveSpecialFolderSettings() saveSpecialFolderSettings()
delay(CONTINUE_NEXT_DELAY)
navigateNext()
} }
} }
} }
@ -99,7 +103,7 @@ class SpecialFoldersViewModel(
} }
} }
private suspend fun saveSpecialFolderSettings() { private fun saveSpecialFolderSettings() {
val formState = state.value.formState val formState = state.value.formState
accountStateRepository.setSpecialFolderSettings( accountStateRepository.setSpecialFolderSettings(
@ -116,15 +120,11 @@ class SpecialFoldersViewModel(
isLoading = false, isLoading = false,
) )
} }
delay(CONTINUE_NEXT_DELAY)
navigateNext()
} }
private fun onNextClicked() { private fun onNextClicked() {
viewModelScope.launch { saveSpecialFolderSettings()
saveSpecialFolderSettings() navigateNext()
}
} }
private fun navigateNext() { private fun navigateNext() {

View file

@ -197,9 +197,7 @@ class SpecialFoldersViewModelTest {
testSubject.event(Event.OnNextClicked) testSubject.event(Event.OnNextClicked)
turbines.assertThatAndStateTurbineConsumed { assertThat(turbines.awaitStateItem()).isEqualTo(initialState.copy(isLoading = false))
isEqualTo(initialState.copy(isLoading = false))
}
turbines.assertThatAndEffectTurbineConsumed { turbines.assertThatAndEffectTurbineConsumed {
isEqualTo(Effect.NavigateNext) isEqualTo(Effect.NavigateNext)