From d4b673a66b0a42b5f5d6041e8ec0d29120875001 Mon Sep 17 00:00:00 2001 From: michaelbel Date: Tue, 2 Apr 2024 22:32:00 +0300 Subject: [PATCH] Update project --- androidApp/build.gradle.kts | 22 +- .../main/kotlin/org/michaelbel/movies/App.kt | 2 +- .../org/michaelbel/movies/MainActivity.kt | 15 +- .../movies}/crashlytics/CrashlyticsTree.kt | 4 +- benchmark/build.gradle.kts | 8 +- core/analytics-kmp/build.gradle.kts | 2 +- core/common-kmp/build.gradle.kts | 23 +- .../movies/common/appearance/FeedView.kt | 2 +- .../exceptions/InvalidFeedViewException.kt | 2 +- .../exceptions/InvalidGenderException.kt | 2 +- .../exceptions/InvalidMovieListException.kt | 2 +- .../exceptions/InvalidThemeException.kt | 2 +- .../movies/common/gender/GrammaticalGender.kt | 2 +- .../movies/common/list/MovieList.kt | 2 +- .../common/localization/LocaleController.kt | 13 -- .../localization/di/LocaleKoinModule.kt | 17 -- .../localization/impl/LocaleControllerImpl.kt | 15 -- .../movies/common/theme/AppTheme.kt | 2 +- core/debug-kmp/build.gradle.kts | 3 +- core/interactor-kmp/build.gradle.kts | 4 +- .../interactor/impl/LocaleInteractorImpl.kt} | 10 +- .../interactor/AuthenticationInteractor.kt | 8 +- .../movies/interactor/Interactor.kt | 6 +- .../movies/interactor/LocaleInteractor.kt | 14 ++ .../movies/interactor/SearchInteractor.kt | 4 +- .../interactor/di/InteractorKoinModule.kt | 5 +- .../movies/interactor/entity}/AppLanguage.kt | 4 +- .../exception}/InvalidLocaleException.kt | 2 +- .../impl/AuthenticationInteractorImpl.kt | 8 +- .../interactor/impl/ImageInteractorImpl.kt | 8 +- .../interactor/impl/LocaleInteractorImpl.kt | 17 ++ .../interactor/impl/MovieInteractorImpl.kt | 55 ++++- .../interactor/impl/SearchInteractorImpl.kt | 4 +- .../interactor/impl/SettingsInteractorImpl.kt | 32 ++- .../impl/SuggestionInteractorImpl.kt | 4 +- .../remote/FeedMoviesRemoteMediator.kt | 4 +- .../remote/SearchMoviesRemoteMediator.kt | 4 +- .../interactor/impl/LocaleInteractorImpl.kt} | 10 +- core/navigation-kmp/build.gradle.kts | 6 +- core/network-kmp/build.gradle.kts | 16 +- core/notifications-kmp/build.gradle.kts | 2 +- core/persistence-kmp/build.gradle.kts | 6 +- .../gms-kmp/build.gradle.kts | 8 +- .../inject-kmp/build.gradle.kts | 2 +- core/repository-kmp/build.gradle.kts | 2 +- .../movies/repository/MovieRepository.kt | 6 +- .../movies/repository/SearchRepository.kt | 1 + .../movies/repository/SuggestionRepository.kt | 4 +- .../repository/di/RepositoryKoinModule.kt | 2 - .../repository/impl/MovieRepositoryImpl.kt | 61 ++++-- .../impl/PagingKeyRepositoryImpl.kt | 22 +- .../repository/impl/SearchRepositoryImpl.kt | 12 +- .../repository/impl/SettingsRepositoryImpl.kt | 32 ++- .../impl/SuggestionRepositoryImpl.kt | 10 +- core/ui-kmp/build.gradle.kts | 10 +- .../michaelbel/movies/ui/ktx/ActivityKtx.kt | 17 +- .../LanguagePreviewParameterProvider.kt | 6 - core/widget-kmp/build.gradle.kts | 6 +- core/work-kmp/build.gradle.kts | 7 +- desktopApp/build.gradle.kts | 1 - .../org/michaelbel/movies/MoviesDesktop.kt | 8 +- feature/account-impl-kmp/build.gradle.kts | 8 +- feature/account-kmp/build.gradle.kts | 2 - feature/auth-impl-kmp/build.gradle.kts | 7 +- feature/auth-kmp/build.gradle.kts | 2 - feature/details-impl-kmp/build.gradle.kts | 6 +- feature/details-kmp/build.gradle.kts | 3 - feature/feed-impl-kmp/build.gradle.kts | 10 +- feature/feed-kmp/build.gradle.kts | 2 - feature/gallery-impl-kmp/build.gradle.kts | 6 +- .../movies/gallery/ui/GalleryScreenContent.kt | 14 +- feature/gallery-kmp/build.gradle.kts | 2 - feature/search-impl-kmp/build.gradle.kts | 4 +- feature/search-kmp/build.gradle.kts | 2 - feature/settings-impl-kmp/build.gradle.kts | 9 +- .../movies/settings/SettingsViewModel.kt | 6 +- .../movies/settings/di/SettingsKoinModule.kt | 4 +- .../movies/settings/ui/SettingsRoute.kt | 2 +- .../movies/settings/ktx/SealedStringKtx.kt | 2 +- .../movies/settings/model/SettingsData.kt | 2 +- .../settings/ui/SettingsScreenContent.kt | 2 +- .../movies/settings/ui/SettingsRoute.kt | 2 +- feature/settings-kmp/build.gradle.kts | 3 - gradle/libs.versions.toml | 205 +++++++++++++----- instant/build.gradle.kts | 6 +- 85 files changed, 545 insertions(+), 356 deletions(-) rename {core/common-kmp/src/androidMain/kotlin/org/michaelbel/movies/common => androidApp/src/main/kotlin/org/michaelbel/movies}/crashlytics/CrashlyticsTree.kt (84%) rename core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/{appearance => }/exceptions/InvalidFeedViewException.kt (70%) rename core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/{gender => }/exceptions/InvalidGenderException.kt (57%) rename core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/{list => }/exceptions/InvalidMovieListException.kt (73%) rename core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/{theme => }/exceptions/InvalidThemeException.kt (56%) delete mode 100644 core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/LocaleController.kt delete mode 100644 core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/di/LocaleKoinModule.kt delete mode 100644 core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/impl/LocaleControllerImpl.kt rename core/{common-kmp/src/androidMain/kotlin/org/michaelbel/movies/common/localization/impl/LocaleControllerImpl.kt => interactor-kmp/src/androidMain/kotlin/org/michaelbel/movies/interactor/impl/LocaleInteractorImpl.kt} (88%) create mode 100644 core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/LocaleInteractor.kt rename core/{common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/model => interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/entity}/AppLanguage.kt (85%) rename core/{common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/exceptions => interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/exception}/InvalidLocaleException.kt (69%) create mode 100644 core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/LocaleInteractorImpl.kt rename core/{common-kmp/src/desktopMain/kotlin/org/michaelbel/movies/common/localization/impl/LocaleControllerImpl.kt => interactor-kmp/src/desktopMain/kotlin/org/michaelbel/movies/interactor/impl/LocaleInteractorImpl.kt} (70%) delete mode 100644 core/ui-kmp/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/LanguagePreviewParameterProvider.kt diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index f3980bca0..2e55b14f6 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -1,7 +1,8 @@ + import com.google.firebase.appdistribution.gradle.AppDistributionExtension +import java.io.FileInputStream import org.apache.commons.io.output.ByteArrayOutputStream import org.jetbrains.kotlin.konan.properties.Properties -import java.io.FileInputStream @Suppress("dsl_scope_violation") @@ -169,7 +170,7 @@ dependencies { gmsImplementation(project(":core:platform-services:inject-kmp")) hmsImplementation(project(":core:platform-services:inject-kmp")) fossImplementation(project(":core:platform-services:inject-kmp")) - implementation(project(":core:analytics-kmp")) + implementation(project(":core:common-kmp")) implementation(project(":core:debug-kmp")) implementation(project(":core:interactor-kmp")) @@ -179,6 +180,7 @@ dependencies { implementation(project(":core:ui-kmp")) implementation(project(":core:widget-kmp")) implementation(project(":core:work-kmp")) + implementation(project(":feature:account-kmp")) implementation(project(":feature:auth-kmp")) implementation(project(":feature:details-kmp")) @@ -186,14 +188,14 @@ dependencies { implementation(project(":feature:gallery-kmp")) implementation(project(":feature:search-kmp")) implementation(project(":feature:settings-kmp")) - implementation(libs.kotlin.reflect) - implementation(libs.bundles.koin.android) - testImplementation(libs.junit) - androidTestImplementation(libs.bundles.androidx.test.espresso) - androidTestImplementation(libs.androidx.test.ext.junit.ktx) - androidTestImplementation(libs.androidx.compose.ui.test.junit4) - androidTestImplementation(libs.androidx.benchmark.junit) - debugImplementation(libs.leakcanary) + implementation(libs.bundles.kotlin.reflect.android) + implementation(libs.bundles.koin.compose.work.android) + testImplementation(libs.bundles.junit.android) + androidTestImplementation(libs.bundles.test.espresso.android) + androidTestImplementation(libs.bundles.test.ext.junit.android) + androidTestImplementation(libs.bundles.compose.ui.test.android) + androidTestImplementation(libs.bundles.benchmark.android) + debugImplementation(libs.bundles.leakcanary.android) lintChecks(libs.lint.checks) } diff --git a/androidApp/src/main/kotlin/org/michaelbel/movies/App.kt b/androidApp/src/main/kotlin/org/michaelbel/movies/App.kt index 21f28c914..8e34dabd8 100644 --- a/androidApp/src/main/kotlin/org/michaelbel/movies/App.kt +++ b/androidApp/src/main/kotlin/org/michaelbel/movies/App.kt @@ -8,8 +8,8 @@ import org.koin.android.ext.koin.androidLogger import org.koin.androidx.workmanager.factory.KoinWorkerFactory import org.koin.androidx.workmanager.koin.workManagerFactory import org.koin.core.context.startKoin -import org.michaelbel.movies.common.crashlytics.CrashlyticsTree import org.michaelbel.movies.common_kmp.BuildConfig +import org.michaelbel.movies.crashlytics.CrashlyticsTree import org.michaelbel.movies.di.appKoinModule import org.michaelbel.movies.platform.app.AppService import org.michaelbel.movies.platform.crashlytics.CrashlyticsService diff --git a/androidApp/src/main/kotlin/org/michaelbel/movies/MainActivity.kt b/androidApp/src/main/kotlin/org/michaelbel/movies/MainActivity.kt index 265d3acf5..fa8e7755e 100644 --- a/androidApp/src/main/kotlin/org/michaelbel/movies/MainActivity.kt +++ b/androidApp/src/main/kotlin/org/michaelbel/movies/MainActivity.kt @@ -1,5 +1,7 @@ package org.michaelbel.movies +import android.app.Activity +import android.os.Build import android.os.Bundle import androidx.activity.SystemBarStyle import androidx.activity.compose.setContent @@ -18,6 +20,15 @@ internal class MainActivity: FragmentActivity() { private val viewModel: MainViewModel by viewModel() + private val screenCaptureCallback: Any + get() { + return if (Build.VERSION.SDK_INT >= 34) { + Activity.ScreenCaptureCallback {} + } else { + Unit + } + } + override fun onCreate(savedInstanceState: Bundle?) { installSplashScreen().apply { setKeepOnScreenCondition { viewModel.splashLoading.value } } super.onCreate(savedInstanceState) @@ -39,11 +50,11 @@ internal class MainActivity: FragmentActivity() { override fun onStart() { super.onStart() - supportRegisterScreenCaptureCallback() + supportRegisterScreenCaptureCallback(screenCaptureCallback) } override fun onStop() { super.onStop() - supportUnregisterScreenCaptureCallback() + supportUnregisterScreenCaptureCallback(screenCaptureCallback) } } \ No newline at end of file diff --git a/core/common-kmp/src/androidMain/kotlin/org/michaelbel/movies/common/crashlytics/CrashlyticsTree.kt b/androidApp/src/main/kotlin/org/michaelbel/movies/crashlytics/CrashlyticsTree.kt similarity index 84% rename from core/common-kmp/src/androidMain/kotlin/org/michaelbel/movies/common/crashlytics/CrashlyticsTree.kt rename to androidApp/src/main/kotlin/org/michaelbel/movies/crashlytics/CrashlyticsTree.kt index 6dbb854f7..0950b3d4c 100644 --- a/core/common-kmp/src/androidMain/kotlin/org/michaelbel/movies/common/crashlytics/CrashlyticsTree.kt +++ b/androidApp/src/main/kotlin/org/michaelbel/movies/crashlytics/CrashlyticsTree.kt @@ -1,9 +1,9 @@ -package org.michaelbel.movies.common.crashlytics +package org.michaelbel.movies.crashlytics import org.michaelbel.movies.platform.crashlytics.CrashlyticsService import timber.log.Timber -class CrashlyticsTree( +internal class CrashlyticsTree( private val crashlyticsService: CrashlyticsService ): Timber.Tree() { diff --git a/benchmark/build.gradle.kts b/benchmark/build.gradle.kts index 4f3b634c9..a34510f6b 100644 --- a/benchmark/build.gradle.kts +++ b/benchmark/build.gradle.kts @@ -40,8 +40,8 @@ android { }*/ dependencies { - implementation(libs.bundles.androidx.test.espresso) - implementation(libs.androidx.benchmark.macro.junit) - implementation(libs.androidx.test.ext.junit.ktx) - implementation(libs.androidx.test.uiautomator) + implementation(libs.bundles.test.espresso.android) + implementation(libs.bundles.benchmark.macro.android) + implementation(libs.bundles.test.ext.junit.android) + implementation(libs.bundles.test.uiautomator.android) } \ No newline at end of file diff --git a/core/analytics-kmp/build.gradle.kts b/core/analytics-kmp/build.gradle.kts index 515a2daf3..59dbde8c2 100644 --- a/core/analytics-kmp/build.gradle.kts +++ b/core/analytics-kmp/build.gradle.kts @@ -19,7 +19,7 @@ kotlin { implementation(libs.bundles.koin.common) } androidMain.dependencies { - implementation(libs.koin.android) + implementation(libs.bundles.koin.android) } } } diff --git a/core/common-kmp/build.gradle.kts b/core/common-kmp/build.gradle.kts index 66ade521a..aed4b8bef 100644 --- a/core/common-kmp/build.gradle.kts +++ b/core/common-kmp/build.gradle.kts @@ -16,27 +16,24 @@ kotlin { sourceSets { commonMain.dependencies { - api(project(":core:platform-services:interactor-kmp")) - implementation(project(":core:analytics-kmp")) - implementation(project(":core:network-kmp")) implementation(compose.material3) implementation(libs.bundles.kotlinx.coroutines.common) implementation(libs.bundles.paging.common) implementation(libs.bundles.koin.common) - api(libs.kmp.viewmodel) + api(libs.bundles.kmp.viewmodel.common) } androidMain.dependencies { api(libs.bundles.kotlinx.coroutines.android) api(libs.bundles.lifecycle.android) - api(libs.androidx.activity.compose) - api(libs.androidx.biometric.ktx) - api(libs.androidx.core.ktx) - api(libs.androidx.startup.runtime) - api(libs.androidx.work.runtime.ktx) - api(libs.timber) - implementation(libs.bundles.androidx.appcompat) - implementation(libs.androidx.browser) - implementation(libs.koin.android) + api(libs.bundles.activity.android) + api(libs.bundles.biometric.android) + api(libs.bundles.core.android) + api(libs.bundles.startup.android) + api(libs.bundles.work.android) + api(libs.bundles.timber.android) + implementation(libs.bundles.appcompat.android) + implementation(libs.bundles.browser.android) + implementation(libs.bundles.koin.android) } } } diff --git a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/appearance/FeedView.kt b/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/appearance/FeedView.kt index ab3744a13..df0953b1e 100644 --- a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/appearance/FeedView.kt +++ b/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/appearance/FeedView.kt @@ -1,7 +1,7 @@ package org.michaelbel.movies.common.appearance import org.michaelbel.movies.common.SealedString -import org.michaelbel.movies.common.appearance.exceptions.InvalidFeedViewException +import org.michaelbel.movies.common.exceptions.InvalidFeedViewException sealed interface FeedView: SealedString { diff --git a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/appearance/exceptions/InvalidFeedViewException.kt b/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/exceptions/InvalidFeedViewException.kt similarity index 70% rename from core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/appearance/exceptions/InvalidFeedViewException.kt rename to core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/exceptions/InvalidFeedViewException.kt index cca5fdc56..e86195e30 100644 --- a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/appearance/exceptions/InvalidFeedViewException.kt +++ b/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/exceptions/InvalidFeedViewException.kt @@ -1,4 +1,4 @@ -package org.michaelbel.movies.common.appearance.exceptions +package org.michaelbel.movies.common.exceptions internal data object InvalidFeedViewException: Exception("Invalid feed view") { private fun readResolve(): Any = InvalidFeedViewException diff --git a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/gender/exceptions/InvalidGenderException.kt b/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/exceptions/InvalidGenderException.kt similarity index 57% rename from core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/gender/exceptions/InvalidGenderException.kt rename to core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/exceptions/InvalidGenderException.kt index ac0c44813..44c6e55b5 100644 --- a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/gender/exceptions/InvalidGenderException.kt +++ b/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/exceptions/InvalidGenderException.kt @@ -1,3 +1,3 @@ -package org.michaelbel.movies.common.gender.exceptions +package org.michaelbel.movies.common.exceptions internal data object InvalidGenderException: Exception("Invalid gender") \ No newline at end of file diff --git a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/list/exceptions/InvalidMovieListException.kt b/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/exceptions/InvalidMovieListException.kt similarity index 73% rename from core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/list/exceptions/InvalidMovieListException.kt rename to core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/exceptions/InvalidMovieListException.kt index e01da2fec..6848cd7ab 100644 --- a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/list/exceptions/InvalidMovieListException.kt +++ b/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/exceptions/InvalidMovieListException.kt @@ -1,4 +1,4 @@ -package org.michaelbel.movies.common.list.exceptions +package org.michaelbel.movies.common.exceptions internal data object InvalidMovieListException: Exception("Invalid movie list") { private fun readResolve(): Any = InvalidMovieListException diff --git a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/theme/exceptions/InvalidThemeException.kt b/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/exceptions/InvalidThemeException.kt similarity index 56% rename from core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/theme/exceptions/InvalidThemeException.kt rename to core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/exceptions/InvalidThemeException.kt index 8643aa942..0398e1383 100644 --- a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/theme/exceptions/InvalidThemeException.kt +++ b/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/exceptions/InvalidThemeException.kt @@ -1,3 +1,3 @@ -package org.michaelbel.movies.common.theme.exceptions +package org.michaelbel.movies.common.exceptions internal data object InvalidThemeException: Exception("Invalid theme") \ No newline at end of file diff --git a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/gender/GrammaticalGender.kt b/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/gender/GrammaticalGender.kt index 23e17cf07..4b0857d21 100644 --- a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/gender/GrammaticalGender.kt +++ b/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/gender/GrammaticalGender.kt @@ -1,7 +1,7 @@ package org.michaelbel.movies.common.gender import org.michaelbel.movies.common.SealedString -import org.michaelbel.movies.common.gender.exceptions.InvalidGenderException +import org.michaelbel.movies.common.exceptions.InvalidGenderException sealed interface GrammaticalGender: SealedString { diff --git a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/list/MovieList.kt b/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/list/MovieList.kt index b64bdde35..84696e7a7 100644 --- a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/list/MovieList.kt +++ b/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/list/MovieList.kt @@ -1,7 +1,7 @@ package org.michaelbel.movies.common.list import org.michaelbel.movies.common.SealedString -import org.michaelbel.movies.common.list.exceptions.InvalidMovieListException +import org.michaelbel.movies.common.exceptions.InvalidMovieListException sealed interface MovieList: SealedString { diff --git a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/LocaleController.kt b/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/LocaleController.kt deleted file mode 100644 index 9c97a7692..000000000 --- a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/LocaleController.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.michaelbel.movies.common.localization - -import kotlinx.coroutines.flow.Flow -import org.michaelbel.movies.common.localization.model.AppLanguage - -interface LocaleController { - - val language: String - - val appLanguage: Flow - - suspend fun selectLanguage(language: AppLanguage) -} \ No newline at end of file diff --git a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/di/LocaleKoinModule.kt b/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/di/LocaleKoinModule.kt deleted file mode 100644 index 7376160e6..000000000 --- a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/di/LocaleKoinModule.kt +++ /dev/null @@ -1,17 +0,0 @@ -package org.michaelbel.movies.common.localization.di - -import org.koin.core.module.dsl.bind -import org.koin.core.module.dsl.singleOf -import org.koin.dsl.module -import org.michaelbel.movies.analytics.di.moviesAnalyticsKoinModule -import org.michaelbel.movies.common.dispatchers.di.dispatchersKoinModule -import org.michaelbel.movies.common.localization.LocaleController -import org.michaelbel.movies.common.localization.impl.LocaleControllerImpl - -val localeKoinModule = module { - includes( - dispatchersKoinModule, - moviesAnalyticsKoinModule - ) - singleOf(::LocaleControllerImpl) { bind() } -} \ No newline at end of file diff --git a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/impl/LocaleControllerImpl.kt b/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/impl/LocaleControllerImpl.kt deleted file mode 100644 index c90f9f333..000000000 --- a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/impl/LocaleControllerImpl.kt +++ /dev/null @@ -1,15 +0,0 @@ -@file:Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") - -package org.michaelbel.movies.common.localization.impl - -import kotlinx.coroutines.flow.Flow -import org.michaelbel.movies.common.localization.model.AppLanguage - -internal expect class LocaleControllerImpl { - - val language: String - - val appLanguage: Flow - - suspend fun selectLanguage(language: AppLanguage) -} \ No newline at end of file diff --git a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/theme/AppTheme.kt b/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/theme/AppTheme.kt index 38bcc88cd..ad2e904f1 100644 --- a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/theme/AppTheme.kt +++ b/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/theme/AppTheme.kt @@ -1,7 +1,7 @@ package org.michaelbel.movies.common.theme import org.michaelbel.movies.common.SealedString -import org.michaelbel.movies.common.theme.exceptions.InvalidThemeException +import org.michaelbel.movies.common.exceptions.InvalidThemeException sealed interface AppTheme: SealedString { diff --git a/core/debug-kmp/build.gradle.kts b/core/debug-kmp/build.gradle.kts index 4c357fd73..eb16c64e7 100644 --- a/core/debug-kmp/build.gradle.kts +++ b/core/debug-kmp/build.gradle.kts @@ -22,8 +22,7 @@ kotlin { implementation(project(":core:interactor-kmp")) implementation(project(":core:navigation-kmp")) implementation(project(":core:ui-kmp")) - implementation(libs.koin.android) - implementation(libs.koin.androidx.compose) + implementation(libs.bundles.koin.compose.android) } } } diff --git a/core/interactor-kmp/build.gradle.kts b/core/interactor-kmp/build.gradle.kts index e6c78ed83..3edd75477 100644 --- a/core/interactor-kmp/build.gradle.kts +++ b/core/interactor-kmp/build.gradle.kts @@ -17,10 +17,8 @@ kotlin { sourceSets { commonMain.dependencies { implementation(project(":core:platform-services:interactor-kmp")) - implementation(project(":core:network-kmp")) api(project(":core:analytics-kmp")) api(project(":core:common-kmp")) - api(project(":core:persistence-kmp")) api(project(":core:repository-kmp")) implementation(compose.runtime) implementation(compose.runtimeSaveable) @@ -29,7 +27,7 @@ kotlin { implementation(libs.bundles.koin.common) } androidMain.dependencies { - implementation(libs.koin.android) + implementation(libs.bundles.koin.android) } } } diff --git a/core/common-kmp/src/androidMain/kotlin/org/michaelbel/movies/common/localization/impl/LocaleControllerImpl.kt b/core/interactor-kmp/src/androidMain/kotlin/org/michaelbel/movies/interactor/impl/LocaleInteractorImpl.kt similarity index 88% rename from core/common-kmp/src/androidMain/kotlin/org/michaelbel/movies/common/localization/impl/LocaleControllerImpl.kt rename to core/interactor-kmp/src/androidMain/kotlin/org/michaelbel/movies/interactor/impl/LocaleInteractorImpl.kt index 9389d2619..9c00209f4 100644 --- a/core/common-kmp/src/androidMain/kotlin/org/michaelbel/movies/common/localization/impl/LocaleControllerImpl.kt +++ b/core/interactor-kmp/src/androidMain/kotlin/org/michaelbel/movies/interactor/impl/LocaleInteractorImpl.kt @@ -1,6 +1,6 @@ @file:Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") -package org.michaelbel.movies.common.localization.impl +package org.michaelbel.movies.interactor.impl import android.app.LocaleManager import android.content.Context @@ -13,15 +13,15 @@ import kotlinx.coroutines.withContext import org.michaelbel.movies.analytics.MoviesAnalytics import org.michaelbel.movies.analytics.event.SelectLanguageEvent import org.michaelbel.movies.common.dispatchers.MoviesDispatchers -import org.michaelbel.movies.common.localization.LocaleController -import org.michaelbel.movies.common.localization.model.AppLanguage +import org.michaelbel.movies.interactor.LocaleInteractor +import org.michaelbel.movies.interactor.entity.AppLanguage import java.util.Locale -internal actual class LocaleControllerImpl( +internal actual class LocaleInteractorImpl( private val context: Context, private val dispatchers: MoviesDispatchers, private val analytics: MoviesAnalytics -): LocaleController { +): LocaleInteractor { actual override val language: String get() = AppCompatDelegate.getApplicationLocales()[0]?.language ?: AppLanguage.English().code diff --git a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/AuthenticationInteractor.kt b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/AuthenticationInteractor.kt index c8a1c2f33..3c2da6ed3 100644 --- a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/AuthenticationInteractor.kt +++ b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/AuthenticationInteractor.kt @@ -7,7 +7,9 @@ import org.michaelbel.movies.network.model.Token interface AuthenticationInteractor { - suspend fun createRequestToken(loginViaTmdb: Boolean): Token + suspend fun createRequestToken( + loginViaTmdb: Boolean + ): Token suspend fun createSessionWithLogin( username: Username, @@ -15,7 +17,9 @@ interface AuthenticationInteractor { requestToken: String ): Token - suspend fun createSession(token: String): Session + suspend fun createSession( + token: String + ): Session suspend fun deleteSession() } \ No newline at end of file diff --git a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/Interactor.kt b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/Interactor.kt index 73f6de47e..4b1d96056 100644 --- a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/Interactor.kt +++ b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/Interactor.kt @@ -8,7 +8,8 @@ class Interactor( notificationInteractor: NotificationInteractor, searchInteractor: SearchInteractor, settingsInteractor: SettingsInteractor, - suggestionInteractor: SuggestionInteractor + suggestionInteractor: SuggestionInteractor, + localeInteractor: LocaleInteractor ): AccountInteractor by accountInteractor, AuthenticationInteractor by authenticationInteractor, ImageInteractor by imageInteractor, @@ -16,4 +17,5 @@ class Interactor( NotificationInteractor by notificationInteractor, SearchInteractor by searchInteractor, SettingsInteractor by settingsInteractor, - SuggestionInteractor by suggestionInteractor \ No newline at end of file + SuggestionInteractor by suggestionInteractor, + LocaleInteractor by localeInteractor \ No newline at end of file diff --git a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/LocaleInteractor.kt b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/LocaleInteractor.kt new file mode 100644 index 000000000..d1c9c55d6 --- /dev/null +++ b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/LocaleInteractor.kt @@ -0,0 +1,14 @@ +package org.michaelbel.movies.interactor + +import kotlinx.coroutines.flow.Flow +import org.michaelbel.movies.interactor.entity.AppLanguage + +interface LocaleInteractor { + + val language: String + + val appLanguage: Flow + + suspend fun selectLanguage( + language: AppLanguage) +} \ No newline at end of file diff --git a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/SearchInteractor.kt b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/SearchInteractor.kt index 712f4083e..698d3386c 100644 --- a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/SearchInteractor.kt +++ b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/SearchInteractor.kt @@ -6,5 +6,7 @@ interface SearchInteractor { val isSearchActive: StateFlow - fun setSearchActive(value: Boolean) + fun setSearchActive( + value: Boolean + ) } \ No newline at end of file diff --git a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/di/InteractorKoinModule.kt b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/di/InteractorKoinModule.kt index 1e0bbc256..02994dd07 100644 --- a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/di/InteractorKoinModule.kt +++ b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/di/InteractorKoinModule.kt @@ -9,6 +9,7 @@ import org.michaelbel.movies.interactor.AccountInteractor import org.michaelbel.movies.interactor.AuthenticationInteractor import org.michaelbel.movies.interactor.ImageInteractor import org.michaelbel.movies.interactor.Interactor +import org.michaelbel.movies.interactor.LocaleInteractor import org.michaelbel.movies.interactor.MovieInteractor import org.michaelbel.movies.interactor.NotificationInteractor import org.michaelbel.movies.interactor.SearchInteractor @@ -22,6 +23,7 @@ import org.michaelbel.movies.interactor.impl.NotificationInteractorImpl import org.michaelbel.movies.interactor.impl.SearchInteractorImpl import org.michaelbel.movies.interactor.impl.SettingsInteractorImpl import org.michaelbel.movies.interactor.impl.SuggestionInteractorImpl +import org.michaelbel.movies.interactor.impl.LocaleInteractorImpl import org.michaelbel.movies.persistence.database.di.moviesDatabaseKoinModule import org.michaelbel.movies.repository.di.repositoryKoinModule @@ -32,6 +34,7 @@ val interactorKoinModule = module { moviesDatabaseKoinModule, moviesAnalyticsKoinModule ) + singleOf(::LocaleInteractorImpl) { bind() } singleOf(::AccountInteractorImpl) { bind() } singleOf(::AuthenticationInteractorImpl) { bind() } singleOf(::ImageInteractorImpl) { bind() } @@ -40,5 +43,5 @@ val interactorKoinModule = module { singleOf(::SearchInteractorImpl) { bind() } singleOf(::SettingsInteractorImpl) { bind() } singleOf(::SuggestionInteractorImpl) { bind() } - single { Interactor(get(), get(), get(), get(), get(), get(), get(), get()) } + single { Interactor(get(), get(), get(), get(), get(), get(), get(), get(), get()) } } \ No newline at end of file diff --git a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/model/AppLanguage.kt b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/entity/AppLanguage.kt similarity index 85% rename from core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/model/AppLanguage.kt rename to core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/entity/AppLanguage.kt index 7b156a542..00145bee0 100644 --- a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/model/AppLanguage.kt +++ b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/entity/AppLanguage.kt @@ -1,7 +1,7 @@ -package org.michaelbel.movies.common.localization.model +package org.michaelbel.movies.interactor.entity import org.michaelbel.movies.common.SealedString -import org.michaelbel.movies.common.localization.exceptions.InvalidLocaleException +import org.michaelbel.movies.interactor.exception.InvalidLocaleException sealed interface AppLanguage: SealedString { diff --git a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/exceptions/InvalidLocaleException.kt b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/exception/InvalidLocaleException.kt similarity index 69% rename from core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/exceptions/InvalidLocaleException.kt rename to core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/exception/InvalidLocaleException.kt index 5f85a02e7..de6b6cb2c 100644 --- a/core/common-kmp/src/commonMain/kotlin/org/michaelbel/movies/common/localization/exceptions/InvalidLocaleException.kt +++ b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/exception/InvalidLocaleException.kt @@ -1,4 +1,4 @@ -package org.michaelbel.movies.common.localization.exceptions +package org.michaelbel.movies.interactor.exception internal data object InvalidLocaleException: Exception("Invalid locale") { private fun readResolve(): Any = InvalidLocaleException diff --git a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/AuthenticationInteractorImpl.kt b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/AuthenticationInteractorImpl.kt index ef17064c8..fa3b6b12d 100644 --- a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/AuthenticationInteractorImpl.kt +++ b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/AuthenticationInteractorImpl.kt @@ -14,7 +14,9 @@ internal class AuthenticationInteractorImpl( private val authenticationRepository: AuthenticationRepository ): AuthenticationInteractor { - override suspend fun createRequestToken(loginViaTmdb: Boolean): Token { + override suspend fun createRequestToken( + loginViaTmdb: Boolean + ): Token { return withContext(dispatchers.io) { authenticationRepository.createRequestToken(loginViaTmdb) } } @@ -28,7 +30,9 @@ internal class AuthenticationInteractorImpl( } } - override suspend fun createSession(token: String): Session { + override suspend fun createSession( + token: String + ): Session { return withContext(dispatchers.io) { authenticationRepository.createSession(token) } } diff --git a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/ImageInteractorImpl.kt b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/ImageInteractorImpl.kt index 2bb6e23c8..8572a0877 100644 --- a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/ImageInteractorImpl.kt +++ b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/ImageInteractorImpl.kt @@ -12,11 +12,15 @@ internal class ImageInteractorImpl( private val imageRepository: ImageRepository ): ImageInteractor { - override fun imagesFlow(movieId: Int): Flow> { + override fun imagesFlow( + movieId: Int + ): Flow> { return imageRepository.imagesFlow(movieId) } - override suspend fun images(movieId: Int) { + override suspend fun images( + movieId: Int + ) { return withContext(dispatchers.io) { imageRepository.images(movieId) } } } \ No newline at end of file diff --git a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/LocaleInteractorImpl.kt b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/LocaleInteractorImpl.kt new file mode 100644 index 000000000..7be9b49d5 --- /dev/null +++ b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/LocaleInteractorImpl.kt @@ -0,0 +1,17 @@ +@file:Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") + +package org.michaelbel.movies.interactor.impl + +import kotlinx.coroutines.flow.Flow +import org.michaelbel.movies.interactor.entity.AppLanguage + +internal expect class LocaleInteractorImpl { + + val language: String + + val appLanguage: Flow + + suspend fun selectLanguage( + language: AppLanguage + ) +} \ No newline at end of file diff --git a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/MovieInteractorImpl.kt b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/MovieInteractorImpl.kt index ad794cfe9..fdb779c39 100644 --- a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/MovieInteractorImpl.kt +++ b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/MovieInteractorImpl.kt @@ -11,6 +11,7 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.withContext import org.michaelbel.movies.common.dispatchers.MoviesDispatchers import org.michaelbel.movies.common.list.MovieList +import org.michaelbel.movies.interactor.LocaleInteractor import org.michaelbel.movies.interactor.MovieInteractor import org.michaelbel.movies.interactor.ktx.nameOrLocalList import org.michaelbel.movies.interactor.remote.FeedMoviesRemoteMediator @@ -25,19 +26,23 @@ import org.michaelbel.movies.repository.SearchRepository internal class MovieInteractorImpl( private val dispatchers: MoviesDispatchers, + private val localeInteractor: LocaleInteractor, private val searchRepository: SearchRepository, private val movieRepository: MovieRepository, private val pagingKeyRepository: PagingKeyRepository, private val moviesDatabase: MoviesDatabase ): MovieInteractor { - override fun moviesPagingData(movieList: MovieList): Flow> { + override fun moviesPagingData( + movieList: MovieList + ): Flow> { return Pager( config = PagingConfig( pageSize = MovieResponse.DEFAULT_PAGE_SIZE, enablePlaceholders = true ), remoteMediator = FeedMoviesRemoteMediator( + localeInteractor = localeInteractor, movieRepository = movieRepository, pagingKeyRepository = pagingKeyRepository, moviesDatabase = moviesDatabase, @@ -47,13 +52,16 @@ internal class MovieInteractorImpl( ).flow } - override fun moviesPagingData(searchQuery: String): Flow> { + override fun moviesPagingData( + searchQuery: String + ): Flow> { return Pager( config = PagingConfig( pageSize = MovieResponse.DEFAULT_PAGE_SIZE, enablePlaceholders = true ), remoteMediator = SearchMoviesRemoteMediator( + localeInteractor = localeInteractor, pagingKeyRepository = pagingKeyRepository, searchRepository = searchRepository, movieRepository = movieRepository, @@ -64,39 +72,62 @@ internal class MovieInteractorImpl( ).flow } - override fun moviesPagingSource(pagingKey: String): PagingSource { + override fun moviesPagingSource( + pagingKey: String + ): PagingSource { return movieRepository.moviesPagingSource(pagingKey) } - override fun moviesFlow(pagingKey: String, limit: Int): Flow> { + override fun moviesFlow( + pagingKey: String, + limit: Int + ): Flow> { return movieRepository.moviesFlow(pagingKey, limit) } override suspend fun moviesWidget(): List { - return withContext(dispatchers.io) { movieRepository.moviesWidget() } + return withContext(dispatchers.io) { movieRepository.moviesWidget(localeInteractor.language) } } - override suspend fun movie(pagingKey: String, movieId: Int): MoviePojo { + override suspend fun movie( + pagingKey: String, + movieId: Int + ): MoviePojo { return withContext(dispatchers.io) { movieRepository.movie(pagingKey, movieId) } } - override suspend fun movieDetails(pagingKey: String, movieId: Int): MoviePojo { - return withContext(dispatchers.io) { movieRepository.movieDetails(pagingKey, movieId) } + override suspend fun movieDetails( + pagingKey: String, + movieId: Int + ): MoviePojo { + return withContext(dispatchers.io) { movieRepository.movieDetails(pagingKey, localeInteractor.language, movieId) } } - override suspend fun removeMovies(pagingKey: String) { + override suspend fun removeMovies( + pagingKey: String + ) { return withContext(dispatchers.io) { movieRepository.removeMovies(pagingKey) } } - override suspend fun removeMovie(pagingKey: String, movieId: Int) { + override suspend fun removeMovie( + pagingKey: String, + movieId: Int + ) { return withContext(dispatchers.io) { movieRepository.removeMovie(pagingKey, movieId) } } - override suspend fun insertMovie(pagingKey: String, movie: MoviePojo) { + override suspend fun insertMovie( + pagingKey: String, + movie: MoviePojo + ) { return withContext(dispatchers.io) { movieRepository.insertMovie(pagingKey, movie) } } - override suspend fun updateMovieColors(movieId: Int, containerColor: Int, onContainerColor: Int) { + override suspend fun updateMovieColors( + movieId: Int, + containerColor: Int, + onContainerColor: Int + ) { return withContext(dispatchers.io) { movieRepository.updateMovieColors(movieId, containerColor, onContainerColor) } diff --git a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/SearchInteractorImpl.kt b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/SearchInteractorImpl.kt index 9a1672c9a..b6f550727 100644 --- a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/SearchInteractorImpl.kt +++ b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/SearchInteractorImpl.kt @@ -12,7 +12,9 @@ internal class SearchInteractorImpl: SearchInteractor { override val isSearchActive: StateFlow get() = isActiveMutableFlow.asStateFlow() - override fun setSearchActive(value: Boolean) { + override fun setSearchActive( + value: Boolean + ) { isActiveMutableFlow.value = value } } \ No newline at end of file diff --git a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/SettingsInteractorImpl.kt b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/SettingsInteractorImpl.kt index bd12ea2d1..18e453836 100644 --- a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/SettingsInteractorImpl.kt +++ b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/SettingsInteractorImpl.kt @@ -37,53 +37,69 @@ internal class SettingsInteractorImpl( return settingsRepository.isBiometricEnabledAsync() } - override suspend fun selectTheme(appTheme: AppTheme) { + override suspend fun selectTheme( + appTheme: AppTheme + ) { withContext(dispatchers.main) { settingsRepository.selectTheme(appTheme) analytics.logEvent(SelectThemeEvent(appTheme.toString())) } } - override suspend fun selectFeedView(feedView: FeedView) { + override suspend fun selectFeedView( + feedView: FeedView + ) { withContext(dispatchers.main) { settingsRepository.selectFeedView(feedView) analytics.logEvent(SelectFeedViewEvent(feedView.toString())) } } - override suspend fun selectMovieList(movieList: MovieList) { + override suspend fun selectMovieList( + movieList: MovieList + ) { withContext(dispatchers.main) { settingsRepository.selectMovieList(movieList) analytics.logEvent(SelectMovieListEvent(movieList.toString())) } } - override suspend fun setDynamicColors(value: Boolean) { + override suspend fun setDynamicColors( + value: Boolean + ) { withContext(dispatchers.main) { settingsRepository.setDynamicColors(value) analytics.logEvent(ChangeDynamicColorsEvent(value)) } } - override suspend fun setPaletteKey(paletteKey: Int) { + override suspend fun setPaletteKey( + paletteKey: Int + ) { withContext(dispatchers.main) { settingsRepository.setPaletteKey(paletteKey) } } - override suspend fun setSeedColor(seedColor: Int) { + override suspend fun setSeedColor( + seedColor: Int + ) { withContext(dispatchers.main) { settingsRepository.setSeedColor(seedColor) } } - override suspend fun setBiometricEnabled(enabled: Boolean) { + override suspend fun setBiometricEnabled( + enabled: Boolean + ) { withContext(dispatchers.main) { settingsRepository.setBiometricEnabled(enabled) } } - override suspend fun setScreenshotBlockEnabled(enabled: Boolean) { + override suspend fun setScreenshotBlockEnabled( + enabled: Boolean + ) { withContext(dispatchers.main) { settingsRepository.setScreenshotBlockEnabled(enabled) } diff --git a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/SuggestionInteractorImpl.kt b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/SuggestionInteractorImpl.kt index a74d61b94..54fbf4862 100644 --- a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/SuggestionInteractorImpl.kt +++ b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/SuggestionInteractorImpl.kt @@ -3,12 +3,14 @@ package org.michaelbel.movies.interactor.impl import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.withContext import org.michaelbel.movies.common.dispatchers.MoviesDispatchers +import org.michaelbel.movies.interactor.LocaleInteractor import org.michaelbel.movies.interactor.SuggestionInteractor import org.michaelbel.movies.persistence.database.entity.SuggestionPojo import org.michaelbel.movies.repository.SuggestionRepository internal class SuggestionInteractorImpl( private val dispatchers: MoviesDispatchers, + private val localeInteractor: LocaleInteractor, private val suggestionRepository: SuggestionRepository ): SuggestionInteractor { @@ -17,6 +19,6 @@ internal class SuggestionInteractorImpl( } override suspend fun updateSuggestions() { - withContext(dispatchers.io) { suggestionRepository.updateSuggestions() } + withContext(dispatchers.io) { suggestionRepository.updateSuggestions(localeInteractor.language) } } } \ No newline at end of file diff --git a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/remote/FeedMoviesRemoteMediator.kt b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/remote/FeedMoviesRemoteMediator.kt index 28d2714d7..13900aea1 100644 --- a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/remote/FeedMoviesRemoteMediator.kt +++ b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/remote/FeedMoviesRemoteMediator.kt @@ -7,6 +7,7 @@ import androidx.paging.LoadType import androidx.paging.PagingState import androidx.paging.RemoteMediator import org.michaelbel.movies.common.exceptions.PageEmptyException +import org.michaelbel.movies.interactor.LocaleInteractor import org.michaelbel.movies.network.ktx.isEmpty import org.michaelbel.movies.network.ktx.isPaginationReached import org.michaelbel.movies.network.ktx.nextPage @@ -16,6 +17,7 @@ import org.michaelbel.movies.repository.MovieRepository import org.michaelbel.movies.repository.PagingKeyRepository class FeedMoviesRemoteMediator( + private val localeInteractor: LocaleInteractor, private val pagingKeyRepository: PagingKeyRepository, private val movieRepository: MovieRepository, private val moviesDatabase: MoviesDatabase, @@ -33,7 +35,7 @@ class FeedMoviesRemoteMediator( LoadType.APPEND -> pagingKeyRepository.page(movieList) } ?: return MediatorResult.Success(endOfPaginationReached = true) - val moviesResult = movieRepository.moviesResult(movieList, loadKey) + val moviesResult = movieRepository.moviesResult(movieList, localeInteractor.language, loadKey) moviesDatabase.withTransaction { if (loadType == LoadType.REFRESH) { diff --git a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/remote/SearchMoviesRemoteMediator.kt b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/remote/SearchMoviesRemoteMediator.kt index 8bb6e8c83..b892e5374 100644 --- a/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/remote/SearchMoviesRemoteMediator.kt +++ b/core/interactor-kmp/src/commonMain/kotlin/org/michaelbel/movies/interactor/remote/SearchMoviesRemoteMediator.kt @@ -7,6 +7,7 @@ import androidx.paging.LoadType import androidx.paging.PagingState import androidx.paging.RemoteMediator import org.michaelbel.movies.common.exceptions.PageEmptyException +import org.michaelbel.movies.interactor.LocaleInteractor import org.michaelbel.movies.network.ktx.isEmpty import org.michaelbel.movies.network.ktx.isPaginationReached import org.michaelbel.movies.network.ktx.nextPage @@ -17,6 +18,7 @@ import org.michaelbel.movies.repository.PagingKeyRepository import org.michaelbel.movies.repository.SearchRepository class SearchMoviesRemoteMediator( + private val localeInteractor: LocaleInteractor, private val pagingKeyRepository: PagingKeyRepository, private val movieRepository: MovieRepository, private val searchRepository: SearchRepository, @@ -39,7 +41,7 @@ class SearchMoviesRemoteMediator( throw PageEmptyException } - val moviesResult = searchRepository.searchMoviesResult(query, loadKey) + val moviesResult = searchRepository.searchMoviesResult(query, localeInteractor.language, loadKey) moviesDatabase.withTransaction { if (loadType == LoadType.REFRESH) { diff --git a/core/common-kmp/src/desktopMain/kotlin/org/michaelbel/movies/common/localization/impl/LocaleControllerImpl.kt b/core/interactor-kmp/src/desktopMain/kotlin/org/michaelbel/movies/interactor/impl/LocaleInteractorImpl.kt similarity index 70% rename from core/common-kmp/src/desktopMain/kotlin/org/michaelbel/movies/common/localization/impl/LocaleControllerImpl.kt rename to core/interactor-kmp/src/desktopMain/kotlin/org/michaelbel/movies/interactor/impl/LocaleInteractorImpl.kt index 8b23bb946..5ddbcc720 100644 --- a/core/common-kmp/src/desktopMain/kotlin/org/michaelbel/movies/common/localization/impl/LocaleControllerImpl.kt +++ b/core/interactor-kmp/src/desktopMain/kotlin/org/michaelbel/movies/interactor/impl/LocaleInteractorImpl.kt @@ -1,17 +1,17 @@ @file:Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") -package org.michaelbel.movies.common.localization.impl +package org.michaelbel.movies.interactor.impl import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.withContext import org.michaelbel.movies.common.dispatchers.MoviesDispatchers -import org.michaelbel.movies.common.localization.LocaleController -import org.michaelbel.movies.common.localization.model.AppLanguage +import org.michaelbel.movies.interactor.LocaleInteractor +import org.michaelbel.movies.interactor.entity.AppLanguage -internal actual class LocaleControllerImpl( +internal actual class LocaleInteractorImpl( private val dispatchers: MoviesDispatchers -): LocaleController { +): LocaleInteractor { actual override val language: String get() = AppLanguage.English().code diff --git a/core/navigation-kmp/build.gradle.kts b/core/navigation-kmp/build.gradle.kts index 3c44e83f8..38e66c8e7 100644 --- a/core/navigation-kmp/build.gradle.kts +++ b/core/navigation-kmp/build.gradle.kts @@ -15,7 +15,11 @@ kotlin { sourceSets { androidMain.dependencies { - api(libs.androidx.navigation.compose) + api(libs.bundles.navigation.android) + } + val desktopMain by getting + desktopMain.dependencies { + api(libs.bundles.precompose.desktop) } } } diff --git a/core/network-kmp/build.gradle.kts b/core/network-kmp/build.gradle.kts index 7d3ff07a5..df1c611e9 100644 --- a/core/network-kmp/build.gradle.kts +++ b/core/network-kmp/build.gradle.kts @@ -24,15 +24,15 @@ kotlin { sourceSets { commonMain.dependencies { - implementation(libs.kotlinx.serialization.json) + implementation(libs.bundles.kotlinx.serialization.common) implementation(libs.bundles.ktor.common) implementation(libs.bundles.koin.common) } androidMain.dependencies { implementation(libs.bundles.ktor.android) - implementation(libs.androidx.startup.runtime) - implementation(libs.okhttp.logging.interceptor) - implementation(libs.koin.android) + implementation(libs.bundles.startup.android) + implementation(libs.bundles.okhttp.logging.interceptor.android) + implementation(libs.bundles.koin.android) } } } @@ -60,13 +60,13 @@ android { } dependencies { - debugImplementation(libs.chucker.library) { + debugImplementation(libs.bundles.chucker.library.android) { exclude(group = "androidx.constraintlayout") } - releaseImplementation(libs.chucker.library.no.op) { + releaseImplementation(libs.bundles.chucker.library.no.op.android) { exclude(group = "androidx.constraintlayout") } - debugImplementation(libs.flaker.android.okhttp) - releaseImplementation(libs.flaker.android.okhttp.noop) + debugImplementation(libs.bundles.flaker.android) + releaseImplementation(libs.bundles.flaker.noop.android) } } \ No newline at end of file diff --git a/core/notifications-kmp/build.gradle.kts b/core/notifications-kmp/build.gradle.kts index 696de2214..300d532d6 100644 --- a/core/notifications-kmp/build.gradle.kts +++ b/core/notifications-kmp/build.gradle.kts @@ -21,7 +21,7 @@ kotlin { implementation(libs.bundles.koin.common) } androidMain.dependencies { - implementation(libs.koin.android) + implementation(libs.bundles.koin.android) } } } diff --git a/core/persistence-kmp/build.gradle.kts b/core/persistence-kmp/build.gradle.kts index 3468ad17f..ac42c35c5 100644 --- a/core/persistence-kmp/build.gradle.kts +++ b/core/persistence-kmp/build.gradle.kts @@ -25,8 +25,8 @@ kotlin { } androidMain.dependencies { implementation(libs.bundles.datastore.android) - implementation(libs.bundles.androidx.room) - implementation(libs.koin.android) + implementation(libs.bundles.room.android) + implementation(libs.bundles.koin.android) } val desktopMain by getting desktopMain.dependencies { @@ -56,6 +56,6 @@ android { } dependencies { - ksp(libs.androidx.room.compiler) + ksp(libs.bundles.room.compiler.android) } } \ No newline at end of file diff --git a/core/platform-services/gms-kmp/build.gradle.kts b/core/platform-services/gms-kmp/build.gradle.kts index b919b269b..7860fb56d 100644 --- a/core/platform-services/gms-kmp/build.gradle.kts +++ b/core/platform-services/gms-kmp/build.gradle.kts @@ -20,10 +20,10 @@ kotlin { implementation(libs.bundles.koin.common) } androidMain.dependencies { - api(libs.bundles.google.firebase) - api(libs.bundles.google.services) - api(libs.google.play.core.ktx) - implementation(libs.koin.android) + api(libs.bundles.google.firebase.android) + api(libs.bundles.google.services.android) + api(libs.bundles.google.play.core.android) + implementation(libs.bundles.koin.android) } } } diff --git a/core/platform-services/inject-kmp/build.gradle.kts b/core/platform-services/inject-kmp/build.gradle.kts index 609a8bc37..7e047f897 100644 --- a/core/platform-services/inject-kmp/build.gradle.kts +++ b/core/platform-services/inject-kmp/build.gradle.kts @@ -19,7 +19,7 @@ kotlin { implementation(libs.bundles.koin.common) } androidMain.dependencies { - implementation(libs.koin.android) + implementation(libs.bundles.koin.android) } } } diff --git a/core/repository-kmp/build.gradle.kts b/core/repository-kmp/build.gradle.kts index bc5bd348d..dcd0953f0 100644 --- a/core/repository-kmp/build.gradle.kts +++ b/core/repository-kmp/build.gradle.kts @@ -23,7 +23,7 @@ kotlin { implementation(libs.bundles.koin.common) } androidMain.dependencies { - implementation(libs.koin.android) + implementation(libs.bundles.koin.android) } } } diff --git a/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/MovieRepository.kt b/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/MovieRepository.kt index 8033c8432..c038dd730 100644 --- a/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/MovieRepository.kt +++ b/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/MovieRepository.kt @@ -20,6 +20,7 @@ interface MovieRepository { suspend fun moviesResult( movieList: String, + language: String, page: Int ): Result @@ -30,10 +31,13 @@ interface MovieRepository { suspend fun movieDetails( pagingKey: String, + language: String, movieId: Int ): MoviePojo - suspend fun moviesWidget(): List + suspend fun moviesWidget( + language: String + ): List suspend fun removeMovies( pagingKey: String diff --git a/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/SearchRepository.kt b/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/SearchRepository.kt index 93ffe6939..f1c2ad527 100644 --- a/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/SearchRepository.kt +++ b/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/SearchRepository.kt @@ -7,6 +7,7 @@ interface SearchRepository { suspend fun searchMoviesResult( query: String, + language: String, page: Int ): Result } \ No newline at end of file diff --git a/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/SuggestionRepository.kt b/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/SuggestionRepository.kt index 31b5ffc97..48bba64d4 100644 --- a/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/SuggestionRepository.kt +++ b/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/SuggestionRepository.kt @@ -7,5 +7,7 @@ interface SuggestionRepository { fun suggestions(): Flow> - suspend fun updateSuggestions() + suspend fun updateSuggestions( + language: String + ) } \ No newline at end of file diff --git a/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/di/RepositoryKoinModule.kt b/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/di/RepositoryKoinModule.kt index 0e02451b9..bede2c07e 100644 --- a/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/di/RepositoryKoinModule.kt +++ b/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/di/RepositoryKoinModule.kt @@ -3,7 +3,6 @@ package org.michaelbel.movies.repository.di import org.koin.core.module.dsl.bind import org.koin.core.module.dsl.singleOf import org.koin.dsl.module -import org.michaelbel.movies.common.localization.di.localeKoinModule import org.michaelbel.movies.network.di.networkKoinModule import org.michaelbel.movies.persistence.database.di.persistenceKoinModule import org.michaelbel.movies.persistence.datastore.di.moviesPreferencesKoinModule @@ -31,7 +30,6 @@ val repositoryKoinModule = module { networkKoinModule, persistenceKoinModule, moviesPreferencesKoinModule, - localeKoinModule ) singleOf(::AccountRepositoryImpl) { bind() } singleOf(::AuthenticationRepositoryImpl) { bind() } diff --git a/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/MovieRepositoryImpl.kt b/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/MovieRepositoryImpl.kt index be47ec775..16794cb9b 100644 --- a/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/MovieRepositoryImpl.kt +++ b/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/MovieRepositoryImpl.kt @@ -5,7 +5,6 @@ import kotlinx.coroutines.flow.Flow import org.michaelbel.movies.common.exceptions.MovieDetailsException import org.michaelbel.movies.common.exceptions.MoviesUpcomingException import org.michaelbel.movies.common.list.MovieList -import org.michaelbel.movies.common.localization.LocaleController import org.michaelbel.movies.network.MovieNetworkService import org.michaelbel.movies.network.config.isTmdbApiKeyEmpty import org.michaelbel.movies.network.model.MovieResponse @@ -20,47 +19,64 @@ import org.michaelbel.movies.repository.ktx.checkApiKeyNotNullException internal class MovieRepositoryImpl( private val movieNetworkService: MovieNetworkService, - private val moviePersistence: MoviePersistence, - private val localeController: LocaleController + private val moviePersistence: MoviePersistence ): MovieRepository { - override fun moviesPagingSource(pagingKey: String): PagingSource { + override fun moviesPagingSource( + pagingKey: String + ): PagingSource { return moviePersistence.pagingSource(pagingKey) } - override fun moviesFlow(pagingKey: String, limit: Int): Flow> { + override fun moviesFlow( + pagingKey: String, + limit: Int + ): Flow> { return moviePersistence.moviesFlow(pagingKey, limit) } - override suspend fun moviesResult(movieList: String, page: Int): Result { + override suspend fun moviesResult( + movieList: String, + language: String, + page: Int + ): Result { if (isTmdbApiKeyEmpty && moviePersistence.isEmpty(MoviePojo.MOVIES_LOCAL_LIST)) { checkApiKeyNotNullException() } return movieNetworkService.movies( list = movieList, - language = localeController.language, + language = language, page = page ) } - override suspend fun movie(pagingKey: String, movieId: Int): MoviePojo { + override suspend fun movie( + pagingKey: String, + movieId: Int + ): MoviePojo { return moviePersistence.movieById(pagingKey, movieId).orEmpty } - override suspend fun movieDetails(pagingKey: String, movieId: Int): MoviePojo { + override suspend fun movieDetails( + pagingKey: String, + language: String, + movieId: Int + ): MoviePojo { return try { - moviePersistence.movieById(pagingKey, movieId) ?: movieNetworkService.movie(movieId, localeController.language).moviePojo + moviePersistence.movieById(pagingKey, movieId) ?: movieNetworkService.movie(movieId, language).moviePojo } catch (ignored: Exception) { throw MovieDetailsException } } - override suspend fun moviesWidget(): List { + override suspend fun moviesWidget( + language: String + ): List { return try { val movieResult = movieNetworkService.movies( list = MovieList.Upcoming().name, - language = localeController.language, + language = language, page = 1 ) val moviesDb = movieResult.results.mapIndexed { index, movieResponse -> @@ -79,7 +95,9 @@ internal class MovieRepositoryImpl( } } - override suspend fun removeMovies(pagingKey: String) { + override suspend fun removeMovies( + pagingKey: String + ) { moviePersistence.removeMovies(pagingKey) } @@ -87,7 +105,11 @@ internal class MovieRepositoryImpl( moviePersistence.removeMovie(pagingKey, movieId) } - override suspend fun insertMovies(pagingKey: String, page: Int, movies: List) { + override suspend fun insertMovies( + pagingKey: String, + page: Int, + movies: List + ) { val maxPosition = moviePersistence.maxPosition(pagingKey) ?: 0 val moviesDb = movies.mapIndexed { index, movieResponse -> movieResponse.moviePojo( @@ -99,7 +121,10 @@ internal class MovieRepositoryImpl( moviePersistence.insertMovies(moviesDb) } - override suspend fun insertMovie(pagingKey: String, movie: MoviePojo) { + override suspend fun insertMovie( + pagingKey: String, + movie: MoviePojo + ) { val maxPosition = moviePersistence.maxPosition(pagingKey) ?: 0 moviePersistence.insertMovie( movie.copy( @@ -110,7 +135,11 @@ internal class MovieRepositoryImpl( ) } - override suspend fun updateMovieColors(movieId: Int, containerColor: Int, onContainerColor: Int) { + override suspend fun updateMovieColors( + movieId: Int, + containerColor: Int, + onContainerColor: Int + ) { moviePersistence.updateMovieColors(movieId, containerColor, onContainerColor) } } \ No newline at end of file diff --git a/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/PagingKeyRepositoryImpl.kt b/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/PagingKeyRepositoryImpl.kt index d1635cae5..96a574700 100644 --- a/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/PagingKeyRepositoryImpl.kt +++ b/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/PagingKeyRepositoryImpl.kt @@ -8,23 +8,35 @@ internal class PagingKeyRepositoryImpl( private val pagingKeyPersistence: PagingKeyPersistence ): PagingKeyRepository { - override suspend fun page(pagingKey: String): Int? { + override suspend fun page( + pagingKey: String + ): Int? { return pagingKeyPersistence.page(pagingKey) } - override suspend fun totalPages(pagingKey: String): Int? { + override suspend fun totalPages( + pagingKey: String + ): Int? { return pagingKeyPersistence.totalPages(pagingKey) } - override suspend fun prevPage(pagingKey: String): Int? { + override suspend fun prevPage( + pagingKey: String + ): Int? { return null } - override suspend fun removePagingKey(pagingKey: String) { + override suspend fun removePagingKey( + pagingKey: String + ) { pagingKeyPersistence.removePagingKey(pagingKey) } - override suspend fun insertPagingKey(pagingKey: String, page: Int, totalPages: Int) { + override suspend fun insertPagingKey( + pagingKey: String, + page: Int, + totalPages: Int + ) { pagingKeyPersistence.insertPagingKey( PagingKeyPojo( pagingKey = pagingKey, diff --git a/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/SearchRepositoryImpl.kt b/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/SearchRepositoryImpl.kt index 2c804e118..a76e5a71e 100644 --- a/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/SearchRepositoryImpl.kt +++ b/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/SearchRepositoryImpl.kt @@ -1,6 +1,5 @@ package org.michaelbel.movies.repository.impl -import org.michaelbel.movies.common.localization.LocaleController import org.michaelbel.movies.network.SearchNetworkService import org.michaelbel.movies.network.config.isTmdbApiKeyEmpty import org.michaelbel.movies.network.model.MovieResponse @@ -9,18 +8,21 @@ import org.michaelbel.movies.repository.SearchRepository import org.michaelbel.movies.repository.ktx.checkApiKeyNotNullException internal class SearchRepositoryImpl( - private val searchNetworkService: SearchNetworkService, - private val localeController: LocaleController + private val searchNetworkService: SearchNetworkService ): SearchRepository { - override suspend fun searchMoviesResult(query: String, page: Int): Result { + override suspend fun searchMoviesResult( + query: String, + language: String, + page: Int + ): Result { if (isTmdbApiKeyEmpty) { checkApiKeyNotNullException() } return searchNetworkService.searchMovies( query = query, - language = localeController.language, + language = language, page = page ) } diff --git a/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/SettingsRepositoryImpl.kt b/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/SettingsRepositoryImpl.kt index 421751298..b09fefe83 100644 --- a/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/SettingsRepositoryImpl.kt +++ b/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/SettingsRepositoryImpl.kt @@ -56,35 +56,51 @@ internal class SettingsRepositoryImpl( return preferences.isBiometricEnabledAsync() } - override suspend fun selectTheme(appTheme: AppTheme) { + override suspend fun selectTheme( + appTheme: AppTheme + ) { preferences.setTheme(appTheme.toString()) } - override suspend fun selectFeedView(feedView: FeedView) { + override suspend fun selectFeedView( + feedView: FeedView + ) { preferences.setFeedView(feedView.toString()) } - override suspend fun selectMovieList(movieList: MovieList) { + override suspend fun selectMovieList( + movieList: MovieList + ) { preferences.setMovieList(movieList.toString()) } - override suspend fun setDynamicColors(value: Boolean) { + override suspend fun setDynamicColors( + value: Boolean + ) { preferences.setDynamicColors(value) } - override suspend fun setPaletteKey(paletteKey: Int) { + override suspend fun setPaletteKey( + paletteKey: Int + ) { preferences.setPaletteKey(paletteKey) } - override suspend fun setSeedColor(seedColor: Int) { + override suspend fun setSeedColor( + seedColor: Int + ) { preferences.setSeedColor(seedColor) } - override suspend fun setBiometricEnabled(enabled: Boolean) { + override suspend fun setBiometricEnabled( + enabled: Boolean + ) { preferences.setBiometricEnabled(enabled) } - override suspend fun setScreenshotBlockEnabled(enabled: Boolean) { + override suspend fun setScreenshotBlockEnabled( + enabled: Boolean + ) { preferences.setScreenshotBlockEnabled(enabled) } } \ No newline at end of file diff --git a/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/SuggestionRepositoryImpl.kt b/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/SuggestionRepositoryImpl.kt index e017e931f..4c4919b1d 100644 --- a/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/SuggestionRepositoryImpl.kt +++ b/core/repository-kmp/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/SuggestionRepositoryImpl.kt @@ -1,7 +1,6 @@ package org.michaelbel.movies.repository.impl import kotlinx.coroutines.flow.Flow -import org.michaelbel.movies.common.localization.LocaleController import org.michaelbel.movies.network.MovieNetworkService import org.michaelbel.movies.network.model.Movie import org.michaelbel.movies.persistence.database.MoviePersistence @@ -12,15 +11,16 @@ import org.michaelbel.movies.repository.SuggestionRepository internal class SuggestionRepositoryImpl( private val movieNetworkService: MovieNetworkService, private val moviePersistence: MoviePersistence, - private val suggestionPersistence: SuggestionPersistence, - private val localeController: LocaleController + private val suggestionPersistence: SuggestionPersistence ): SuggestionRepository { override fun suggestions(): Flow> { return suggestionPersistence.suggestionsFlow() } - override suspend fun updateSuggestions() { + override suspend fun updateSuggestions( + language: String + ) { suggestionPersistence.removeAll() val nowPlayingMovies = moviePersistence.movies(Movie.NOW_PLAYING, 5) @@ -29,7 +29,7 @@ internal class SuggestionRepositoryImpl( } else { val movieResponse = movieNetworkService.movies( list = Movie.NOW_PLAYING, - language = localeController.language, + language = language, page = 1 ).results.take(5) suggestionPersistence.insert(movieResponse.map { movie -> SuggestionPojo(movie.title) }) diff --git a/core/ui-kmp/build.gradle.kts b/core/ui-kmp/build.gradle.kts index 2291c304d..dd2f2a22a 100644 --- a/core/ui-kmp/build.gradle.kts +++ b/core/ui-kmp/build.gradle.kts @@ -40,11 +40,11 @@ kotlin { implementation(compose.uiTooling) } androidMain.dependencies { - api(libs.androidx.core.splashscreen) - api(libs.androidx.palette.ktx) - api(libs.coil.compose) - api(libs.bundles.androidx.compose) - api(libs.bundles.google.material) + api(libs.bundles.core.splashscreen.android) + api(libs.bundles.palette.android) + api(libs.bundles.coil.android) + api(libs.bundles.compose.android) + api(libs.bundles.google.material.android) } } } diff --git a/core/ui-kmp/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/ActivityKtx.kt b/core/ui-kmp/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/ActivityKtx.kt index 60d8fab65..778d2bac5 100644 --- a/core/ui-kmp/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/ActivityKtx.kt +++ b/core/ui-kmp/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/ActivityKtx.kt @@ -3,23 +3,16 @@ package org.michaelbel.movies.ui.ktx import android.app.Activity import android.os.Build -private val screenCaptureCallback: Any - get() { - return if (Build.VERSION.SDK_INT >= 34) { - Activity.ScreenCaptureCallback {} - } else { - Unit - } - } - -fun Activity.supportRegisterScreenCaptureCallback() { +fun Activity.supportRegisterScreenCaptureCallback(screenCaptureCallback: Any) { if (Build.VERSION.SDK_INT >= 34) { registerScreenCaptureCallback(mainExecutor, screenCaptureCallback as Activity.ScreenCaptureCallback) } } -fun Activity.supportUnregisterScreenCaptureCallback() { +fun Activity.supportUnregisterScreenCaptureCallback(screenCaptureCallback: Any) { if (Build.VERSION.SDK_INT >= 34) { - unregisterScreenCaptureCallback(screenCaptureCallback as Activity.ScreenCaptureCallback) + try { + unregisterScreenCaptureCallback(screenCaptureCallback as Activity.ScreenCaptureCallback) + } catch (_: Exception) {} } } \ No newline at end of file diff --git a/core/ui-kmp/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/LanguagePreviewParameterProvider.kt b/core/ui-kmp/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/LanguagePreviewParameterProvider.kt deleted file mode 100644 index 29811b7b4..000000000 --- a/core/ui-kmp/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/LanguagePreviewParameterProvider.kt +++ /dev/null @@ -1,6 +0,0 @@ -package org.michaelbel.movies.ui.preview.provider - -import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider -import org.michaelbel.movies.common.localization.model.AppLanguage - -class LanguagePreviewParameterProvider: CollectionPreviewParameterProvider(AppLanguage.VALUES) \ No newline at end of file diff --git a/core/widget-kmp/build.gradle.kts b/core/widget-kmp/build.gradle.kts index 9fc687461..d3f577af4 100644 --- a/core/widget-kmp/build.gradle.kts +++ b/core/widget-kmp/build.gradle.kts @@ -20,14 +20,14 @@ kotlin { implementation(project(":core:common-kmp")) implementation(project(":core:ui-kmp")) implementation(project(":core:work-kmp")) + implementation(libs.bundles.kotlinx.serialization.common) implementation(libs.bundles.datastore.common) implementation(libs.bundles.koin.common) } androidMain.dependencies { implementation(libs.bundles.datastore.android) - implementation(libs.bundles.androidx.glance) - implementation(libs.kotlinx.serialization.json) - implementation(libs.bundles.koin.android) + implementation(libs.bundles.glance.android) + implementation(libs.bundles.koin.compose.work.android) } } } diff --git a/core/work-kmp/build.gradle.kts b/core/work-kmp/build.gradle.kts index fafff4dde..c6a556425 100644 --- a/core/work-kmp/build.gradle.kts +++ b/core/work-kmp/build.gradle.kts @@ -20,14 +20,13 @@ kotlin { implementation(project(":core:network-kmp")) implementation(project(":core:notifications-kmp")) implementation(project(":core:persistence-kmp")) + implementation(libs.bundles.kotlinx.serialization.common) implementation(libs.bundles.paging.common) implementation(libs.bundles.koin.common) } androidMain.dependencies { - implementation(libs.kotlinx.serialization.json) - implementation(libs.androidx.work.runtime.ktx) - implementation(libs.koin.android) - implementation(libs.koin.androidx.workmanager) + implementation(libs.bundles.work.android) + implementation(libs.bundles.koin.work.android) } } } diff --git a/desktopApp/build.gradle.kts b/desktopApp/build.gradle.kts index cd3287378..e2f4d6762 100755 --- a/desktopApp/build.gradle.kts +++ b/desktopApp/build.gradle.kts @@ -27,7 +27,6 @@ kotlin { implementation(compose.material) implementation(compose.material3) implementation(compose.components.resources) - implementation(libs.precompose) } } } diff --git a/desktopApp/src/jvmMain/kotlin/org/michaelbel/movies/MoviesDesktop.kt b/desktopApp/src/jvmMain/kotlin/org/michaelbel/movies/MoviesDesktop.kt index fcd937415..1135b1713 100644 --- a/desktopApp/src/jvmMain/kotlin/org/michaelbel/movies/MoviesDesktop.kt +++ b/desktopApp/src/jvmMain/kotlin/org/michaelbel/movies/MoviesDesktop.kt @@ -2,6 +2,7 @@ package org.michaelbel.movies import androidx.compose.ui.window.singleWindowApplication import moe.tlaster.precompose.PreComposeApp +import org.michaelbel.movies.common.ThemeData import org.michaelbel.movies.common.theme.AppTheme import org.michaelbel.movies.ui.theme.MoviesTheme @@ -11,8 +12,13 @@ fun main() = singleWindowApplication( ) { PreComposeApp { MoviesTheme( + themeData = ThemeData( + appTheme = AppTheme.FollowSystem, + dynamicColors = false, + paletteKey = 0, + seedColor = 0 + ), theme = AppTheme.FollowSystem, - dynamicColors = false, enableEdgeToEdge = { _,_ -> } ) { MainWindowContent() diff --git a/feature/account-impl-kmp/build.gradle.kts b/feature/account-impl-kmp/build.gradle.kts index f8a7b5344..f444f174d 100644 --- a/feature/account-impl-kmp/build.gradle.kts +++ b/feature/account-impl-kmp/build.gradle.kts @@ -23,10 +23,9 @@ kotlin { sourceSets { commonMain.dependencies { api(project(":core:navigation-kmp")) - api(project(":core:ui-kmp")) + implementation(project(":core:ui-kmp")) implementation(project(":core:common-kmp")) implementation(project(":core:interactor-kmp")) - implementation(project(":core:network-kmp")) implementation(compose.components.resources) implementation(compose.foundation) implementation(compose.material3) @@ -35,9 +34,8 @@ kotlin { implementation(libs.bundles.koin.common) } androidMain.dependencies { - implementation(libs.androidx.work.runtime.ktx) - implementation(libs.koin.android) - implementation(libs.koin.androidx.compose) + implementation(libs.bundles.work.android) + implementation(libs.bundles.koin.compose.android) } } } diff --git a/feature/account-kmp/build.gradle.kts b/feature/account-kmp/build.gradle.kts index cf30eac9a..a6061d0d8 100644 --- a/feature/account-kmp/build.gradle.kts +++ b/feature/account-kmp/build.gradle.kts @@ -16,13 +16,11 @@ kotlin { sourceSets { commonMain.dependencies { - implementation(project(":core:navigation-kmp")) api(project(":feature:account-impl-kmp")) } val desktopMain by getting desktopMain.dependencies { implementation(compose.material3) - implementation(libs.precompose) } } } diff --git a/feature/auth-impl-kmp/build.gradle.kts b/feature/auth-impl-kmp/build.gradle.kts index 9f74ae93b..1d13c2040 100644 --- a/feature/auth-impl-kmp/build.gradle.kts +++ b/feature/auth-impl-kmp/build.gradle.kts @@ -23,19 +23,16 @@ kotlin { sourceSets { commonMain.dependencies { api(project(":core:navigation-kmp")) - api(project(":core:ui-kmp")) + implementation(project(":core:ui-kmp")) implementation(project(":core:common-kmp")) implementation(project(":core:interactor-kmp")) - implementation(project(":core:network-kmp")) implementation(compose.components.resources) implementation(compose.material3) implementation(libs.bundles.constraintlayout.common) implementation(libs.bundles.koin.common) } androidMain.dependencies { - implementation(libs.androidx.autofill) - implementation(libs.koin.android) - implementation(libs.koin.androidx.compose) + implementation(libs.bundles.koin.compose.android) } } } diff --git a/feature/auth-kmp/build.gradle.kts b/feature/auth-kmp/build.gradle.kts index aa61a8b71..560437ffb 100644 --- a/feature/auth-kmp/build.gradle.kts +++ b/feature/auth-kmp/build.gradle.kts @@ -16,14 +16,12 @@ kotlin { sourceSets { commonMain.dependencies { - implementation(project(":core:navigation-kmp")) api(project(":feature:auth-impl-kmp")) } val desktopMain by getting desktopMain.dependencies { implementation(compose.material) implementation(compose.material3) - implementation(libs.precompose) } } } diff --git a/feature/details-impl-kmp/build.gradle.kts b/feature/details-impl-kmp/build.gradle.kts index 7fb05d2cb..40ee3306f 100644 --- a/feature/details-impl-kmp/build.gradle.kts +++ b/feature/details-impl-kmp/build.gradle.kts @@ -23,18 +23,16 @@ kotlin { sourceSets { commonMain.dependencies { api(project(":core:navigation-kmp")) - api(project(":core:ui-kmp")) + implementation(project(":core:ui-kmp")) implementation(project(":core:common-kmp")) implementation(project(":core:interactor-kmp")) - implementation(project(":core:network-kmp")) implementation(compose.components.resources) implementation(compose.material3) implementation(libs.bundles.constraintlayout.common) implementation(libs.bundles.koin.common) } androidMain.dependencies { - implementation(libs.koin.android) - implementation(libs.koin.androidx.compose) + implementation(libs.bundles.koin.compose.android) } } } diff --git a/feature/details-kmp/build.gradle.kts b/feature/details-kmp/build.gradle.kts index b2be6af68..c19f87b1e 100644 --- a/feature/details-kmp/build.gradle.kts +++ b/feature/details-kmp/build.gradle.kts @@ -16,15 +16,12 @@ kotlin { sourceSets { commonMain.dependencies { - implementation(project(":core:common-kmp")) - implementation(project(":core:navigation-kmp")) api(project(":feature:details-impl-kmp")) } val desktopMain by getting desktopMain.dependencies { implementation(compose.material) implementation(compose.material3) - implementation(libs.precompose) } } } diff --git a/feature/feed-impl-kmp/build.gradle.kts b/feature/feed-impl-kmp/build.gradle.kts index e2a536a6f..b7dcc5146 100644 --- a/feature/feed-impl-kmp/build.gradle.kts +++ b/feature/feed-impl-kmp/build.gradle.kts @@ -22,20 +22,18 @@ kotlin { sourceSets { commonMain.dependencies { - implementation(project(":core:platform-services:interactor-kmp")) api(project(":core:navigation-kmp")) - api(project(":core:ui-kmp")) + implementation(project(":core:platform-services:interactor-kmp")) + implementation(project(":core:ui-kmp")) implementation(project(":core:common-kmp")) - implementation(project(":core::interactor-kmp")) - implementation(project(":core:network-kmp")) + implementation(project(":core:interactor-kmp")) implementation(project(":core:notifications-kmp")) implementation(libs.bundles.paging.common) implementation(libs.bundles.constraintlayout.common) implementation(libs.bundles.koin.common) } androidMain.dependencies { - implementation(libs.koin.android) - implementation(libs.koin.androidx.compose) + implementation(libs.bundles.koin.compose.android) } val desktopMain by getting desktopMain.dependencies { diff --git a/feature/feed-kmp/build.gradle.kts b/feature/feed-kmp/build.gradle.kts index 1a81e9750..822d07ff6 100644 --- a/feature/feed-kmp/build.gradle.kts +++ b/feature/feed-kmp/build.gradle.kts @@ -16,14 +16,12 @@ kotlin { sourceSets { commonMain.dependencies { - implementation(project(":core:navigation-kmp")) api(project(":feature:feed-impl-kmp")) } val desktopMain by getting desktopMain.dependencies { implementation(compose.material) implementation(compose.material3) - implementation(libs.precompose) } } } diff --git a/feature/gallery-impl-kmp/build.gradle.kts b/feature/gallery-impl-kmp/build.gradle.kts index e63face77..5a7791450 100644 --- a/feature/gallery-impl-kmp/build.gradle.kts +++ b/feature/gallery-impl-kmp/build.gradle.kts @@ -23,17 +23,15 @@ kotlin { sourceSets { commonMain.dependencies { api(project(":core:navigation-kmp")) - api(project(":core:ui-kmp")) + implementation(project(":core:ui-kmp")) implementation(project(":core:common-kmp")) implementation(project(":core:interactor-kmp")) - implementation(project(":core:network-kmp")) implementation(project(":core:work-kmp")) implementation(libs.bundles.constraintlayout.common) implementation(libs.bundles.koin.common) } androidMain.dependencies { - implementation(libs.koin.android) - implementation(libs.koin.androidx.compose) + implementation(libs.bundles.koin.compose.android) } } } diff --git a/feature/gallery-impl-kmp/src/androidMain/kotlin/org/michaelbel/movies/gallery/ui/GalleryScreenContent.kt b/feature/gallery-impl-kmp/src/androidMain/kotlin/org/michaelbel/movies/gallery/ui/GalleryScreenContent.kt index 75a91a892..e8ae7386c 100644 --- a/feature/gallery-impl-kmp/src/androidMain/kotlin/org/michaelbel/movies/gallery/ui/GalleryScreenContent.kt +++ b/feature/gallery-impl-kmp/src/androidMain/kotlin/org/michaelbel/movies/gallery/ui/GalleryScreenContent.kt @@ -10,14 +10,9 @@ import androidx.activity.result.contract.ActivityResultContracts import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.fadeIn import androidx.compose.foundation.ExperimentalFoundationApi -import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.foundation.layout.windowInsetsPadding -import androidx.compose.foundation.pager.HorizontalPager -import androidx.compose.foundation.pager.PagerDefaults -import androidx.compose.foundation.pager.PagerScope -import androidx.compose.foundation.pager.PagerState import androidx.compose.foundation.pager.rememberPagerState import androidx.compose.material3.LinearProgressIndicator import androidx.compose.material3.MaterialTheme @@ -49,15 +44,12 @@ import androidx.compose.ui.unit.dp import androidx.constraintlayout.compose.ConstraintLayout import androidx.constraintlayout.compose.Dimension import androidx.core.net.toUri -import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.work.WorkInfo import coil.compose.AsyncImage import coil.compose.AsyncImagePainter import coil.request.ImageRequest import kotlinx.coroutines.launch -import org.koin.androidx.compose.koinViewModel import org.michaelbel.movies.common.theme.AppTheme -import org.michaelbel.movies.gallery.GalleryViewModel import org.michaelbel.movies.gallery.zoomable.rememberZoomState import org.michaelbel.movies.gallery.zoomable.zoomable import org.michaelbel.movies.gallery_impl_kmp.R @@ -86,11 +78,7 @@ internal fun GalleryScreenContent( val snackbarHostState = remember { SnackbarHostState() } val resultContract = rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) {} - val pagerState = rememberPagerState( - initialPage = 0, - initialPageOffsetFraction = 0F, - pageCount = { movieImages.size } - ) + val pagerState = rememberPagerState(pageCount = { movieImages.size }) var currentPage by remember { mutableIntStateOf(0) } LaunchedEffect(pagerState) { snapshotFlow { pagerState.currentPage }.collect { page -> diff --git a/feature/gallery-kmp/build.gradle.kts b/feature/gallery-kmp/build.gradle.kts index 2a74c717b..103c8daeb 100644 --- a/feature/gallery-kmp/build.gradle.kts +++ b/feature/gallery-kmp/build.gradle.kts @@ -16,14 +16,12 @@ kotlin { sourceSets { commonMain.dependencies { - implementation(project(":core:navigation-kmp")) api(project(":feature:gallery-impl-kmp")) } val desktopMain by getting desktopMain.dependencies { implementation(compose.material) implementation(compose.material3) - implementation(libs.precompose) } } } diff --git a/feature/search-impl-kmp/build.gradle.kts b/feature/search-impl-kmp/build.gradle.kts index 2283b588d..e30549c4f 100644 --- a/feature/search-impl-kmp/build.gradle.kts +++ b/feature/search-impl-kmp/build.gradle.kts @@ -26,15 +26,13 @@ kotlin { api(project(":core:ui-kmp")) implementation(project(":core:common-kmp")) implementation(project(":core:interactor-kmp")) - implementation(project(":core:network-kmp")) implementation(project(":core:notifications-kmp")) implementation(libs.bundles.paging.common) implementation(libs.bundles.constraintlayout.common) implementation(libs.bundles.koin.common) } androidMain.dependencies { - implementation(libs.koin.android) - implementation(libs.koin.androidx.compose) + implementation(libs.bundles.koin.compose.android) } } } diff --git a/feature/search-kmp/build.gradle.kts b/feature/search-kmp/build.gradle.kts index 80e54252c..c36f46530 100644 --- a/feature/search-kmp/build.gradle.kts +++ b/feature/search-kmp/build.gradle.kts @@ -16,14 +16,12 @@ kotlin { sourceSets { commonMain.dependencies { - implementation(project(":core:navigation-kmp")) api(project(":feature:search-impl-kmp")) } val desktopMain by getting desktopMain.dependencies { implementation(compose.material) implementation(compose.material3) - implementation(libs.precompose) } } } diff --git a/feature/settings-impl-kmp/build.gradle.kts b/feature/settings-impl-kmp/build.gradle.kts index 1106208e0..e5283b73d 100644 --- a/feature/settings-impl-kmp/build.gradle.kts +++ b/feature/settings-impl-kmp/build.gradle.kts @@ -22,11 +22,13 @@ kotlin { sourceSets { commonMain.dependencies { + api(project(":core:navigation-kmp")) + api(project(":core:ui-kmp")) + implementation(project(":core:common-kmp")) implementation(project(":core:interactor-kmp")) implementation(project(":core:navigation-kmp")) - implementation(project(":core:ui-kmp")) implementation(project(":core:widget-kmp")) - implementation(project(":core:common-kmp")) + implementation(project(":core:platform-services:interactor-kmp")) implementation(compose.components.resources) implementation(compose.foundation) implementation(compose.material3) @@ -34,8 +36,7 @@ kotlin { implementation(libs.bundles.koin.common) } androidMain.dependencies { - implementation(libs.koin.android) - implementation(libs.koin.androidx.compose) + implementation(libs.bundles.koin.compose.android) } val desktopMain by getting desktopMain.dependencies { diff --git a/feature/settings-impl-kmp/src/androidMain/kotlin/org/michaelbel/movies/settings/SettingsViewModel.kt b/feature/settings-impl-kmp/src/androidMain/kotlin/org/michaelbel/movies/settings/SettingsViewModel.kt index 5d24cd275..c5246b14b 100644 --- a/feature/settings-impl-kmp/src/androidMain/kotlin/org/michaelbel/movies/settings/SettingsViewModel.kt +++ b/feature/settings-impl-kmp/src/androidMain/kotlin/org/michaelbel/movies/settings/SettingsViewModel.kt @@ -14,12 +14,11 @@ import org.michaelbel.movies.common.ThemeData import org.michaelbel.movies.common.appearance.FeedView import org.michaelbel.movies.common.biometric.BiometricController import org.michaelbel.movies.common.list.MovieList -import org.michaelbel.movies.common.localization.LocaleController -import org.michaelbel.movies.common.localization.model.AppLanguage import org.michaelbel.movies.common.theme.AppTheme import org.michaelbel.movies.common.version.AppVersionData import org.michaelbel.movies.common.viewmodel.BaseViewModel import org.michaelbel.movies.interactor.Interactor +import org.michaelbel.movies.interactor.entity.AppLanguage import org.michaelbel.movies.platform.Flavor import org.michaelbel.movies.platform.app.AppService import org.michaelbel.movies.platform.review.ReviewService @@ -30,7 +29,6 @@ import org.michaelbel.movies.settings_impl_kmp.BuildConfig class SettingsViewModel( biometricController: BiometricController, private val interactor: Interactor, - private val localeController: LocaleController, private val reviewService: ReviewService, private val updateService: UpdateService, appService: AppService @@ -96,7 +94,7 @@ class SettingsViewModel( } fun selectLanguage(language: AppLanguage) = launch { - localeController.selectLanguage(language) + interactor.selectLanguage(language) } fun selectTheme(theme: AppTheme) = launch { diff --git a/feature/settings-impl-kmp/src/androidMain/kotlin/org/michaelbel/movies/settings/di/SettingsKoinModule.kt b/feature/settings-impl-kmp/src/androidMain/kotlin/org/michaelbel/movies/settings/di/SettingsKoinModule.kt index 061745916..662ddd036 100644 --- a/feature/settings-impl-kmp/src/androidMain/kotlin/org/michaelbel/movies/settings/di/SettingsKoinModule.kt +++ b/feature/settings-impl-kmp/src/androidMain/kotlin/org/michaelbel/movies/settings/di/SettingsKoinModule.kt @@ -3,7 +3,6 @@ package org.michaelbel.movies.settings.di import org.koin.androidx.viewmodel.dsl.viewModel import org.koin.dsl.module import org.michaelbel.movies.common.biometric.di.biometricKoinModule -import org.michaelbel.movies.common.localization.di.localeKoinModule import org.michaelbel.movies.interactor.di.interactorKoinModule import org.michaelbel.movies.network.connectivity.di.networkManagerKoinModule import org.michaelbel.movies.settings.SettingsViewModel @@ -12,8 +11,7 @@ val settingsKoinModule = module { includes( biometricKoinModule, interactorKoinModule, - localeKoinModule, networkManagerKoinModule ) - viewModel { SettingsViewModel(get(), get(), get(), get(), get(), get()) } + viewModel { SettingsViewModel(get(), get(), get(), get(), get()) } } \ No newline at end of file diff --git a/feature/settings-impl-kmp/src/androidMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.kt b/feature/settings-impl-kmp/src/androidMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.kt index f28bd64f7..e17759759 100644 --- a/feature/settings-impl-kmp/src/androidMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.kt +++ b/feature/settings-impl-kmp/src/androidMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.kt @@ -34,7 +34,7 @@ import org.michaelbel.movies.common.MOVIES_GITHUB_URL import org.michaelbel.movies.common.browser.openUrl import org.michaelbel.movies.common.gender.GrammaticalGender import org.michaelbel.movies.common.ktx.notificationManager -import org.michaelbel.movies.common.localization.model.AppLanguage +import org.michaelbel.movies.interactor.entity.AppLanguage import org.michaelbel.movies.settings.SettingsViewModel import org.michaelbel.movies.settings.ktx.currentGrammaticalGender import org.michaelbel.movies.settings.ktx.iconSnackbarTextRes diff --git a/feature/settings-impl-kmp/src/commonMain/kotlin/org/michaelbel/movies/settings/ktx/SealedStringKtx.kt b/feature/settings-impl-kmp/src/commonMain/kotlin/org/michaelbel/movies/settings/ktx/SealedStringKtx.kt index fcde2a9f2..bd5fbbe4e 100644 --- a/feature/settings-impl-kmp/src/commonMain/kotlin/org/michaelbel/movies/settings/ktx/SealedStringKtx.kt +++ b/feature/settings-impl-kmp/src/commonMain/kotlin/org/michaelbel/movies/settings/ktx/SealedStringKtx.kt @@ -9,8 +9,8 @@ import org.michaelbel.movies.common.SealedString import org.michaelbel.movies.common.appearance.FeedView import org.michaelbel.movies.common.gender.GrammaticalGender import org.michaelbel.movies.common.list.MovieList -import org.michaelbel.movies.common.localization.model.AppLanguage import org.michaelbel.movies.common.theme.AppTheme +import org.michaelbel.movies.interactor.entity.AppLanguage import org.michaelbel.movies.ui.strings.MoviesStrings internal val SealedString.stringText: String diff --git a/feature/settings-impl-kmp/src/commonMain/kotlin/org/michaelbel/movies/settings/model/SettingsData.kt b/feature/settings-impl-kmp/src/commonMain/kotlin/org/michaelbel/movies/settings/model/SettingsData.kt index bdd6158b2..e960eed1b 100644 --- a/feature/settings-impl-kmp/src/commonMain/kotlin/org/michaelbel/movies/settings/model/SettingsData.kt +++ b/feature/settings-impl-kmp/src/commonMain/kotlin/org/michaelbel/movies/settings/model/SettingsData.kt @@ -3,8 +3,8 @@ package org.michaelbel.movies.settings.model import org.michaelbel.movies.common.appearance.FeedView import org.michaelbel.movies.common.gender.GrammaticalGender import org.michaelbel.movies.common.list.MovieList -import org.michaelbel.movies.common.localization.model.AppLanguage import org.michaelbel.movies.common.theme.AppTheme +import org.michaelbel.movies.interactor.entity.AppLanguage import org.michaelbel.movies.ui.appicon.IconAlias data class SettingsData( diff --git a/feature/settings-impl-kmp/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/SettingsScreenContent.kt b/feature/settings-impl-kmp/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/SettingsScreenContent.kt index 4fc19b352..56a66f23f 100644 --- a/feature/settings-impl-kmp/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/SettingsScreenContent.kt +++ b/feature/settings-impl-kmp/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/SettingsScreenContent.kt @@ -35,8 +35,8 @@ import org.jetbrains.compose.resources.stringResource import org.michaelbel.movies.common.appearance.FeedView import org.michaelbel.movies.common.gender.GrammaticalGender import org.michaelbel.movies.common.list.MovieList -import org.michaelbel.movies.common.localization.model.AppLanguage import org.michaelbel.movies.common.theme.AppTheme +import org.michaelbel.movies.interactor.entity.AppLanguage import org.michaelbel.movies.settings.ktx.SettingsGenderText import org.michaelbel.movies.settings.ktx.stringText import org.michaelbel.movies.settings.model.SettingsData diff --git a/feature/settings-impl-kmp/src/desktopMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.kt b/feature/settings-impl-kmp/src/desktopMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.kt index 2e0ff838c..2c6080414 100644 --- a/feature/settings-impl-kmp/src/desktopMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.kt +++ b/feature/settings-impl-kmp/src/desktopMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.kt @@ -11,8 +11,8 @@ import org.michaelbel.movies.common.appearance.FeedView import org.michaelbel.movies.common.browser.openUrl import org.michaelbel.movies.common.gender.GrammaticalGender import org.michaelbel.movies.common.list.MovieList -import org.michaelbel.movies.common.localization.model.AppLanguage import org.michaelbel.movies.common.theme.AppTheme +import org.michaelbel.movies.interactor.entity.AppLanguage import org.michaelbel.movies.settings.model.SettingsData import org.michaelbel.movies.settings.model.isAboutFeatureEnabled import org.michaelbel.movies.settings.model.isAppIconFeatureEnabled diff --git a/feature/settings-kmp/build.gradle.kts b/feature/settings-kmp/build.gradle.kts index 1556294ce..d29cc2db4 100644 --- a/feature/settings-kmp/build.gradle.kts +++ b/feature/settings-kmp/build.gradle.kts @@ -16,15 +16,12 @@ kotlin { sourceSets { commonMain.dependencies { - implementation(project(":core:navigation-kmp")) - implementation(project(":core:ui-kmp")) api(project(":feature:settings-impl-kmp")) } val desktopMain by getting desktopMain.dependencies { implementation(compose.material) implementation(compose.material3) - implementation(libs.precompose) } } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 626f7b3a7..565b6fb6c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -176,7 +176,7 @@ androidx-test-rules = { module = "androidx.test:rules", version.ref = "androidx- androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test" } androidx-test-ext-junit-ktx = { module = "androidx.test.ext:junit-ktx", version.ref = "androidx-test-ext" } androidx-test-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "androidx-test-espresso" } -espresso-test-espresso-contrib = { module = "androidx.test.espresso:espresso-contrib", version.ref = "androidx-test-espresso" } +androidx-espresso-test-espresso-contrib = { module = "androidx.test.espresso:espresso-contrib", version.ref = "androidx-test-espresso" } androidx-test-espresso-device = { module = "androidx.test.espresso:espresso-device", version.ref = "androidx-test-espresso-device" } androidx-test-espresso-idling-resource = { module = "androidx.test.espresso:espresso-idling-resource", version.ref = "androidx-test-espresso" } androidx-test-uiautomator = { module = "androidx.test.uiautomator:uiautomator", version.ref = "androidx-test-uiautomator" } @@ -190,7 +190,6 @@ chucker-library-no-op = { module = "com.github.chuckerteam.chucker:library-no-op timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" } javapoet = { module = "com.squareup:javapoet", version.ref = "javapoet" } junit = { module = "junit:junit", version.ref = "junit" } -lint-checks = { module = "com.slack.lint.compose:compose-lint-checks", version.ref = "lint-checks" } flaker-android-okhttp = { module = "io.github.rotbolt:flaker-android-okhttp", version.ref = "flaker" } flaker-android-okhttp-noop = { module = "io.github.rotbolt:flaker-android-okhttp-noop", version.ref = "flaker" } ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" } @@ -230,6 +229,8 @@ constraintlayout-compose-multiplatform = { module = "tech.annexflow.compose:cons kmp-viewmodel = { module = "io.github.hoc081098:kmp-viewmodel", version.ref = "kmp-viewmodel" } okio = { module = "com.squareup.okio:okio", version.ref = "okio" } +lint-checks = { module = "com.slack.lint.compose:compose-lint-checks", version.ref = "lint-checks" } + gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "agp" } kotlin-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } @@ -237,14 +238,67 @@ kotlin-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version. kotlinx-coroutines-common = [ "kotlinx-coroutines-core" ] +kotlinx-serialization-common = [ + "kotlinx-serialization-json" +] +datastore-common = [ + "androidx-datastore-core", + "androidx-datastore-preferences-core" +] +lifecycle-common = [ + "androidx-lifecycle-viewmodel" +] +paging-common = [ + "androidx-paging-compose" +] +ktor-common = [ + "ktor-client-core", + "ktor-client-cio", + "ktor-client-content-negotiation", + "ktor-serialization-kotlinx-json" +] +koin-common = [ + "koin-core" +] +coil-common = [ + "coil3-compose" +] +constraintlayout-common = [ + "constraintlayout-compose-multiplatform" +] +okio-common = [ + "okio" +] +kmp-viewmodel-common = [ + "kmp-viewmodel" +] + kotlinx-coroutines-android = [ "kotlinx-coroutines-android" ] -androidx-appcompat = [ +kotlin-reflect-android = [ + "kotlin-reflect" +] +activity-android = [ + "androidx-activity-compose" +] +appcompat-android = [ "androidx-appcompat", "androidx-appcompat-resources" ] -androidx-compose = [ +benchmark-android = [ + "androidx-benchmark-junit" +] +benchmark-macro-android = [ + "androidx-benchmark-macro-junit" +] +biometric-android = [ + "androidx-biometric-ktx" +] +browser-android = [ + "androidx-browser" +] +compose-android = [ "androidx-compose-animation", "androidx-compose-compiler", "androidx-compose-foundation", @@ -256,11 +310,28 @@ androidx-compose = [ "androidx-compose-ui-tooling", "androidx-compose-ui-util" ] -androidx-glance = [ +compose-ui-test-android = [ + "androidx-compose-ui-test-junit4" +] +core-android = [ + "androidx-core-ktx" +] +core-splashscreen-android = [ + "androidx-core-splashscreen" +] +datastore-android = [ + "androidx-datastore-preferences" +] +glance-android = [ "androidx-glance-appwidget", "androidx-glance-material3" ] -androidx-media3 = [ +lifecycle-android = [ + "androidx-lifecycle-runtime-compose", + #"androidx-lifecycle-viewmodel-compose", + "androidx-lifecycle-process" +] +media3-android = [ "androidx-media3-exoplayer", "androidx-media3-exoplayer-dash", "androidx-media3-exoplayer-hls", @@ -288,78 +359,114 @@ androidx-media3 = [ "androidx-media3-datasource", "androidx-media3-common" ] -androidx-room = [ +navigation-android = [ + "androidx-navigation-compose" +] +palette-android = [ + "androidx-palette-ktx" +] +room-android = [ "androidx-room-runtime", "androidx-room-ktx", "androidx-room-paging" ] -androidx-test-espresso = [ +room-compiler-android = [ + "androidx-room-compiler" +] +startup-android = [ + "androidx-startup-runtime" +] +test-espresso-android = [ "androidx-test-espresso-core", - "espresso-test-espresso-contrib", + "androidx-espresso-test-espresso-contrib", "androidx-test-espresso-device", "androidx-test-espresso-idling-resource" ] -datastore-common = [ - "androidx-datastore-core", - "androidx-datastore-preferences-core" +test-ext-junit-android = [ + "androidx-test-ext-junit-ktx" ] -datastore-android = [ - "androidx-datastore-preferences" +test-uiautomator-android = [ + "androidx-test-uiautomator" ] -datastore-desktop = [ - "androidx-datastore-core-okio-jvm" +work-android = [ + "androidx-work-runtime-ktx" ] -lifecycle-common = [ - "androidx-lifecycle-viewmodel" +ktor-android = [ + "ktor-client-okhttp", + "ktor-client-android", ] -lifecycle-android = [ - "androidx-lifecycle-runtime-compose", - #"androidx-lifecycle-viewmodel-compose", - "androidx-lifecycle-process" +koin-android = [ + "koin-android" ] -paging-common = [ - "androidx-paging-compose" +koin-compose-android = [ + "koin-android", + "koin-androidx-compose" +] +koin-work-android = [ + "koin-android", + "koin-androidx-workmanager" +] +koin-compose-work-android = [ + "koin-android", + "koin-androidx-compose", + "koin-androidx-workmanager" +] +coil-android = [ + "coil-compose" ] -google-firebase = [ +timber-android = [ + "timber" +] +google-firebase-android = [ "google-firebase-analytics-ktx", "google-firebase-config-ktx", "google-firebase-crashlytics-ktx", "google-firebase-messaging-ktx" ] -google-material = [ +google-services-android = [ + "google-services-base", + "google-services-instantapps" +] +google-services-instantapps-android = [ + "google-services-instantapps" +] +google-material-android = [ "google-material", "google-material-compose-theme-adapter" ] -google-services = [ - "google-services-base", - "google-services-instantapps" +google-play-core-android = [ + "google-play-core-ktx" ] -ktor-common = [ - "ktor-client-core", - "ktor-client-cio", - "ktor-client-content-negotiation", - "ktor-serialization-kotlinx-json" +leakcanary-android = [ + "leakcanary" ] -ktor-android = [ - "ktor-client-okhttp", - "ktor-client-android", +okhttp-logging-interceptor-android = [ + "okhttp-logging-interceptor" ] -koin-common = [ - "koin-core" +chucker-library-android = [ + "chucker-library" ] -koin-android = [ - "koin-android", - "koin-androidx-compose", - "koin-androidx-workmanager" +chucker-library-no-op-android = [ + "chucker-library-no-op" ] -coil-common = [ - "coil3-compose" +javapoet-android = [ + "javapoet" ] -constraintlayout-common = [ - "constraintlayout-compose-multiplatform" +junit-android = [ + "junit" ] -okio-common = [ - "okio" +flaker-android = [ + "flaker-android-okhttp" +] +flaker-noop-android = [ + "flaker-android-okhttp-noop" +] + +datastore-desktop = [ + "androidx-datastore-core-okio-jvm" +] +precompose-desktop = [ + "precompose" ] [plugins] diff --git a/instant/build.gradle.kts b/instant/build.gradle.kts index 08f7ffc04..564ebff01 100644 --- a/instant/build.gradle.kts +++ b/instant/build.gradle.kts @@ -42,7 +42,7 @@ dependencies { implementation(project(":androidApp")) implementation(project(":core:common-kmp")) implementation(project(":core:ui-kmp")) - implementation(libs.bundles.androidx.appcompat) - implementation(libs.bundles.androidx.compose) - implementation(libs.google.services.instantapps) + implementation(libs.bundles.appcompat.android) + implementation(libs.bundles.compose.android) + implementation(libs.bundles.google.services.instantapps.android) } \ No newline at end of file