diff --git a/feature/account/edit/src/main/kotlin/app/k9mail/feature/account/edit/ui/server/settings/save/BaseSaveServerSettingsViewModel.kt b/feature/account/edit/src/main/kotlin/app/k9mail/feature/account/edit/ui/server/settings/save/BaseSaveServerSettingsViewModel.kt index e67e7c465..c65b892d8 100644 --- a/feature/account/edit/src/main/kotlin/app/k9mail/feature/account/edit/ui/server/settings/save/BaseSaveServerSettingsViewModel.kt +++ b/feature/account/edit/src/main/kotlin/app/k9mail/feature/account/edit/ui/server/settings/save/BaseSaveServerSettingsViewModel.kt @@ -24,7 +24,6 @@ abstract class BaseSaveServerSettingsViewModel( override fun event(event: Event) { when (event) { Event.SaveServerSettings -> handleOneTimeEvent(event, ::onSaveServerSettings) - Event.OnNextClicked -> navigateNext() Event.OnBackClicked -> navigateBack() } } @@ -64,8 +63,6 @@ abstract class BaseSaveServerSettingsViewModel( } private fun navigateNext() { - if (state.value.isLoading || state.value.error != null) return - viewModelScope.coroutineContext.cancelChildren() emitEffect(Effect.NavigateNext) } diff --git a/feature/account/edit/src/main/kotlin/app/k9mail/feature/account/edit/ui/server/settings/save/SaveServerSettingsContract.kt b/feature/account/edit/src/main/kotlin/app/k9mail/feature/account/edit/ui/server/settings/save/SaveServerSettingsContract.kt index b1d19c6a9..17bf575b9 100644 --- a/feature/account/edit/src/main/kotlin/app/k9mail/feature/account/edit/ui/server/settings/save/SaveServerSettingsContract.kt +++ b/feature/account/edit/src/main/kotlin/app/k9mail/feature/account/edit/ui/server/settings/save/SaveServerSettingsContract.kt @@ -16,7 +16,6 @@ interface SaveServerSettingsContract { sealed interface Event { data object SaveServerSettings : Event - data object OnNextClicked : Event data object OnBackClicked : Event } diff --git a/feature/account/edit/src/main/kotlin/app/k9mail/feature/account/edit/ui/server/settings/save/SaveServerSettingsScreen.kt b/feature/account/edit/src/main/kotlin/app/k9mail/feature/account/edit/ui/server/settings/save/SaveServerSettingsScreen.kt index db5ef3055..e64ea4670 100644 --- a/feature/account/edit/src/main/kotlin/app/k9mail/feature/account/edit/ui/server/settings/save/SaveServerSettingsScreen.kt +++ b/feature/account/edit/src/main/kotlin/app/k9mail/feature/account/edit/ui/server/settings/save/SaveServerSettingsScreen.kt @@ -51,14 +51,12 @@ fun SaveServerSettingsScreen( }, bottomBar = { WizardNavigationBar( - onNextClick = { - dispatch(Event.OnNextClicked) - }, + onNextClick = {}, onBackClick = { dispatch(Event.OnBackClicked) }, state = WizardNavigationBarState( - isNextEnabled = state.value.error == null && !state.value.isLoading, + showNext = false, isBackEnabled = state.value.error != null, ), ) diff --git a/feature/account/edit/src/test/kotlin/app/k9mail/feature/account/edit/ui/server/settings/save/BaseSaveServerSettingsViewModelTest.kt b/feature/account/edit/src/test/kotlin/app/k9mail/feature/account/edit/ui/server/settings/save/BaseSaveServerSettingsViewModelTest.kt index 85bde1bbf..f98b5dc6d 100644 --- a/feature/account/edit/src/test/kotlin/app/k9mail/feature/account/edit/ui/server/settings/save/BaseSaveServerSettingsViewModelTest.kt +++ b/feature/account/edit/src/test/kotlin/app/k9mail/feature/account/edit/ui/server/settings/save/BaseSaveServerSettingsViewModelTest.kt @@ -70,48 +70,6 @@ class BaseSaveServerSettingsViewModelTest { } } - @Test - fun `should prevent navigation effects when in loading state`() = runTest { - val testSubject = TestSaveServerSettingsViewModel( - accountUuid = ACCOUNT_UUID, - saveServerSettings = { _, _ -> - // Do nothing - }, - initialState = State(isLoading = true), - ) - val turbines = turbinesWithInitialStateCheck(testSubject, State(isLoading = true)) - - testSubject.event(Event.OnNextClicked) - - turbines.effectTurbine.ensureAllEventsConsumed() - - testSubject.event(Event.OnBackClicked) - - turbines.effectTurbine.ensureAllEventsConsumed() - } - - @Test - fun `should allow NavigateNext when no error and not loading`() = runTest { - val testSubject = TestSaveServerSettingsViewModel( - accountUuid = ACCOUNT_UUID, - saveServerSettings = { _, _ -> - // Do nothing - }, - initialState = State(isLoading = false), - ) - val turbines = turbinesWithInitialStateCheck(testSubject, State(isLoading = false)) - - testSubject.event(Event.OnNextClicked) - - turbines.assertThatAndEffectTurbineConsumed { - isEqualTo(Effect.NavigateNext) - } - - testSubject.event(Event.OnBackClicked) - - turbines.effectTurbine.ensureAllEventsConsumed() - } - @Test fun `should allow NavigateBack when error and not loading`() = runTest { val failure = Failure.SaveServerSettingsFailed("Test exception") @@ -127,10 +85,6 @@ class BaseSaveServerSettingsViewModelTest { ) val turbines = turbinesWithInitialStateCheck(testSubject, State(isLoading = false, error = failure)) - testSubject.event(Event.OnNextClicked) - - turbines.effectTurbine.ensureAllEventsConsumed() - testSubject.event(Event.OnBackClicked) turbines.assertThatAndEffectTurbineConsumed {