Change account setup autodiscovery feature to theme 2

This commit is contained in:
Wolf-Martell Montwé 2024-04-24 13:40:08 +02:00
parent 2b3048e1c7
commit ac19c2765c
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72
15 changed files with 345 additions and 303 deletions

View file

@ -0,0 +1,98 @@
package app.k9mail.feature.account.setup.ui.autodiscovery
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.domain.input.StringInputField
import app.k9mail.feature.account.oauth.ui.preview.PreviewAccountOAuthViewModel
import app.k9mail.feature.account.server.validation.ui.fake.FakeAccountOAuthViewModel
import app.k9mail.feature.account.setup.ui.autodiscovery.fake.fakeAutoDiscoveryResultSettings
@Composable
@Preview(showBackground = true)
internal fun AccountAutoDiscoveryContentPreview() {
PreviewWithTheme {
AccountAutoDiscoveryContent(
state = AccountAutoDiscoveryContract.State(),
onEvent = {},
oAuthViewModel = FakeAccountOAuthViewModel(),
)
}
}
@Composable
@Preview(showBackground = true)
internal fun AccountAutoDiscoveryContentEmailPreview() {
PreviewWithTheme {
AccountAutoDiscoveryContent(
state = AccountAutoDiscoveryContract.State(
emailAddress = StringInputField(value = "test@example.com"),
),
onEvent = {},
oAuthViewModel = FakeAccountOAuthViewModel(),
)
}
}
@Composable
@Preview(showBackground = true)
internal fun AccountAutoDiscoveryContentPasswordPreview() {
PreviewWithTheme {
AccountAutoDiscoveryContent(
state = AccountAutoDiscoveryContract.State(
configStep = AccountAutoDiscoveryContract.ConfigStep.PASSWORD,
emailAddress = StringInputField(value = "test@example.com"),
autoDiscoverySettings = fakeAutoDiscoveryResultSettings(isTrusted = true),
),
onEvent = {},
oAuthViewModel = PreviewAccountOAuthViewModel(),
)
}
}
@Composable
@Preview(showBackground = true)
internal fun AccountAutoDiscoveryContentPasswordUntrustedSettingsPreview() {
PreviewWithTheme {
AccountAutoDiscoveryContent(
state = AccountAutoDiscoveryContract.State(
configStep = AccountAutoDiscoveryContract.ConfigStep.PASSWORD,
emailAddress = StringInputField(value = "test@example.com"),
autoDiscoverySettings = fakeAutoDiscoveryResultSettings(isTrusted = false),
),
onEvent = {},
oAuthViewModel = PreviewAccountOAuthViewModel(),
)
}
}
@Composable
@Preview(showBackground = true)
internal fun AccountAutoDiscoveryContentPasswordNoSettingsPreview() {
PreviewWithTheme {
AccountAutoDiscoveryContent(
state = AccountAutoDiscoveryContract.State(
configStep = AccountAutoDiscoveryContract.ConfigStep.PASSWORD,
emailAddress = StringInputField(value = "test@example.com"),
),
onEvent = {},
oAuthViewModel = FakeAccountOAuthViewModel(),
)
}
}
@Composable
@Preview(showBackground = true)
internal fun AccountAutoDiscoveryContentOAuthPreview() {
PreviewWithTheme {
AccountAutoDiscoveryContent(
state = AccountAutoDiscoveryContract.State(
configStep = AccountAutoDiscoveryContract.ConfigStep.OAUTH,
emailAddress = StringInputField(value = "test@example.com"),
autoDiscoverySettings = fakeAutoDiscoveryResultSettings(isTrusted = true),
),
onEvent = {},
oAuthViewModel = FakeAccountOAuthViewModel(),
)
}
}

View file

@ -0,0 +1,25 @@
package app.k9mail.feature.account.setup.ui.autodiscovery
import androidx.compose.runtime.Composable
import app.k9mail.autodiscovery.api.AutoDiscoveryResult
import app.k9mail.core.ui.compose.common.annotation.PreviewDevicesWithBackground
import app.k9mail.core.ui.compose.designsystem.PreviewWithTheme
import app.k9mail.feature.account.common.ui.fake.FakeAccountStateRepository
import app.k9mail.feature.account.server.validation.ui.fake.FakeAccountOAuthViewModel
@Composable
@PreviewDevicesWithBackground
internal fun AccountAutoDiscoveryScreenK9Preview() {
PreviewWithTheme {
AccountAutoDiscoveryScreen(
onNext = {},
onBack = {},
viewModel = AccountAutoDiscoveryViewModel(
validator = AccountAutoDiscoveryValidator(),
getAutoDiscovery = { AutoDiscoveryResult.NoUsableSettingsFound },
accountStateRepository = FakeAccountStateRepository(),
oAuthViewModel = FakeAccountOAuthViewModel(),
),
)
}
}

View file

@ -0,0 +1,29 @@
package app.k9mail.feature.account.setup.ui.autodiscovery.fake
import app.k9mail.autodiscovery.api.AuthenticationType
import app.k9mail.autodiscovery.api.AutoDiscoveryResult
import app.k9mail.autodiscovery.api.ConnectionSecurity
import app.k9mail.autodiscovery.api.ImapServerSettings
import app.k9mail.autodiscovery.api.SmtpServerSettings
import app.k9mail.core.common.net.toHostname
import app.k9mail.core.common.net.toPort
internal fun fakeAutoDiscoveryResultSettings(isTrusted: Boolean) =
AutoDiscoveryResult.Settings(
incomingServerSettings = ImapServerSettings(
hostname = "imap.example.com".toHostname(),
port = 993.toPort(),
connectionSecurity = ConnectionSecurity.TLS,
authenticationTypes = listOf(AuthenticationType.PasswordEncrypted),
username = "",
),
outgoingServerSettings = SmtpServerSettings(
hostname = "smtp.example.com".toHostname(),
port = 465.toPort(),
connectionSecurity = ConnectionSecurity.TLS,
authenticationTypes = listOf(AuthenticationType.PasswordEncrypted),
username = "",
),
isTrusted = isTrusted,
source = "preview",
)

View file

@ -0,0 +1,20 @@
package app.k9mail.feature.account.setup.ui.autodiscovery.view
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.PreviewWithThemes
import app.k9mail.feature.account.common.domain.input.BooleanInputField
@Composable
@Preview(showBackground = true)
internal fun AutoDiscoveryResultApprovalViewPreview() {
PreviewWithThemes {
AutoDiscoveryResultApprovalView(
approvalState = BooleanInputField(
value = true,
isValid = true,
),
onApprovalChange = {},
)
}
}

View file

@ -0,0 +1,17 @@
package app.k9mail.feature.account.setup.ui.autodiscovery.view
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.PreviewWithThemes
import app.k9mail.feature.account.setup.ui.autodiscovery.fake.fakeAutoDiscoveryResultSettings
@Composable
@Preview(showBackground = true)
internal fun AutoDiscoveryResultBodyViewPreview() {
PreviewWithThemes {
AutoDiscoveryResultBodyView(
settings = fakeAutoDiscoveryResultSettings(isTrusted = true),
onEditConfigurationClick = {},
)
}
}

View file

@ -0,0 +1,60 @@
package app.k9mail.feature.account.setup.ui.autodiscovery.view
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.PreviewWithThemes
@Composable
@Preview(showBackground = true)
internal fun AutoDiscoveryResultHeaderViewTrustedCollapsedPreview() {
PreviewWithThemes {
AutoDiscoveryResultHeaderView(
state = AutoDiscoveryResultHeaderState.Trusted,
isExpanded = true,
)
}
}
@Composable
@Preview(showBackground = true)
internal fun AutoDiscoveryResultHeaderViewTrustedExpandedPreview() {
PreviewWithThemes {
AutoDiscoveryResultHeaderView(
state = AutoDiscoveryResultHeaderState.Trusted,
isExpanded = false,
)
}
}
@Composable
@Preview(showBackground = true)
internal fun AutoDiscoveryResultHeaderViewUntrustedCollapsedPreview() {
PreviewWithThemes {
AutoDiscoveryResultHeaderView(
state = AutoDiscoveryResultHeaderState.Untrusted,
isExpanded = true,
)
}
}
@Composable
@Preview(showBackground = true)
internal fun AutoDiscoveryResultHeaderViewUntrustedExpandedPreview() {
PreviewWithThemes {
AutoDiscoveryResultHeaderView(
state = AutoDiscoveryResultHeaderState.Untrusted,
isExpanded = false,
)
}
}
@Composable
@Preview(showBackground = true)
internal fun AutoDiscoveryResultHeaderNoSettingsPreview() {
PreviewWithThemes {
AutoDiscoveryResultHeaderView(
state = AutoDiscoveryResultHeaderState.NoSettings,
isExpanded = false,
)
}
}

View file

@ -0,0 +1,28 @@
package app.k9mail.feature.account.setup.ui.autodiscovery.view
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.PreviewWithThemes
import app.k9mail.feature.account.setup.ui.autodiscovery.fake.fakeAutoDiscoveryResultSettings
@Composable
@Preview(showBackground = true)
internal fun AutoDiscoveryResultViewTrustedPreview() {
PreviewWithThemes {
AutoDiscoveryResultView(
settings = fakeAutoDiscoveryResultSettings(isTrusted = true),
onEditConfigurationClick = {},
)
}
}
@Composable
@Preview(showBackground = true)
internal fun AutoDiscoveryResultViewUntrustedPreview() {
PreviewWithThemes {
AutoDiscoveryResultView(
settings = fakeAutoDiscoveryResultSettings(isTrusted = false),
onEditConfigurationClick = {},
)
}
}

View file

@ -0,0 +1,62 @@
package app.k9mail.feature.account.setup.ui.autodiscovery.view
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.autodiscovery.api.ConnectionSecurity
import app.k9mail.core.common.net.toHostname
import app.k9mail.core.ui.compose.designsystem.PreviewWithThemes
@Composable
@Preview(showBackground = true)
internal fun AutoDiscoveryServerSettingsViewPreview() {
PreviewWithThemes {
AutoDiscoveryServerSettingsView(
protocolName = "IMAP",
serverHostname = "imap.example.com".toHostname(),
serverPort = 993,
connectionSecurity = ConnectionSecurity.TLS,
)
}
}
@Composable
@Preview(showBackground = true)
internal fun AutoDiscoveryServerSettingsViewOutgoingPreview() {
PreviewWithThemes {
AutoDiscoveryServerSettingsView(
protocolName = "IMAP",
serverHostname = "imap.example.com".toHostname(),
serverPort = 993,
connectionSecurity = ConnectionSecurity.TLS,
isIncoming = false,
)
}
}
@Composable
@Preview(showBackground = true)
internal fun AutoDiscoveryServerSettingsViewWithUserPreview() {
PreviewWithThemes {
AutoDiscoveryServerSettingsView(
protocolName = "IMAP",
serverHostname = "imap.example.com".toHostname(),
serverPort = 993,
connectionSecurity = ConnectionSecurity.TLS,
username = "username",
)
}
}
@Composable
@Preview(showBackground = true)
internal fun AutoDiscoveryServerSettingsViewWithIpAddressPreview() {
PreviewWithThemes {
AutoDiscoveryServerSettingsView(
protocolName = "IMAP",
serverHostname = "127.0.0.1".toHostname(),
serverPort = 993,
connectionSecurity = ConnectionSecurity.TLS,
username = "username",
)
}
}

View file

@ -15,23 +15,19 @@ import androidx.compose.ui.Modifier
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.annotation.PreviewDevicesWithBackground
import app.k9mail.core.ui.compose.designsystem.molecule.ContentLoadingErrorView
import app.k9mail.core.ui.compose.designsystem.molecule.ErrorView
import app.k9mail.core.ui.compose.designsystem.molecule.LoadingView
import app.k9mail.core.ui.compose.designsystem.molecule.input.EmailAddressInput
import app.k9mail.core.ui.compose.designsystem.molecule.input.PasswordInput
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.WizardNavigationBar
import app.k9mail.feature.account.common.ui.WizardNavigationBarState
import app.k9mail.feature.account.common.ui.loadingerror.rememberContentLoadingErrorViewState
import app.k9mail.feature.account.oauth.ui.AccountOAuthContract
import app.k9mail.feature.account.oauth.ui.AccountOAuthView
import app.k9mail.feature.account.oauth.ui.preview.PreviewAccountOAuthViewModel
import app.k9mail.feature.account.setup.R
import app.k9mail.feature.account.setup.ui.autodiscovery.AccountAutoDiscoveryContract.Event
import app.k9mail.feature.account.setup.ui.autodiscovery.AccountAutoDiscoveryContract.State
@ -177,27 +173,3 @@ internal fun ContentView(
}
}
}
@Composable
@PreviewDevicesWithBackground
internal fun AccountAutoDiscoveryContentK9Preview() {
K9Theme {
AccountAutoDiscoveryContent(
state = State(),
onEvent = {},
oAuthViewModel = PreviewAccountOAuthViewModel(),
)
}
}
@Composable
@PreviewDevicesWithBackground
internal fun AccountAutoDiscoveryContentThunderbirdPreview() {
ThunderbirdTheme {
AccountAutoDiscoveryContent(
state = State(),
onEvent = {},
oAuthViewModel = PreviewAccountOAuthViewModel(),
)
}
}

View file

@ -3,13 +3,7 @@ package app.k9mail.feature.account.setup.ui.autodiscovery
import androidx.activity.compose.BackHandler
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import app.k9mail.autodiscovery.api.AutoDiscoveryResult
import app.k9mail.core.ui.compose.common.annotation.PreviewDevicesWithBackground
import app.k9mail.core.ui.compose.common.mvi.observe
import app.k9mail.core.ui.compose.theme.K9Theme
import app.k9mail.core.ui.compose.theme.ThunderbirdTheme
import app.k9mail.feature.account.common.ui.preview.PreviewAccountStateRepository
import app.k9mail.feature.account.oauth.ui.preview.PreviewAccountOAuthViewModel
import app.k9mail.feature.account.setup.ui.autodiscovery.AccountAutoDiscoveryContract.AutoDiscoveryUiResult
import app.k9mail.feature.account.setup.ui.autodiscovery.AccountAutoDiscoveryContract.Effect
import app.k9mail.feature.account.setup.ui.autodiscovery.AccountAutoDiscoveryContract.Event
@ -40,37 +34,3 @@ internal fun AccountAutoDiscoveryScreen(
modifier = modifier,
)
}
@Composable
@PreviewDevicesWithBackground
internal fun AccountAutoDiscoveryScreenK9Preview() {
K9Theme {
AccountAutoDiscoveryScreen(
onNext = {},
onBack = {},
viewModel = AccountAutoDiscoveryViewModel(
validator = AccountAutoDiscoveryValidator(),
getAutoDiscovery = { AutoDiscoveryResult.NoUsableSettingsFound },
accountStateRepository = PreviewAccountStateRepository(),
oAuthViewModel = PreviewAccountOAuthViewModel(),
),
)
}
}
@Composable
@PreviewDevicesWithBackground
internal fun AccountAutoDiscoveryScreenThunderbirdPreview() {
ThunderbirdTheme {
AccountAutoDiscoveryScreen(
onNext = { },
onBack = {},
viewModel = AccountAutoDiscoveryViewModel(
validator = AccountAutoDiscoveryValidator(),
getAutoDiscovery = { AutoDiscoveryResult.NoUsableSettingsFound },
accountStateRepository = PreviewAccountStateRepository(),
oAuthViewModel = PreviewAccountOAuthViewModel(),
),
)
}
}

View file

@ -7,10 +7,8 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.molecule.input.CheckboxInput
import app.k9mail.core.ui.compose.theme.MainTheme
import app.k9mail.core.ui.compose.theme.PreviewWithThemes
import app.k9mail.core.ui.compose.theme2.MainTheme
import app.k9mail.feature.account.common.domain.input.BooleanInputField
import app.k9mail.feature.account.setup.R
import app.k9mail.feature.account.setup.ui.autodiscovery.toAutoDiscoveryValidationErrorString
@ -34,17 +32,3 @@ internal fun AutoDiscoveryResultApprovalView(
contentPadding = PaddingValues(),
)
}
@Preview(showBackground = true)
@Composable
internal fun AutoDiscoveryResultApprovalViewPreview() {
PreviewWithThemes {
AutoDiscoveryResultApprovalView(
approvalState = BooleanInputField(
value = true,
isValid = true,
),
onApprovalChange = {},
)
}
}

View file

@ -10,18 +10,12 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.autodiscovery.api.AuthenticationType
import app.k9mail.autodiscovery.api.AutoDiscoveryResult
import app.k9mail.autodiscovery.api.ConnectionSecurity
import app.k9mail.autodiscovery.api.ImapServerSettings
import app.k9mail.autodiscovery.api.SmtpServerSettings
import app.k9mail.core.common.net.toHostname
import app.k9mail.core.common.net.toPort
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonText
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBodyMedium
import app.k9mail.core.ui.compose.theme.MainTheme
import app.k9mail.core.ui.compose.theme.PreviewWithThemes
import app.k9mail.core.ui.compose.theme2.MainTheme
import app.k9mail.feature.account.setup.R
@Composable
@ -99,31 +93,3 @@ internal fun EditConfigurationButton(
)
}
}
@Preview
@Composable
internal fun AutoDiscoveryResultBodyViewPreview() {
PreviewWithThemes {
AutoDiscoveryResultBodyView(
settings = AutoDiscoveryResult.Settings(
incomingServerSettings = ImapServerSettings(
hostname = "imap.example.com".toHostname(),
port = 993.toPort(),
connectionSecurity = ConnectionSecurity.TLS,
authenticationTypes = listOf(AuthenticationType.PasswordEncrypted),
username = "",
),
outgoingServerSettings = SmtpServerSettings(
hostname = "smtp.example.com".toHostname(),
port = 465.toPort(),
connectionSecurity = ConnectionSecurity.TLS,
authenticationTypes = listOf(AuthenticationType.PasswordEncrypted),
username = "",
),
isTrusted = true,
source = "preview",
),
onEditConfigurationClick = {},
)
}
}

View file

@ -10,13 +10,11 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.atom.icon.Icon
import app.k9mail.core.ui.compose.designsystem.atom.icon.Icons
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBodyMedium
import app.k9mail.core.ui.compose.designsystem.atom.text.TextTitleLarge
import app.k9mail.core.ui.compose.theme.MainTheme
import app.k9mail.core.ui.compose.theme.PreviewWithThemes
import app.k9mail.core.ui.compose.theme2.MainTheme
@Suppress("LongMethod")
@Composable
@ -72,58 +70,3 @@ private fun selectColor(state: AutoDiscoveryResultHeaderState): Color {
AutoDiscoveryResultHeaderState.Untrusted -> MainTheme.colors.warning
}
}
@Preview
@Composable
internal fun AutoDiscoveryResultHeaderViewTrustedCollapsedPreview() {
PreviewWithThemes {
AutoDiscoveryResultHeaderView(
state = AutoDiscoveryResultHeaderState.Trusted,
isExpanded = true,
)
}
}
@Preview
@Composable
internal fun AutoDiscoveryResultHeaderViewTrustedExpandedPreview() {
PreviewWithThemes {
AutoDiscoveryResultHeaderView(
state = AutoDiscoveryResultHeaderState.Trusted,
isExpanded = false,
)
}
}
@Preview
@Composable
internal fun AutoDiscoveryResultHeaderViewUntrustedCollapsedPreview() {
PreviewWithThemes {
AutoDiscoveryResultHeaderView(
state = AutoDiscoveryResultHeaderState.Untrusted,
isExpanded = true,
)
}
}
@Preview
@Composable
internal fun AutoDiscoveryResultHeaderViewUntrustedExpandedPreview() {
PreviewWithThemes {
AutoDiscoveryResultHeaderView(
state = AutoDiscoveryResultHeaderState.Untrusted,
isExpanded = false,
)
}
}
@Preview
@Composable
internal fun AutoDiscoveryResultHeaderNoSettingsPreview() {
PreviewWithThemes {
AutoDiscoveryResultHeaderView(
state = AutoDiscoveryResultHeaderState.NoSettings,
isExpanded = false,
)
}
}

View file

@ -10,18 +10,10 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import app.k9mail.autodiscovery.api.AuthenticationType
import app.k9mail.autodiscovery.api.AutoDiscoveryResult
import app.k9mail.autodiscovery.api.ConnectionSecurity
import app.k9mail.autodiscovery.api.ImapServerSettings
import app.k9mail.autodiscovery.api.SmtpServerSettings
import app.k9mail.core.common.net.toHostname
import app.k9mail.core.common.net.toPort
import app.k9mail.core.ui.compose.designsystem.atom.Surface
import app.k9mail.core.ui.compose.theme.MainTheme
import app.k9mail.core.ui.compose.theme.PreviewWithThemes
import app.k9mail.core.ui.compose.theme2.MainTheme
@Composable
internal fun AutoDiscoveryResultView(
@ -72,59 +64,3 @@ internal fun AutoDiscoveryResultView(
}
}
}
@Preview(showBackground = true)
@Composable
internal fun AutoDiscoveryResultViewTrustedPreview() {
PreviewWithThemes {
AutoDiscoveryResultView(
settings = AutoDiscoveryResult.Settings(
incomingServerSettings = ImapServerSettings(
hostname = "imap.example.com".toHostname(),
port = 993.toPort(),
connectionSecurity = ConnectionSecurity.TLS,
authenticationTypes = listOf(AuthenticationType.PasswordEncrypted),
username = "",
),
outgoingServerSettings = SmtpServerSettings(
hostname = "smtp.example.com".toHostname(),
port = 465.toPort(),
connectionSecurity = ConnectionSecurity.TLS,
authenticationTypes = listOf(AuthenticationType.PasswordEncrypted),
username = "",
),
isTrusted = true,
source = "preview",
),
onEditConfigurationClick = {},
)
}
}
@Preview(showBackground = true)
@Composable
internal fun AutoDiscoveryResultViewUntrustedPreview() {
PreviewWithThemes {
AutoDiscoveryResultView(
settings = AutoDiscoveryResult.Settings(
incomingServerSettings = ImapServerSettings(
hostname = "imap.example.com".toHostname(),
port = 993.toPort(),
connectionSecurity = ConnectionSecurity.TLS,
authenticationTypes = listOf(AuthenticationType.PasswordEncrypted),
username = "",
),
outgoingServerSettings = SmtpServerSettings(
hostname = "smtp.example.com".toHostname(),
port = 465.toPort(),
connectionSecurity = ConnectionSecurity.TLS,
authenticationTypes = listOf(AuthenticationType.PasswordEncrypted),
username = "",
),
isTrusted = false,
source = "preview",
),
onEditConfigurationClick = {},
)
}
}

View file

@ -15,17 +15,14 @@ import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.autodiscovery.api.ConnectionSecurity
import app.k9mail.core.common.net.Hostname
import app.k9mail.core.common.net.isIpAddress
import app.k9mail.core.common.net.toHostname
import app.k9mail.core.ui.compose.designsystem.atom.icon.Icon
import app.k9mail.core.ui.compose.designsystem.atom.icon.Icons
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBodyLarge
import app.k9mail.core.ui.compose.designsystem.atom.text.TextBodyMedium
import app.k9mail.core.ui.compose.theme.MainTheme
import app.k9mail.core.ui.compose.theme.PreviewWithThemes
import app.k9mail.core.ui.compose.theme2.MainTheme
import app.k9mail.feature.account.setup.ui.autodiscovery.toAutoDiscoveryConnectionSecurityString
@Composable
@ -116,58 +113,3 @@ private fun ServerSettingRow(
)
}
}
@Preview
@Composable
internal fun AutoDiscoveryServerSettingsViewPreview() {
PreviewWithThemes {
AutoDiscoveryServerSettingsView(
protocolName = "IMAP",
serverHostname = "imap.example.com".toHostname(),
serverPort = 993,
connectionSecurity = ConnectionSecurity.TLS,
)
}
}
@Preview
@Composable
internal fun AutoDiscoveryServerSettingsViewOutgoingPreview() {
PreviewWithThemes {
AutoDiscoveryServerSettingsView(
protocolName = "IMAP",
serverHostname = "imap.example.com".toHostname(),
serverPort = 993,
connectionSecurity = ConnectionSecurity.TLS,
isIncoming = false,
)
}
}
@Preview
@Composable
internal fun AutoDiscoveryServerSettingsViewWithUserPreview() {
PreviewWithThemes {
AutoDiscoveryServerSettingsView(
protocolName = "IMAP",
serverHostname = "imap.example.com".toHostname(),
serverPort = 993,
connectionSecurity = ConnectionSecurity.TLS,
username = "username",
)
}
}
@Preview
@Composable
internal fun AutoDiscoveryServerSettingsViewWithIpAddressPreview() {
PreviewWithThemes {
AutoDiscoveryServerSettingsView(
protocolName = "IMAP",
serverHostname = "127.0.0.1".toHostname(),
serverPort = 993,
connectionSecurity = ConnectionSecurity.TLS,
username = "username",
)
}
}