From b06c1c8985dccd5a1967da45b118a8660e2c5288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolf-Martell=20Montw=C3=A9?= Date: Wed, 24 Apr 2024 17:43:49 +0200 Subject: [PATCH] Change account setup special folders feature to theme 2 --- .../SpecialFoldersContentPreview.kt | 64 +++++++++++++++++++ .../SpecialFoldersFormContentPreview.kt | 16 +++++ .../SpecialFoldersScreenPreview.kt | 18 ++++++ .../fake/FakeSpecialFoldersViewModel.kt | 0 .../specialfolders/SpecialFoldersContent.kt | 62 +----------------- .../SpecialFoldersFormContent.kt | 15 +---- .../ui/specialfolders/SpecialFoldersScreen.kt | 15 ----- .../FakeSpecialFoldersFormUiModel.kt | 2 +- .../SpecialFoldersViewModelTest.kt | 1 - 9 files changed, 101 insertions(+), 92 deletions(-) create mode 100644 feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersContentPreview.kt create mode 100644 feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersFormContentPreview.kt create mode 100644 feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersScreenPreview.kt rename feature/account/setup/src/{main => debug}/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/fake/FakeSpecialFoldersViewModel.kt (100%) rename feature/account/setup/src/{main/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/fake => test/kotlin/app/k9mail/feature/account/setup/ui/specialfolders}/FakeSpecialFoldersFormUiModel.kt (89%) diff --git a/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersContentPreview.kt b/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersContentPreview.kt new file mode 100644 index 000000000..f3dcc6212 --- /dev/null +++ b/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersContentPreview.kt @@ -0,0 +1,64 @@ +package app.k9mail.feature.account.setup.ui.specialfolders + +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 SpecialFoldersContentLoadingPreview() { + PreviewWithTheme { + SpecialFoldersContent( + state = SpecialFoldersContract.State( + isLoading = true, + ), + onEvent = {}, + contentPadding = PaddingValues(), + ) + } +} + +@Composable +@Preview(showBackground = true) +internal fun SpecialFoldersContentFormPreview() { + PreviewWithTheme { + SpecialFoldersContent( + state = SpecialFoldersContract.State( + isLoading = false, + ), + onEvent = {}, + contentPadding = PaddingValues(), + ) + } +} + +@Composable +@Preview(showBackground = true) +internal fun SpecialFoldersContentSuccessPreview() { + PreviewWithTheme { + SpecialFoldersContent( + state = SpecialFoldersContract.State( + isLoading = false, + isSuccess = true, + ), + onEvent = {}, + contentPadding = PaddingValues(), + ) + } +} + +@Composable +@Preview(showBackground = true) +internal fun SpecialFoldersContentErrorPreview() { + PreviewWithTheme { + SpecialFoldersContent( + state = SpecialFoldersContract.State( + isLoading = false, + error = SpecialFoldersContract.Failure.LoadFoldersFailed("Error"), + ), + onEvent = {}, + contentPadding = PaddingValues(), + ) + } +} diff --git a/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersFormContentPreview.kt b/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersFormContentPreview.kt new file mode 100644 index 000000000..1f4b4a5ca --- /dev/null +++ b/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersFormContentPreview.kt @@ -0,0 +1,16 @@ +package app.k9mail.feature.account.setup.ui.specialfolders + +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 SpecialFoldersFormContentPreview() { + PreviewWithTheme { + SpecialFoldersFormContent( + state = SpecialFoldersContract.FormState(), + onEvent = {}, + ) + } +} diff --git a/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersScreenPreview.kt b/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersScreenPreview.kt new file mode 100644 index 000000000..3b0c64a11 --- /dev/null +++ b/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersScreenPreview.kt @@ -0,0 +1,18 @@ +package app.k9mail.feature.account.setup.ui.specialfolders + +import androidx.compose.runtime.Composable +import app.k9mail.core.ui.compose.common.annotation.PreviewDevices +import app.k9mail.core.ui.compose.designsystem.PreviewWithTheme +import app.k9mail.feature.account.setup.ui.specialfolders.fake.FakeSpecialFoldersViewModel + +@Composable +@PreviewDevices +internal fun SpecialFoldersScreenPreview() { + PreviewWithTheme { + SpecialFoldersScreen( + onNext = {}, + onBack = {}, + viewModel = FakeSpecialFoldersViewModel(), + ) + } +} diff --git a/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/fake/FakeSpecialFoldersViewModel.kt b/feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/fake/FakeSpecialFoldersViewModel.kt similarity index 100% rename from feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/fake/FakeSpecialFoldersViewModel.kt rename to feature/account/setup/src/debug/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/fake/FakeSpecialFoldersViewModel.kt diff --git a/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersContent.kt b/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersContent.kt index 5937a2191..2be7708e1 100644 --- a/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersContent.kt +++ b/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersContent.kt @@ -9,13 +9,11 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier 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.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.template.ResponsiveWidthContainer -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.ui.AppTitleTopHeader import app.k9mail.feature.account.common.ui.loadingerror.rememberContentLoadingErrorViewState import app.k9mail.feature.account.setup.R @@ -94,61 +92,3 @@ private fun SpecialFoldersErrorView( .padding(MainTheme.spacings.double), ) } - -@Preview(showBackground = true) -@Composable -internal fun SpecialFoldersContentLoadingPreview() { - PreviewWithThemes { - SpecialFoldersContent( - state = State( - isLoading = true, - ), - onEvent = {}, - contentPadding = PaddingValues(), - ) - } -} - -@Preview(showBackground = true) -@Composable -internal fun SpecialFoldersContentFormPreview() { - PreviewWithThemes { - SpecialFoldersContent( - state = State( - isLoading = false, - ), - onEvent = {}, - contentPadding = PaddingValues(), - ) - } -} - -@Preview(showBackground = true) -@Composable -internal fun SpecialFoldersContentSuccessPreview() { - PreviewWithThemes { - SpecialFoldersContent( - state = State( - isLoading = false, - isSuccess = true, - ), - onEvent = {}, - contentPadding = PaddingValues(), - ) - } -} - -@Preview(showBackground = true) -@Composable -internal fun SpecialFoldersContentErrorPreview() { - PreviewWithThemes { - SpecialFoldersContent( - state = State( - isLoading = false, - error = SpecialFoldersContract.Failure.LoadFoldersFailed("Error"), - ), - onEvent = {}, - contentPadding = PaddingValues(), - ) - } -} diff --git a/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersFormContent.kt b/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersFormContent.kt index dece4cd9a..23d084dcb 100644 --- a/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersFormContent.kt +++ b/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersFormContent.kt @@ -11,12 +11,10 @@ import androidx.compose.ui.Alignment 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.atom.text.TextBodyLarge import app.k9mail.core.ui.compose.designsystem.atom.text.TextBodySmall import app.k9mail.core.ui.compose.designsystem.molecule.input.SelectInput -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.ui.item.defaultItemPadding import app.k9mail.feature.account.setup.R import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.FormEvent @@ -113,14 +111,3 @@ fun SpecialFoldersFormContent( } } } - -@Preview(showBackground = true) -@Composable -internal fun SpecialFoldersFormContentPreview() { - PreviewWithThemes { - SpecialFoldersFormContent( - state = FormState(), - onEvent = {}, - ) - } -} diff --git a/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersScreen.kt b/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersScreen.kt index 158d81ed0..d73b1df29 100644 --- a/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersScreen.kt +++ b/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersScreen.kt @@ -4,16 +4,13 @@ import androidx.activity.compose.BackHandler import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.Modifier -import app.k9mail.core.ui.compose.common.annotation.PreviewDevices 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.feature.account.common.ui.WizardNavigationBar import app.k9mail.feature.account.common.ui.WizardNavigationBarState import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.Effect import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.Event import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.ViewModel -import app.k9mail.feature.account.setup.ui.specialfolders.fake.FakeSpecialFoldersViewModel @Composable fun SpecialFoldersScreen( @@ -56,15 +53,3 @@ fun SpecialFoldersScreen( ) } } - -@Composable -@PreviewDevices -internal fun SpecialFoldersScreenK9Preview() { - K9Theme { - SpecialFoldersScreen( - onNext = {}, - onBack = {}, - viewModel = FakeSpecialFoldersViewModel(), - ) - } -} diff --git a/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/fake/FakeSpecialFoldersFormUiModel.kt b/feature/account/setup/src/test/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/FakeSpecialFoldersFormUiModel.kt similarity index 89% rename from feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/fake/FakeSpecialFoldersFormUiModel.kt rename to feature/account/setup/src/test/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/FakeSpecialFoldersFormUiModel.kt index 481d9f196..6059afcef 100644 --- a/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/fake/FakeSpecialFoldersFormUiModel.kt +++ b/feature/account/setup/src/test/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/FakeSpecialFoldersFormUiModel.kt @@ -1,4 +1,4 @@ -package app.k9mail.feature.account.setup.ui.specialfolders.fake +package app.k9mail.feature.account.setup.ui.specialfolders import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.FormEvent import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.FormState diff --git a/feature/account/setup/src/test/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersViewModelTest.kt b/feature/account/setup/src/test/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersViewModelTest.kt index 21119e8d4..483bb4005 100644 --- a/feature/account/setup/src/test/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersViewModelTest.kt +++ b/feature/account/setup/src/test/kotlin/app/k9mail/feature/account/setup/ui/specialfolders/SpecialFoldersViewModelTest.kt @@ -17,7 +17,6 @@ import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.FormEvent import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.FormState import app.k9mail.feature.account.setup.ui.specialfolders.SpecialFoldersContract.State -import app.k9mail.feature.account.setup.ui.specialfolders.fake.FakeSpecialFoldersFormUiModel import assertk.assertThat import assertk.assertions.containsExactly import assertk.assertions.isEqualTo