Change CONTINUE_NEXT_DELAY to 500ms and move it to WizardConstants

This commit is contained in:
Wolf-Martell Montwé 2024-01-30 11:58:17 +01:00
parent d60d24878f
commit 61c9794c8d
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72
5 changed files with 13 additions and 12 deletions

View file

@ -0,0 +1,5 @@
package app.k9mail.feature.account.common.ui
object WizardConstants {
const val CONTINUE_NEXT_DELAY = 500L
}

View file

@ -2,6 +2,7 @@ package app.k9mail.feature.account.edit.ui.server.settings.save
import androidx.lifecycle.viewModelScope
import app.k9mail.core.ui.compose.common.mvi.BaseViewModel
import app.k9mail.feature.account.common.ui.WizardConstants
import app.k9mail.feature.account.edit.domain.AccountEditDomainContract
import app.k9mail.feature.account.edit.ui.server.settings.save.SaveServerSettingsContract.Effect
import app.k9mail.feature.account.edit.ui.server.settings.save.SaveServerSettingsContract.Event
@ -12,8 +13,6 @@ import kotlinx.coroutines.cancelChildren
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
private const val CONTINUE_NEXT_DELAY = 1500L
abstract class BaseSaveServerSettingsViewModel(
val accountUuid: String,
override val isIncoming: Boolean,
@ -50,7 +49,7 @@ abstract class BaseSaveServerSettingsViewModel(
}
viewModelScope.launch {
delay(CONTINUE_NEXT_DELAY)
delay(WizardConstants.CONTINUE_NEXT_DELAY)
navigateNext()
}
}

View file

@ -3,6 +3,7 @@ package app.k9mail.feature.account.server.validation.ui
import androidx.lifecycle.viewModelScope
import app.k9mail.core.ui.compose.common.mvi.BaseViewModel
import app.k9mail.feature.account.common.domain.AccountDomainContract
import app.k9mail.feature.account.common.ui.WizardConstants
import app.k9mail.feature.account.oauth.domain.AccountOAuthDomainContract
import app.k9mail.feature.account.oauth.domain.entity.OAuthResult
import app.k9mail.feature.account.oauth.domain.entity.isOAuth
@ -19,8 +20,6 @@ import kotlinx.coroutines.cancelChildren
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
private const val CONTINUE_NEXT_DELAY = 200L
@Suppress("TooManyFunctions")
abstract class BaseServerValidationViewModel(
private val accountStateRepository: AccountDomainContract.AccountStateRepository,
@ -172,7 +171,7 @@ abstract class BaseServerValidationViewModel(
}
viewModelScope.launch {
delay(CONTINUE_NEXT_DELAY)
delay(WizardConstants.CONTINUE_NEXT_DELAY)
navigateNext()
}
}

View file

@ -3,6 +3,7 @@ package app.k9mail.feature.account.setup.ui.createaccount
import androidx.lifecycle.viewModelScope
import app.k9mail.core.ui.compose.common.mvi.BaseViewModel
import app.k9mail.feature.account.common.domain.AccountDomainContract.AccountStateRepository
import app.k9mail.feature.account.common.ui.WizardConstants
import app.k9mail.feature.account.setup.AccountSetupExternalContract.AccountCreator.AccountCreatorResult
import app.k9mail.feature.account.setup.domain.DomainContract.UseCase.CreateAccount
import app.k9mail.feature.account.setup.domain.entity.AccountUuid
@ -13,8 +14,6 @@ import kotlinx.coroutines.cancelChildren
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
private const val CONTINUE_NEXT_DELAY = 2000L
class CreateAccountViewModel(
private val createAccount: CreateAccount,
private val accountStateRepository: AccountStateRepository,
@ -49,7 +48,7 @@ class CreateAccountViewModel(
}
viewModelScope.launch {
delay(CONTINUE_NEXT_DELAY)
delay(WizardConstants.CONTINUE_NEXT_DELAY)
navigateNext(accountUuid)
}
}

View file

@ -6,6 +6,7 @@ import app.k9mail.core.ui.compose.common.mvi.BaseViewModel
import app.k9mail.feature.account.common.domain.AccountDomainContract
import app.k9mail.feature.account.common.domain.entity.SpecialFolderOptions
import app.k9mail.feature.account.common.domain.entity.SpecialFolderSettings
import app.k9mail.feature.account.common.ui.WizardConstants
import app.k9mail.feature.account.setup.domain.DomainContract.UseCase
import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.Effect
import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.Event
@ -18,8 +19,6 @@ import kotlinx.coroutines.cancelChildren
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
private const val CONTINUE_NEXT_DELAY = 1500L
class SpecialFoldersViewModel(
private val formUiModel: SpecialFoldersContract.FormUiModel,
private val getSpecialFolderOptions: UseCase.GetSpecialFolderOptions,
@ -80,7 +79,7 @@ class SpecialFoldersViewModel(
saveSpecialFolderSettings()
delay(CONTINUE_NEXT_DELAY)
delay(WizardConstants.CONTINUE_NEXT_DELAY)
navigateNext()
}
}