From 6de38fcc9e62eb31101f022546cc50c7ea20641c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolf-Martell=20Montw=C3=A9?= Date: Wed, 24 Apr 2024 17:29:41 +0200 Subject: [PATCH] Change account setup options sync feature to theme 2 --- .../preview/PreviewAccountStateRepository.kt | 57 ------------------- .../options/sync/SyncOptionsContentPreview.kt | 18 ++++++ .../options/sync/SyncOptionsScreenPreview.kt | 20 +++++++ .../ui/options/sync/SyncOptionsContent.kt | 31 +--------- .../ui/options/sync/SyncOptionsScreen.kt | 32 ----------- 5 files changed, 39 insertions(+), 119 deletions(-) delete mode 100644 feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/ui/preview/PreviewAccountStateRepository.kt create mode 100644 feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/options/sync/SyncOptionsContentPreview.kt create mode 100644 feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/options/sync/SyncOptionsScreenPreview.kt diff --git a/feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/ui/preview/PreviewAccountStateRepository.kt b/feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/ui/preview/PreviewAccountStateRepository.kt deleted file mode 100644 index bcb1dae05..000000000 --- a/feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/ui/preview/PreviewAccountStateRepository.kt +++ /dev/null @@ -1,57 +0,0 @@ -package app.k9mail.feature.account.common.ui.preview - -import app.k9mail.feature.account.common.domain.AccountDomainContract -import app.k9mail.feature.account.common.domain.entity.AccountDisplayOptions -import app.k9mail.feature.account.common.domain.entity.AccountState -import app.k9mail.feature.account.common.domain.entity.AccountSyncOptions -import app.k9mail.feature.account.common.domain.entity.AuthorizationState -import app.k9mail.feature.account.common.domain.entity.MailConnectionSecurity -import app.k9mail.feature.account.common.domain.entity.SpecialFolderSettings -import com.fsck.k9.mail.AuthType -import com.fsck.k9.mail.ServerSettings - -@Suppress("TooManyFunctions") -class PreviewAccountStateRepository : AccountDomainContract.AccountStateRepository { - - override fun getState(): AccountState = AccountState( - emailAddress = "test@example.com", - incomingServerSettings = ServerSettings( - type = "imap", - host = "imap.example.com", - port = 993, - connectionSecurity = MailConnectionSecurity.SSL_TLS_REQUIRED, - authenticationType = AuthType.PLAIN, - username = "test", - password = "password", - clientCertificateAlias = null, - ), - outgoingServerSettings = ServerSettings( - type = "smtp", - host = "smtp.example.com", - port = 465, - connectionSecurity = MailConnectionSecurity.SSL_TLS_REQUIRED, - authenticationType = AuthType.PLAIN, - username = "test", - password = "password", - clientCertificateAlias = null, - ), - ) - - override fun setState(accountState: AccountState) = Unit - - override fun setEmailAddress(emailAddress: String) = Unit - - override fun setIncomingServerSettings(serverSettings: ServerSettings) = Unit - - override fun setOutgoingServerSettings(serverSettings: ServerSettings) = Unit - - override fun setAuthorizationState(authorizationState: AuthorizationState) = Unit - - override fun setSpecialFolderSettings(specialFolderSettings: SpecialFolderSettings) = Unit - - override fun setDisplayOptions(displayOptions: AccountDisplayOptions) = Unit - - override fun setSyncOptions(syncOptions: AccountSyncOptions) = Unit - - override fun clear() = Unit -} diff --git a/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/options/sync/SyncOptionsContentPreview.kt b/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/options/sync/SyncOptionsContentPreview.kt new file mode 100644 index 000000000..6a276c686 --- /dev/null +++ b/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/options/sync/SyncOptionsContentPreview.kt @@ -0,0 +1,18 @@ +package app.k9mail.feature.account.setup.ui.options.sync + +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.runtime.Composable +import androidx.compose.ui.tooling.preview.Preview +import app.k9mail.core.ui.compose.designsystem.PreviewWithTheme + +@Composable +@Preview(showBackground = true) +internal fun SyncOptionsContentPreview() { + PreviewWithTheme { + SyncOptionsContent( + state = SyncOptionsContract.State(), + onEvent = {}, + contentPadding = PaddingValues(), + ) + } +} diff --git a/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/options/sync/SyncOptionsScreenPreview.kt b/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/options/sync/SyncOptionsScreenPreview.kt new file mode 100644 index 000000000..291bedf2e --- /dev/null +++ b/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/options/sync/SyncOptionsScreenPreview.kt @@ -0,0 +1,20 @@ +package app.k9mail.feature.account.setup.ui.options.sync + +import androidx.compose.runtime.Composable +import androidx.compose.ui.tooling.preview.Preview +import app.k9mail.core.ui.compose.designsystem.PreviewWithTheme +import app.k9mail.feature.account.common.ui.fake.FakeAccountStateRepository + +@Composable +@Preview(showBackground = true) +internal fun SyncOptionsScreenPreview() { + PreviewWithTheme { + SyncOptionsScreen( + onNext = {}, + onBack = {}, + viewModel = SyncOptionsViewModel( + accountStateRepository = FakeAccountStateRepository(), + ), + ) + } +} diff --git a/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/options/sync/SyncOptionsContent.kt b/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/options/sync/SyncOptionsContent.kt index 82a3c22b6..2bbec2cd4 100644 --- a/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/options/sync/SyncOptionsContent.kt +++ b/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/options/sync/SyncOptionsContent.kt @@ -1,7 +1,6 @@ package app.k9mail.feature.account.setup.ui.options.sync import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.consumeWindowInsets @@ -17,14 +16,11 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.stringResource -import androidx.compose.ui.tooling.preview.Preview import app.k9mail.core.ui.compose.designsystem.atom.text.TextLabelSmall import app.k9mail.core.ui.compose.designsystem.molecule.input.SelectInput import app.k9mail.core.ui.compose.designsystem.molecule.input.SwitchInput 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 -import app.k9mail.core.ui.compose.theme.ThunderbirdTheme +import app.k9mail.core.ui.compose.theme2.MainTheme import app.k9mail.feature.account.common.ui.AppTitleTopHeader import app.k9mail.feature.account.common.ui.item.defaultHeadlineItemPadding import app.k9mail.feature.account.common.ui.item.defaultItemPadding @@ -34,7 +30,6 @@ import app.k9mail.feature.account.setup.domain.entity.EmailDisplayCount import app.k9mail.feature.account.setup.ui.options.sync.SyncOptionsContract.Event import app.k9mail.feature.account.setup.ui.options.sync.SyncOptionsContract.State -@OptIn(ExperimentalLayoutApi::class) @Suppress("LongMethod") @Composable internal fun SyncOptionsContent( @@ -109,27 +104,3 @@ internal fun SyncOptionsContent( } } } - -@Composable -@Preview(showBackground = true) -internal fun SyncOptionsContentK9Preview() { - K9Theme { - SyncOptionsContent( - state = State(), - onEvent = {}, - contentPadding = PaddingValues(), - ) - } -} - -@Composable -@Preview(showBackground = true) -internal fun SyncOptionsContentThunderbirdPreview() { - ThunderbirdTheme { - SyncOptionsContent( - state = State(), - onEvent = {}, - contentPadding = PaddingValues(), - ) - } -} diff --git a/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/options/sync/SyncOptionsScreen.kt b/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/options/sync/SyncOptionsScreen.kt index 68195a3f8..887db2ca5 100644 --- a/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/options/sync/SyncOptionsScreen.kt +++ b/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/options/sync/SyncOptionsScreen.kt @@ -4,13 +4,9 @@ import androidx.activity.compose.BackHandler import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview import app.k9mail.core.ui.compose.common.mvi.observe import app.k9mail.core.ui.compose.designsystem.template.Scaffold -import app.k9mail.core.ui.compose.theme.K9Theme -import app.k9mail.core.ui.compose.theme.ThunderbirdTheme import app.k9mail.feature.account.common.ui.WizardNavigationBar -import app.k9mail.feature.account.common.ui.preview.PreviewAccountStateRepository import app.k9mail.feature.account.setup.ui.options.sync.SyncOptionsContract.Effect import app.k9mail.feature.account.setup.ui.options.sync.SyncOptionsContract.Event import app.k9mail.feature.account.setup.ui.options.sync.SyncOptionsContract.ViewModel @@ -53,31 +49,3 @@ internal fun SyncOptionsScreen( ) } } - -@Composable -@Preview(showBackground = true) -internal fun SyncOptionsScreenK9Preview() { - K9Theme { - SyncOptionsScreen( - onNext = {}, - onBack = {}, - viewModel = SyncOptionsViewModel( - accountStateRepository = PreviewAccountStateRepository(), - ), - ) - } -} - -@Composable -@Preview(showBackground = true) -internal fun SyncOptionsScreenThunderbirdPreview() { - ThunderbirdTheme { - SyncOptionsScreen( - onNext = {}, - onBack = {}, - viewModel = SyncOptionsViewModel( - accountStateRepository = PreviewAccountStateRepository(), - ), - ) - } -}