Change account validation bottom next button visibility to isSuccess state and wire it up
This commit is contained in:
parent
9046a4c8fc
commit
5e94369775
5 changed files with 12 additions and 21 deletions
|
@ -14,7 +14,6 @@ import androidx.compose.ui.platform.LocalContext
|
|||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import app.k9mail.core.ui.compose.common.DevicePreviews
|
||||
import app.k9mail.core.ui.compose.designsystem.atom.text.TextSubtitle1
|
||||
import app.k9mail.core.ui.compose.designsystem.template.ResponsiveWidthContainer
|
||||
import app.k9mail.core.ui.compose.theme.K9Theme
|
||||
import app.k9mail.core.ui.compose.theme.MainTheme
|
||||
|
@ -54,13 +53,7 @@ internal fun AccountValidationContent(
|
|||
Arrangement.spacedBy(MainTheme.spacings.default)
|
||||
},
|
||||
) {
|
||||
if (state.isLoading) {
|
||||
item(key = "loading") {
|
||||
LoadingItem(
|
||||
message = stringResource(id = R.string.account_setup_settings_validation_loading_message),
|
||||
)
|
||||
}
|
||||
} else if (state.error != null) {
|
||||
if (state.error != null) {
|
||||
item(key = "error") {
|
||||
// TODO add raw error message
|
||||
ErrorItem(
|
||||
|
@ -76,8 +69,10 @@ internal fun AccountValidationContent(
|
|||
)
|
||||
}
|
||||
} else {
|
||||
item {
|
||||
TextSubtitle1(text = "Should not happen")
|
||||
item(key = "loading") {
|
||||
LoadingItem(
|
||||
message = stringResource(id = R.string.account_setup_settings_validation_loading_message),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package app.k9mail.feature.account.setup.ui.validation
|
||||
|
||||
import app.k9mail.core.ui.compose.common.mvi.UnidirectionalViewModel
|
||||
import app.k9mail.feature.account.common.ui.WizardNavigationBarState
|
||||
import app.k9mail.feature.account.oauth.domain.entity.AuthorizationState
|
||||
import com.fsck.k9.mail.ServerSettings
|
||||
import java.io.IOException
|
||||
|
@ -16,9 +15,6 @@ interface AccountValidationContract {
|
|||
data class State(
|
||||
val serverSettings: ServerSettings? = null,
|
||||
val authorizationState: AuthorizationState? = null,
|
||||
val wizardNavigationBarState: WizardNavigationBarState = WizardNavigationBarState(
|
||||
showNext = false,
|
||||
),
|
||||
val isSuccess: Boolean = false,
|
||||
val error: Error? = null,
|
||||
val isLoading: Boolean = false,
|
||||
|
|
|
@ -12,6 +12,7 @@ import app.k9mail.core.ui.compose.theme.K9Theme
|
|||
import app.k9mail.core.ui.compose.theme.ThunderbirdTheme
|
||||
import app.k9mail.feature.account.common.ui.AppTitleTopHeader
|
||||
import app.k9mail.feature.account.common.ui.WizardNavigationBar
|
||||
import app.k9mail.feature.account.common.ui.WizardNavigationBarState
|
||||
import app.k9mail.feature.account.setup.R
|
||||
import app.k9mail.feature.account.setup.ui.validation.AccountValidationContract.Effect
|
||||
import app.k9mail.feature.account.setup.ui.validation.AccountValidationContract.Event
|
||||
|
@ -48,8 +49,11 @@ internal fun AccountValidationScreen(
|
|||
WizardNavigationBar(
|
||||
nextButtonText = stringResource(id = R.string.account_setup_button_next),
|
||||
backButtonText = stringResource(id = R.string.account_setup_button_back),
|
||||
onNextClick = { },
|
||||
onNextClick = { dispatch(Event.OnNextClicked) },
|
||||
onBackClick = { dispatch(Event.OnBackClicked) },
|
||||
state = WizardNavigationBarState(
|
||||
showNext = state.value.isSuccess,
|
||||
),
|
||||
)
|
||||
},
|
||||
modifier = modifier,
|
||||
|
|
|
@ -12,7 +12,7 @@ import com.fsck.k9.mail.server.ServerSettingsValidationResult
|
|||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
private const val CONTINUE_NEXT_DELAY = 1000L
|
||||
private const val CONTINUE_NEXT_DELAY = 2000L
|
||||
|
||||
internal class AccountValidationViewModel(
|
||||
initialState: State = State(),
|
||||
|
@ -32,7 +32,7 @@ internal class AccountValidationViewModel(
|
|||
override fun event(event: Event) {
|
||||
when (event) {
|
||||
Event.ValidateServerSettings -> onValidateConfig()
|
||||
Event.OnNextClicked -> TODO()
|
||||
Event.OnNextClicked -> navigateNext()
|
||||
Event.OnBackClicked -> onBack()
|
||||
Event.OnRetryClicked -> onRetry()
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package app.k9mail.feature.account.setup.ui.validation
|
||||
|
||||
import app.k9mail.feature.account.common.ui.WizardNavigationBarState
|
||||
import app.k9mail.feature.account.setup.ui.validation.AccountValidationContract.State
|
||||
import assertk.assertThat
|
||||
import assertk.assertions.isEqualTo
|
||||
|
@ -16,9 +15,6 @@ class AccountValidationStateTest {
|
|||
State(
|
||||
serverSettings = null,
|
||||
authorizationState = null,
|
||||
wizardNavigationBarState = WizardNavigationBarState(
|
||||
showNext = false,
|
||||
),
|
||||
isSuccess = false,
|
||||
error = null,
|
||||
isLoading = false,
|
||||
|
|
Loading…
Reference in a new issue