Move onBack method below onNext
This commit is contained in:
parent
92e949c299
commit
9d8e54683b
2 changed files with 30 additions and 31 deletions
|
@ -62,35 +62,6 @@ class AccountSetupViewModel(
|
|||
onNext()
|
||||
}
|
||||
|
||||
private fun onBack() {
|
||||
when (state.value.setupStep) {
|
||||
SetupStep.AUTO_CONFIG -> navigateBack()
|
||||
SetupStep.INCOMING_CONFIG -> changeToSetupStep(SetupStep.AUTO_CONFIG)
|
||||
SetupStep.INCOMING_VALIDATION -> {
|
||||
if (state.value.isAutomaticConfig) {
|
||||
changeToSetupStep(SetupStep.AUTO_CONFIG)
|
||||
} else {
|
||||
changeToSetupStep(SetupStep.INCOMING_CONFIG)
|
||||
}
|
||||
}
|
||||
|
||||
SetupStep.OUTGOING_CONFIG -> changeToSetupStep(SetupStep.INCOMING_CONFIG)
|
||||
SetupStep.OUTGOING_VALIDATION -> {
|
||||
if (state.value.isAutomaticConfig) {
|
||||
changeToSetupStep(SetupStep.AUTO_CONFIG)
|
||||
} else {
|
||||
changeToSetupStep(SetupStep.OUTGOING_CONFIG)
|
||||
}
|
||||
}
|
||||
|
||||
SetupStep.OPTIONS -> if (state.value.isAutomaticConfig) {
|
||||
changeToSetupStep(SetupStep.AUTO_CONFIG)
|
||||
} else {
|
||||
changeToSetupStep(SetupStep.OUTGOING_CONFIG)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun onNext() {
|
||||
when (state.value.setupStep) {
|
||||
SetupStep.AUTO_CONFIG -> {
|
||||
|
@ -129,6 +100,35 @@ class AccountSetupViewModel(
|
|||
}
|
||||
}
|
||||
|
||||
private fun onBack() {
|
||||
when (state.value.setupStep) {
|
||||
SetupStep.AUTO_CONFIG -> navigateBack()
|
||||
SetupStep.INCOMING_CONFIG -> changeToSetupStep(SetupStep.AUTO_CONFIG)
|
||||
SetupStep.INCOMING_VALIDATION -> {
|
||||
if (state.value.isAutomaticConfig) {
|
||||
changeToSetupStep(SetupStep.AUTO_CONFIG)
|
||||
} else {
|
||||
changeToSetupStep(SetupStep.INCOMING_CONFIG)
|
||||
}
|
||||
}
|
||||
|
||||
SetupStep.OUTGOING_CONFIG -> changeToSetupStep(SetupStep.INCOMING_CONFIG)
|
||||
SetupStep.OUTGOING_VALIDATION -> {
|
||||
if (state.value.isAutomaticConfig) {
|
||||
changeToSetupStep(SetupStep.AUTO_CONFIG)
|
||||
} else {
|
||||
changeToSetupStep(SetupStep.OUTGOING_CONFIG)
|
||||
}
|
||||
}
|
||||
|
||||
SetupStep.OPTIONS -> if (state.value.isAutomaticConfig) {
|
||||
changeToSetupStep(SetupStep.AUTO_CONFIG)
|
||||
} else {
|
||||
changeToSetupStep(SetupStep.OUTGOING_CONFIG)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun changeToSetupStep(setupStep: SetupStep) {
|
||||
if (setupStep == SetupStep.AUTO_CONFIG) {
|
||||
authStateStorage.updateAuthorizationState(authorizationState = null)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package app.k9mail.feature.account.setup.ui
|
||||
|
||||
import app.cash.turbine.testIn
|
||||
import app.k9mail.autodiscovery.api.AutoDiscoveryResult
|
||||
import app.k9mail.autodiscovery.api.ImapServerSettings
|
||||
import app.k9mail.autodiscovery.api.SmtpServerSettings
|
||||
|
@ -218,7 +217,7 @@ class AccountSetupViewModelTest {
|
|||
authStateStorage = authStateStorage,
|
||||
initialState = initialState,
|
||||
)
|
||||
val turbines = turbinesWithInitialStateCheck(viewModel, initialState,)
|
||||
val turbines = turbinesWithInitialStateCheck(viewModel, initialState)
|
||||
|
||||
viewModel.event(AccountSetupContract.Event.OnBack)
|
||||
|
||||
|
|
Loading…
Reference in a new issue