From 65a150901ebab0a35d78717702a1472baea02009 Mon Sep 17 00:00:00 2001 From: Sungyong An Date: Sat, 9 Nov 2024 00:55:08 +0900 Subject: [PATCH 1/2] Split :feature:settings module to api and impl --- app/build.gradle | 5 +-- feature/home/build.gradle | 2 +- .../soup/movie/feature/home/MainScreen.kt | 5 ++- feature/settings/{ => api}/.gitignore | 0 feature/{theme => settings}/api/build.gradle | 2 +- .../api/src/main/AndroidManifest.xml | 0 .../settings/SettingsComposableFactory.kt | 29 ++++++++++++ .../soup/movie/feature/theme/ThemeOption.kt | 0 .../movie/feature/theme/ThemeOptionManager.kt | 0 .../{theme/api => settings/impl}/.gitignore | 0 feature/settings/{ => impl}/build.gradle | 5 ++- .../{ => impl}/src/main/AndroidManifest.xml | 0 .../impl/SettingsComposableFactoryImpl.kt | 14 ++++++ .../settings/impl}/SettingsNavGraph.kt | 10 ++--- .../impl/di/FeatureSettingsModule.kt} | 25 ++++++----- .../settings}/impl/di/FeatureThemeModule.kt | 13 ++---- .../settings/impl/home}/SettingsScreen.kt | 4 +- .../settings/impl/home}/SettingsUiModel.kt | 2 +- .../settings/impl/home}/SettingsViewModel.kt | 2 +- .../impl/theme}/ThemeOptionManagerImpl.kt | 2 +- .../impl/theme}/ThemeOptionScreenImpl.kt | 5 +-- .../settings/impl/theme}/ThemeOptionStore.kt | 2 +- .../impl/theme}/ThemeOptionViewModel.kt | 2 +- .../impl}/theme/ThemeSettingExtensions.kt | 3 +- .../impl/theme}/ThemeSettingItemUiModel.kt | 2 +- .../soup/movie/feature/theme/ThemeEntry.kt | 45 ------------------- feature/theme/impl/.gitignore | 1 - feature/theme/impl/build.gradle | 29 ------------ .../theme/impl/src/main/AndroidManifest.xml | 1 - 29 files changed, 88 insertions(+), 122 deletions(-) rename feature/settings/{ => api}/.gitignore (100%) rename feature/{theme => settings}/api/build.gradle (88%) rename feature/{theme => settings}/api/src/main/AndroidManifest.xml (100%) create mode 100644 feature/settings/api/src/main/java/soup/movie/feature/settings/SettingsComposableFactory.kt rename feature/{theme => settings}/api/src/main/java/soup/movie/feature/theme/ThemeOption.kt (100%) rename feature/{theme => settings}/api/src/main/java/soup/movie/feature/theme/ThemeOptionManager.kt (100%) rename feature/{theme/api => settings/impl}/.gitignore (100%) rename feature/settings/{ => impl}/build.gradle (84%) rename feature/settings/{ => impl}/src/main/AndroidManifest.xml (100%) create mode 100644 feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/SettingsComposableFactoryImpl.kt rename feature/settings/{src/main/java/soup/movie/feature/settings => impl/src/main/java/soup/movie/feature/settings/impl}/SettingsNavGraph.kt (88%) rename feature/{theme/impl/src/main/java/soup/movie/feature/theme/impl/ThemeEntryImpl.kt => settings/impl/src/main/java/soup/movie/feature/settings/impl/di/FeatureSettingsModule.kt} (52%) rename feature/{theme/impl/src/main/java/soup/movie/feature/theme => settings/impl/src/main/java/soup/movie/feature/settings}/impl/di/FeatureThemeModule.kt (83%) rename feature/settings/{src/main/java/soup/movie/feature/settings => impl/src/main/java/soup/movie/feature/settings/impl/home}/SettingsScreen.kt (97%) rename feature/settings/{src/main/java/soup/movie/feature/settings => impl/src/main/java/soup/movie/feature/settings/impl/home}/SettingsUiModel.kt (94%) rename feature/settings/{src/main/java/soup/movie/feature/settings => impl/src/main/java/soup/movie/feature/settings/impl/home}/SettingsViewModel.kt (97%) rename feature/{theme/impl/src/main/java/soup/movie/feature/theme/impl => settings/impl/src/main/java/soup/movie/feature/settings/impl/theme}/ThemeOptionManagerImpl.kt (98%) rename feature/{theme/impl/src/main/java/soup/movie/feature/theme/impl => settings/impl/src/main/java/soup/movie/feature/settings/impl/theme}/ThemeOptionScreenImpl.kt (95%) rename feature/{theme/impl/src/main/java/soup/movie/feature/theme/impl => settings/impl/src/main/java/soup/movie/feature/settings/impl/theme}/ThemeOptionStore.kt (93%) rename feature/{theme/impl/src/main/java/soup/movie/feature/theme/impl => settings/impl/src/main/java/soup/movie/feature/settings/impl/theme}/ThemeOptionViewModel.kt (96%) rename feature/{theme/api/src/main/java/soup/movie/feature => settings/impl/src/main/java/soup/movie/feature/settings/impl}/theme/ThemeSettingExtensions.kt (91%) rename feature/{theme/impl/src/main/java/soup/movie/feature/theme/impl => settings/impl/src/main/java/soup/movie/feature/settings/impl/theme}/ThemeSettingItemUiModel.kt (94%) delete mode 100644 feature/theme/api/src/main/java/soup/movie/feature/theme/ThemeEntry.kt delete mode 100644 feature/theme/impl/.gitignore delete mode 100644 feature/theme/impl/build.gradle delete mode 100644 feature/theme/impl/src/main/AndroidManifest.xml diff --git a/app/build.gradle b/app/build.gradle index 5b8b323f7..e41969941 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -87,9 +87,8 @@ dependencies { implementation projects.feature.home implementation projects.feature.detail implementation projects.feature.search - implementation projects.feature.settings - implementation projects.feature.theme.api - runtimeOnly projects.feature.theme.impl + implementation projects.feature.settings.api + runtimeOnly projects.feature.settings.impl implementation projects.feature.navigator.api runtimeOnly projects.feature.navigator.impl implementation projects.feature.notification.api diff --git a/feature/home/build.gradle b/feature/home/build.gradle index f9ff3e89a..82a6d43ab 100644 --- a/feature/home/build.gradle +++ b/feature/home/build.gradle @@ -18,7 +18,7 @@ dependencies { implementation projects.data.repository.api implementation projects.data.model implementation projects.domain - implementation projects.feature.settings + implementation projects.feature.settings.api implementation libs.kotlin.stdlib diff --git a/feature/home/src/main/java/soup/movie/feature/home/MainScreen.kt b/feature/home/src/main/java/soup/movie/feature/home/MainScreen.kt index 48a2400d3..080c9d9b1 100644 --- a/feature/home/src/main/java/soup/movie/feature/home/MainScreen.kt +++ b/feature/home/src/main/java/soup/movie/feature/home/MainScreen.kt @@ -50,7 +50,7 @@ import soup.movie.core.designsystem.showToast import soup.movie.core.designsystem.theme.MovieTheme import soup.movie.core.designsystem.windowsizeclass.WindowWidthSizeClass import soup.movie.feature.home.favorite.HomeFavoriteList -import soup.movie.feature.settings.SettingsNavGraph +import soup.movie.feature.settings.rememberSettingsComposableFactory import soup.movie.model.MovieModel import soup.movie.resources.R @@ -94,7 +94,8 @@ fun MainScreen( ) } MainTabUiModel.Settings -> { - SettingsNavGraph() + val factory = rememberSettingsComposableFactory() + factory.SettingsScreen() } } } diff --git a/feature/settings/.gitignore b/feature/settings/api/.gitignore similarity index 100% rename from feature/settings/.gitignore rename to feature/settings/api/.gitignore diff --git a/feature/theme/api/build.gradle b/feature/settings/api/build.gradle similarity index 88% rename from feature/theme/api/build.gradle rename to feature/settings/api/build.gradle index 42f7e9135..54051df38 100644 --- a/feature/theme/api/build.gradle +++ b/feature/settings/api/build.gradle @@ -5,7 +5,7 @@ plugins { } android { - namespace "soup.movie.feature.theme" + namespace "soup.movie.feature.settings" } dependencies { diff --git a/feature/theme/api/src/main/AndroidManifest.xml b/feature/settings/api/src/main/AndroidManifest.xml similarity index 100% rename from feature/theme/api/src/main/AndroidManifest.xml rename to feature/settings/api/src/main/AndroidManifest.xml diff --git a/feature/settings/api/src/main/java/soup/movie/feature/settings/SettingsComposableFactory.kt b/feature/settings/api/src/main/java/soup/movie/feature/settings/SettingsComposableFactory.kt new file mode 100644 index 000000000..ca3e01f00 --- /dev/null +++ b/feature/settings/api/src/main/java/soup/movie/feature/settings/SettingsComposableFactory.kt @@ -0,0 +1,29 @@ +package soup.movie.feature.settings + +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.platform.LocalContext +import dagger.hilt.EntryPoint +import dagger.hilt.InstallIn +import dagger.hilt.android.EntryPointAccessors +import dagger.hilt.components.SingletonComponent + +interface SettingsComposableFactory { + @Composable fun SettingsScreen() +} + +@Composable +fun rememberSettingsComposableFactory(): SettingsComposableFactory { + val context = LocalContext.current + return remember(context) { + EntryPointAccessors + .fromApplication(context, SettingsComposableFactoryEntryPoint::class.java) + .settingsComposableFactory() + } +} + +@EntryPoint +@InstallIn(SingletonComponent::class) +interface SettingsComposableFactoryEntryPoint { + fun settingsComposableFactory(): SettingsComposableFactory +} diff --git a/feature/theme/api/src/main/java/soup/movie/feature/theme/ThemeOption.kt b/feature/settings/api/src/main/java/soup/movie/feature/theme/ThemeOption.kt similarity index 100% rename from feature/theme/api/src/main/java/soup/movie/feature/theme/ThemeOption.kt rename to feature/settings/api/src/main/java/soup/movie/feature/theme/ThemeOption.kt diff --git a/feature/theme/api/src/main/java/soup/movie/feature/theme/ThemeOptionManager.kt b/feature/settings/api/src/main/java/soup/movie/feature/theme/ThemeOptionManager.kt similarity index 100% rename from feature/theme/api/src/main/java/soup/movie/feature/theme/ThemeOptionManager.kt rename to feature/settings/api/src/main/java/soup/movie/feature/theme/ThemeOptionManager.kt diff --git a/feature/theme/api/.gitignore b/feature/settings/impl/.gitignore similarity index 100% rename from feature/theme/api/.gitignore rename to feature/settings/impl/.gitignore diff --git a/feature/settings/build.gradle b/feature/settings/impl/build.gradle similarity index 84% rename from feature/settings/build.gradle rename to feature/settings/impl/build.gradle index 31b5b59fe..8dbb71f51 100644 --- a/feature/settings/build.gradle +++ b/feature/settings/impl/build.gradle @@ -5,7 +5,7 @@ plugins { } android { - namespace "soup.movie.feature.settings" + namespace "soup.movie.feature.settings.impl" } dependencies { @@ -15,10 +15,11 @@ dependencies { implementation projects.core.resources implementation projects.data.settings.api implementation projects.data.model - implementation projects.feature.theme.api + implementation projects.feature.settings.api implementation libs.kotlin.stdlib + implementation libs.androidx.appcompat implementation libs.androidx.hilt.navigation.compose implementation libs.compose.foundation implementation libs.compose.material diff --git a/feature/settings/src/main/AndroidManifest.xml b/feature/settings/impl/src/main/AndroidManifest.xml similarity index 100% rename from feature/settings/src/main/AndroidManifest.xml rename to feature/settings/impl/src/main/AndroidManifest.xml diff --git a/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/SettingsComposableFactoryImpl.kt b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/SettingsComposableFactoryImpl.kt new file mode 100644 index 000000000..51c676fb0 --- /dev/null +++ b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/SettingsComposableFactoryImpl.kt @@ -0,0 +1,14 @@ +package soup.movie.feature.settings.impl + +import androidx.compose.runtime.Composable +import soup.movie.feature.settings.SettingsComposableFactory +import javax.inject.Inject + +class SettingsComposableFactoryImpl @Inject constructor( +) : SettingsComposableFactory { + + @Composable + override fun SettingsScreen() { + SettingsNavGraph() + } +} diff --git a/feature/settings/src/main/java/soup/movie/feature/settings/SettingsNavGraph.kt b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/SettingsNavGraph.kt similarity index 88% rename from feature/settings/src/main/java/soup/movie/feature/settings/SettingsNavGraph.kt rename to feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/SettingsNavGraph.kt index a4a68c5a4..f5e756dbe 100644 --- a/feature/settings/src/main/java/soup/movie/feature/settings/SettingsNavGraph.kt +++ b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/SettingsNavGraph.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package soup.movie.feature.settings +package soup.movie.feature.settings.impl import androidx.compose.runtime.Composable import androidx.hilt.navigation.compose.hiltViewModel @@ -22,8 +22,9 @@ import androidx.navigation.compose.composable import androidx.navigation.compose.rememberNavController import soup.compose.material.motion.animation.materialSharedAxisZIn import soup.compose.material.motion.animation.materialSharedAxisZOut -import soup.movie.feature.theme.ThemeEntry -import soup.movie.feature.theme.rememberThemeEntry +import soup.movie.feature.settings.impl.home.SettingsScreen +import soup.movie.feature.settings.impl.home.SettingsViewModel +import soup.movie.feature.settings.impl.theme.ThemeOptionScreen private enum class Screen(val route: String) { Settings("SettingsScreen"), @@ -51,8 +52,7 @@ fun SettingsNavGraph() { ) } composable(Screen.ThemeOption.route) { - val entry: ThemeEntry = rememberThemeEntry() - entry.ThemeOptionScreen() + ThemeOptionScreen() } } } diff --git a/feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/ThemeEntryImpl.kt b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/di/FeatureSettingsModule.kt similarity index 52% rename from feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/ThemeEntryImpl.kt rename to feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/di/FeatureSettingsModule.kt index abef3c120..efb50c40a 100644 --- a/feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/ThemeEntryImpl.kt +++ b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/di/FeatureSettingsModule.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 SOUP + * Copyright 2022 SOUP * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,16 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package soup.movie.feature.theme.impl +package soup.movie.feature.settings.impl.di -import androidx.compose.runtime.Composable -import soup.movie.feature.theme.ThemeEntry -import javax.inject.Inject +import dagger.Binds +import dagger.Module +import dagger.hilt.InstallIn +import dagger.hilt.components.SingletonComponent +import soup.movie.feature.settings.SettingsComposableFactory +import soup.movie.feature.settings.impl.SettingsComposableFactoryImpl -class ThemeEntryImpl @Inject constructor() : ThemeEntry { +@Module +@InstallIn(SingletonComponent::class) +interface FeatureSettingsModule { - @Composable - override fun ThemeOptionScreen() { - ThemeOptionScreenImpl() - } + @Binds + fun bindsSettingsComposableFactory( + impl: SettingsComposableFactoryImpl, + ): SettingsComposableFactory } diff --git a/feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/di/FeatureThemeModule.kt b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/di/FeatureThemeModule.kt similarity index 83% rename from feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/di/FeatureThemeModule.kt rename to feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/di/FeatureThemeModule.kt index cfe096e44..9d22e4543 100644 --- a/feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/di/FeatureThemeModule.kt +++ b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/di/FeatureThemeModule.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package soup.movie.feature.theme.impl.di +package soup.movie.feature.settings.impl.di import dagger.Binds import dagger.Module @@ -22,22 +22,15 @@ import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent import kotlinx.coroutines.runBlocking import soup.movie.data.settings.AppSettings -import soup.movie.feature.theme.ThemeEntry +import soup.movie.feature.settings.impl.theme.ThemeOptionManagerImpl +import soup.movie.feature.settings.impl.theme.ThemeOptionStore import soup.movie.feature.theme.ThemeOptionManager -import soup.movie.feature.theme.impl.ThemeEntryImpl -import soup.movie.feature.theme.impl.ThemeOptionManagerImpl -import soup.movie.feature.theme.impl.ThemeOptionStore import javax.inject.Singleton @Module @InstallIn(SingletonComponent::class) interface FeatureThemeModule { - @Binds - fun bindsThemeEntry( - impl: ThemeEntryImpl, - ): ThemeEntry - @Binds @Singleton fun bindsThemeOptionManager( diff --git a/feature/settings/src/main/java/soup/movie/feature/settings/SettingsScreen.kt b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/home/SettingsScreen.kt similarity index 97% rename from feature/settings/src/main/java/soup/movie/feature/settings/SettingsScreen.kt rename to feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/home/SettingsScreen.kt index a56ef403d..3ee7ef22e 100644 --- a/feature/settings/src/main/java/soup/movie/feature/settings/SettingsScreen.kt +++ b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/home/SettingsScreen.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package soup.movie.feature.settings +package soup.movie.feature.settings.impl.home import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -47,7 +47,7 @@ import soup.movie.core.designsystem.UnelevatedButton import soup.movie.core.designsystem.icon.MovieIcons import soup.movie.core.designsystem.theme.MovieTheme import soup.movie.core.designsystem.util.debounce -import soup.movie.feature.theme.stringResIdOf +import soup.movie.feature.settings.impl.theme.stringResIdOf import soup.movie.resources.R @Composable diff --git a/feature/settings/src/main/java/soup/movie/feature/settings/SettingsUiModel.kt b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/home/SettingsUiModel.kt similarity index 94% rename from feature/settings/src/main/java/soup/movie/feature/settings/SettingsUiModel.kt rename to feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/home/SettingsUiModel.kt index c7c6d6878..92b15eced 100644 --- a/feature/settings/src/main/java/soup/movie/feature/settings/SettingsUiModel.kt +++ b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/home/SettingsUiModel.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package soup.movie.feature.settings +package soup.movie.feature.settings.impl.home import androidx.annotation.Keep import soup.movie.feature.theme.ThemeOption diff --git a/feature/settings/src/main/java/soup/movie/feature/settings/SettingsViewModel.kt b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/home/SettingsViewModel.kt similarity index 97% rename from feature/settings/src/main/java/soup/movie/feature/settings/SettingsViewModel.kt rename to feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/home/SettingsViewModel.kt index ba8d8cef1..3a846325b 100644 --- a/feature/settings/src/main/java/soup/movie/feature/settings/SettingsViewModel.kt +++ b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/home/SettingsViewModel.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package soup.movie.feature.settings +package soup.movie.feature.settings.impl.home import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope diff --git a/feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/ThemeOptionManagerImpl.kt b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/theme/ThemeOptionManagerImpl.kt similarity index 98% rename from feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/ThemeOptionManagerImpl.kt rename to feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/theme/ThemeOptionManagerImpl.kt index ffd84c4d5..00b1a9415 100644 --- a/feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/ThemeOptionManagerImpl.kt +++ b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/theme/ThemeOptionManagerImpl.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package soup.movie.feature.theme.impl +package soup.movie.feature.settings.impl.theme import android.os.Build import androidx.appcompat.app.AppCompatDelegate diff --git a/feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/ThemeOptionScreenImpl.kt b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/theme/ThemeOptionScreenImpl.kt similarity index 95% rename from feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/ThemeOptionScreenImpl.kt rename to feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/theme/ThemeOptionScreenImpl.kt index 0c9d74609..062c01d23 100644 --- a/feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/ThemeOptionScreenImpl.kt +++ b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/theme/ThemeOptionScreenImpl.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package soup.movie.feature.theme.impl +package soup.movie.feature.settings.impl.theme import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement @@ -33,11 +33,10 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.hilt.navigation.compose.hiltViewModel import soup.movie.core.designsystem.util.debounce -import soup.movie.feature.theme.stringResIdOf import soup.movie.resources.R @Composable -fun ThemeOptionScreenImpl() { +fun ThemeOptionScreen() { val viewModel: ThemeOptionViewModel = hiltViewModel() Scaffold( topBar = { diff --git a/feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/ThemeOptionStore.kt b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/theme/ThemeOptionStore.kt similarity index 93% rename from feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/ThemeOptionStore.kt rename to feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/theme/ThemeOptionStore.kt index 5c146a30c..580851557 100644 --- a/feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/ThemeOptionStore.kt +++ b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/theme/ThemeOptionStore.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package soup.movie.feature.theme.impl +package soup.movie.feature.settings.impl.theme interface ThemeOptionStore { diff --git a/feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/ThemeOptionViewModel.kt b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/theme/ThemeOptionViewModel.kt similarity index 96% rename from feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/ThemeOptionViewModel.kt rename to feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/theme/ThemeOptionViewModel.kt index b42583e6c..1b2614d61 100644 --- a/feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/ThemeOptionViewModel.kt +++ b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/theme/ThemeOptionViewModel.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package soup.movie.feature.theme.impl +package soup.movie.feature.settings.impl.theme import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf diff --git a/feature/theme/api/src/main/java/soup/movie/feature/theme/ThemeSettingExtensions.kt b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/theme/ThemeSettingExtensions.kt similarity index 91% rename from feature/theme/api/src/main/java/soup/movie/feature/theme/ThemeSettingExtensions.kt rename to feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/theme/ThemeSettingExtensions.kt index 70fd531e7..89edd8fea 100644 --- a/feature/theme/api/src/main/java/soup/movie/feature/theme/ThemeSettingExtensions.kt +++ b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/theme/ThemeSettingExtensions.kt @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package soup.movie.feature.theme +package soup.movie.feature.settings.impl.theme import androidx.annotation.StringRes +import soup.movie.feature.theme.ThemeOption import soup.movie.resources.R @StringRes diff --git a/feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/ThemeSettingItemUiModel.kt b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/theme/ThemeSettingItemUiModel.kt similarity index 94% rename from feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/ThemeSettingItemUiModel.kt rename to feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/theme/ThemeSettingItemUiModel.kt index 6c7a62259..b563c604c 100644 --- a/feature/theme/impl/src/main/java/soup/movie/feature/theme/impl/ThemeSettingItemUiModel.kt +++ b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/theme/ThemeSettingItemUiModel.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package soup.movie.feature.theme.impl +package soup.movie.feature.settings.impl.theme import soup.movie.feature.theme.ThemeOption diff --git a/feature/theme/api/src/main/java/soup/movie/feature/theme/ThemeEntry.kt b/feature/theme/api/src/main/java/soup/movie/feature/theme/ThemeEntry.kt deleted file mode 100644 index afcc8cf0c..000000000 --- a/feature/theme/api/src/main/java/soup/movie/feature/theme/ThemeEntry.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2023 SOUP - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package soup.movie.feature.theme - -import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember -import androidx.compose.ui.platform.LocalContext -import dagger.hilt.EntryPoint -import dagger.hilt.InstallIn -import dagger.hilt.android.EntryPointAccessors -import dagger.hilt.components.SingletonComponent - -interface ThemeEntry { - @Composable - fun ThemeOptionScreen() -} - -@Composable -fun rememberThemeEntry(): ThemeEntry { - val context = LocalContext.current - return remember(context) { - EntryPointAccessors - .fromApplication(context, ThemeEntryPoint::class.java) - .providesThemeEntry() - } -} - -@EntryPoint -@InstallIn(SingletonComponent::class) -internal interface ThemeEntryPoint { - fun providesThemeEntry(): ThemeEntry -} diff --git a/feature/theme/impl/.gitignore b/feature/theme/impl/.gitignore deleted file mode 100644 index 42afabfd2..000000000 --- a/feature/theme/impl/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/feature/theme/impl/build.gradle b/feature/theme/impl/build.gradle deleted file mode 100644 index aff3785f1..000000000 --- a/feature/theme/impl/build.gradle +++ /dev/null @@ -1,29 +0,0 @@ -plugins { - id "moop.android.library" - id "moop.android.compose" - id "moop.android.hilt" -} - -android { - namespace "soup.movie.feature.theme.impl" -} - -dependencies { - implementation projects.core.kotlin - implementation projects.core.designsystem - implementation projects.core.resources - implementation projects.data.settings.api - implementation projects.data.model - implementation projects.feature.theme.api - - implementation libs.kotlin.stdlib - - implementation libs.androidx.appcompat - implementation libs.androidx.hilt.navigation.compose - implementation libs.compose.foundation - implementation libs.compose.material - implementation libs.compose.ui - - testImplementation projects.testing - androidTestImplementation projects.testing -} diff --git a/feature/theme/impl/src/main/AndroidManifest.xml b/feature/theme/impl/src/main/AndroidManifest.xml deleted file mode 100644 index cc947c567..000000000 --- a/feature/theme/impl/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - From 47406b06bb853abb501e56a9355a28e955d90ce7 Mon Sep 17 00:00:00 2001 From: Sungyong An Date: Sat, 9 Nov 2024 01:01:45 +0900 Subject: [PATCH 2/2] Fix spotless --- .../settings/SettingsComposableFactory.kt | 15 +++++++++++++++ .../impl/SettingsComposableFactoryImpl.kt | 18 ++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/feature/settings/api/src/main/java/soup/movie/feature/settings/SettingsComposableFactory.kt b/feature/settings/api/src/main/java/soup/movie/feature/settings/SettingsComposableFactory.kt index ca3e01f00..e3f4b2447 100644 --- a/feature/settings/api/src/main/java/soup/movie/feature/settings/SettingsComposableFactory.kt +++ b/feature/settings/api/src/main/java/soup/movie/feature/settings/SettingsComposableFactory.kt @@ -1,3 +1,18 @@ +/* + * Copyright 2024 SOUP + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package soup.movie.feature.settings import androidx.compose.runtime.Composable diff --git a/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/SettingsComposableFactoryImpl.kt b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/SettingsComposableFactoryImpl.kt index 51c676fb0..45e311bfb 100644 --- a/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/SettingsComposableFactoryImpl.kt +++ b/feature/settings/impl/src/main/java/soup/movie/feature/settings/impl/SettingsComposableFactoryImpl.kt @@ -1,11 +1,25 @@ +/* + * Copyright 2024 SOUP + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package soup.movie.feature.settings.impl import androidx.compose.runtime.Composable import soup.movie.feature.settings.SettingsComposableFactory import javax.inject.Inject -class SettingsComposableFactoryImpl @Inject constructor( -) : SettingsComposableFactory { +class SettingsComposableFactoryImpl @Inject constructor() : SettingsComposableFactory { @Composable override fun SettingsScreen() {