Change account setup options sync feature to theme 2

This commit is contained in:
Wolf-Martell Montwé 2024-04-24 17:29:41 +02:00
parent 05c6449423
commit 6de38fcc9e
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72
5 changed files with 39 additions and 119 deletions

View file

@ -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
}

View file

@ -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(),
)
}
}

View file

@ -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(),
),
)
}
}

View file

@ -1,7 +1,6 @@
package app.k9mail.feature.account.setup.ui.options.sync package app.k9mail.feature.account.setup.ui.options.sync
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.consumeWindowInsets 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.LocalContext
import androidx.compose.ui.platform.testTag import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource 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.atom.text.TextLabelSmall
import app.k9mail.core.ui.compose.designsystem.molecule.input.SelectInput 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.molecule.input.SwitchInput
import app.k9mail.core.ui.compose.designsystem.template.ResponsiveWidthContainer import app.k9mail.core.ui.compose.designsystem.template.ResponsiveWidthContainer
import app.k9mail.core.ui.compose.theme.K9Theme import app.k9mail.core.ui.compose.theme2.MainTheme
import app.k9mail.core.ui.compose.theme.MainTheme
import app.k9mail.core.ui.compose.theme.ThunderbirdTheme
import app.k9mail.feature.account.common.ui.AppTitleTopHeader 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.defaultHeadlineItemPadding
import app.k9mail.feature.account.common.ui.item.defaultItemPadding 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.Event
import app.k9mail.feature.account.setup.ui.options.sync.SyncOptionsContract.State import app.k9mail.feature.account.setup.ui.options.sync.SyncOptionsContract.State
@OptIn(ExperimentalLayoutApi::class)
@Suppress("LongMethod") @Suppress("LongMethod")
@Composable @Composable
internal fun SyncOptionsContent( 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(),
)
}
}

View file

@ -4,13 +4,9 @@ import androidx.activity.compose.BackHandler
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Modifier 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.common.mvi.observe
import app.k9mail.core.ui.compose.designsystem.template.Scaffold 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.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.Effect
import app.k9mail.feature.account.setup.ui.options.sync.SyncOptionsContract.Event import app.k9mail.feature.account.setup.ui.options.sync.SyncOptionsContract.Event
import app.k9mail.feature.account.setup.ui.options.sync.SyncOptionsContract.ViewModel 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(),
),
)
}
}