From 6a4a6de4a33b4712aee08f210e45b5a05e55655a Mon Sep 17 00:00:00 2001 From: michaelbel Date: Sun, 26 May 2024 19:22:39 +0300 Subject: [PATCH] Update project --- build.gradle.kts | 1 + ...t => MoviesAnalyticsKoinModule.android.kt} | 0 ...t => MoviesAnalyticsKoinModule.desktop.kt} | 0 .../{Browser.kt => Browser.android.kt} | 0 ...iDispatcher.kt => UiDispatcher.android.kt} | 0 ...eKtx.kt => SavedStateHandleKtx.android.kt} | 0 .../log/{Logger.kt => Logger.android.kt} | 0 .../{Browser.kt => Browser.desktop.kt} | 0 ...iDispatcher.kt => UiDispatcher.desktop.kt} | 0 .../common/ktx/SavedStateHandleKtx.desktop.kt | 5 + .../log/{Logger.kt => Logger.desktop.kt} | 0 .../movies/common/viewmodel/BaseViewModel.kt | 5 +- ...> InteractorBlockingKoinModule.android.kt} | 0 ... => LocaleInteractorKoinModule.android.kt} | 0 .../movies/interactor/MovieInteractor.kt | 2 + .../interactor/impl/MovieInteractorImpl.kt | 9 + ...> InteractorBlockingKoinModule.desktop.kt} | 0 ... => InteractorLocaleKoinModule.desktop.kt} | 0 core/network/build.gradle.kts | 12 +- .../{TmdbConfig.kt => TmdbConfig.android.kt} | 2 +- ...oinModule.kt => KtorKoinModule.android.kt} | 0 .../movies/network/MovieNetworkService.kt | 8 + .../movies/network/config/TmdbConfig.kt | 2 + .../movies/network/ktor/KtorMovieService.kt | 13 + .../network/config/TmdbConfig.desktop.kt | 9 + .../movies/network/config/TmdbConfig.kt | 4 - ...oinModule.kt => KtorKoinModule.desktop.kt} | 12 +- ...odule.kt => DatabaseKoinModule.android.kt} | 0 ...kt => MoviesDatabaseKoinModule.android.kt} | 0 ... PersistenceBlockingKoinModule.android.kt} | 0 ...dule.kt => DataStoreKoinModule.android.kt} | 0 ...odule.kt => DatabaseKoinModule.desktop.kt} | 0 ...kt => MoviesDatabaseKoinModule.desktop.kt} | 0 ... PersistenceBlockingKoinModule.desktop.kt} | 0 ...dule.kt => DataStoreKoinModule.desktop.kt} | 0 ...> RepositoryBlockingKoinModule.android.kt} | 0 .../ktx/{BuildKtx.kt => BuildKtx.android.kt} | 0 ...xceptionKtx.kt => ExceptionKtx.android.kt} | 0 .../movies/repository/MovieRepository.kt | 6 + .../repository/impl/MovieRepositoryImpl.kt | 16 ++ ...> RepositoryBlockingKoinModule.desktop.kt} | 0 .../ktx/{BuildKtx.kt => BuildKtx.desktop.kt} | 0 ...xceptionKtx.kt => ExceptionKtx.desktop.kt} | 0 core/ui/build.gradle.kts | 4 + ...{MovieColumn.kt => MovieColumn.android.kt} | 0 .../{MovieRow.kt => MovieRow.android.kt} | 0 ...{PageContent.kt => PageContent.android.kt} | 0 ...tionKtx.kt => ConfigurationKtx.android.kt} | 0 ...msKtx.kt => LazyPagingItemsKtx.android.kt} | 0 ...ifecycleKtx.kt => LifecycleKtx.android.kt} | 0 ...nsetsKtx.kt => WindowInsetsKtx.android.kt} | 0 .../ui/theme/{Theme.kt => Theme.android.kt} | 0 .../ui/compose/movie/MovieColumn.desktop.kt | 124 ++++++++++ .../ui/compose/movie/MovieRow.desktop.kt | 125 ++++++++++ .../ui/compose/page/PageContent.desktop.kt | 226 ++++++++++++++++++ ...tionKtx.kt => ConfigurationKtx.desktop.kt} | 0 .../ui/ktx/LazyPagingItemsKtx.desktop.kt | 9 + ...ifecycleKtx.kt => LifecycleKtx.desktop.kt} | 0 ...nsetsKtx.kt => WindowInsetsKtx.desktop.kt} | 0 .../ui/theme/{Theme.kt => Theme.desktop.kt} | 0 .../AppWidgetConfigureActivityContent.kt | 4 +- .../org/michaelbel/movies/MainWindow.kt | 4 +- ...ccountRoute.kt => AccountRoute.android.kt} | 4 +- ...ccountRoute.kt => AccountRoute.desktop.kt} | 4 +- ...gation.kt => AccountNavigation.android.kt} | 0 ...gation.kt => AccountNavigation.desktop.kt} | 0 feature/auth-impl/build.gradle.kts | 8 + ...oinModule.kt => AuthKoinModule.android.kt} | 2 +- .../ui/{AuthRoute.kt => AuthRoute.android.kt} | 0 .../movies/auth/di/AuthKoinModule.kt | 5 + .../michaelbel/movies/auth/AuthViewModel.kt | 10 + ...oinModule.kt => AuthKoinModule.desktop.kt} | 4 +- .../ui/{AuthRoute.kt => AuthRoute.desktop.kt} | 5 +- ...avigation.kt => AuthNavigation.android.kt} | 0 .../auth/{Settings.kt => Settings.android.kt} | 0 ...avigation.kt => AuthNavigation.desktop.kt} | 0 .../auth/{Settings.kt => Settings.desktop.kt} | 0 .../movies/debug/ui/DebugActivityContent.kt | 6 +- feature/details-impl/build.gradle.kts | 8 + ...Module.kt => DetailsKoinModule.android.kt} | 2 +- ...etailsRoute.kt => DetailsRoute.android.kt} | 8 +- .../movies/details/di/DetailsKoinModule.kt | 5 + .../movies/details/DetailsViewModel.kt | 17 ++ ...Module.kt => DetailsKoinModule.desktop.kt} | 2 +- .../movies/details/ui/DetailsRoute.desktop.kt | 25 ++ ...gation.kt => DetailsNavigation.android.kt} | 2 +- ...gation.kt => DetailsNavigation.desktop.kt} | 21 +- .../ui/{FeedRoute.kt => FeedRoute.android.kt} | 0 ...ontent.kt => FeedScreenContent.android.kt} | 2 - .../michaelbel/movies/feed/FeedViewModel.kt | 23 ++ .../ui/{FeedRoute.kt => FeedRoute.desktop.kt} | 4 + ...ontent.kt => FeedScreenContent.desktop.kt} | 19 +- ...avigation.kt => FeedNavigation.android.kt} | 0 ...avigation.kt => FeedNavigation.desktop.kt} | 0 feature/gallery-impl/build.gradle.kts | 8 + ...Module.kt => GalleryKoinModule.android.kt} | 2 +- ...alleryRoute.kt => GalleryRoute.android.kt} | 6 +- .../movies/gallery/di/GalleryKoinModule.kt | 5 + .../movies/gallery/GalleryViewModel.kt | 10 + ...Module.kt => GalleryKoinModule.desktop.kt} | 4 +- .../movies/gallery/ui/GalleryRoute.desktop.kt | 20 ++ ...gation.kt => GalleryNavigation.android.kt} | 0 ...gation.kt => GalleryNavigation.desktop.kt} | 9 +- ...{MainContent.kt => MainContent.android.kt} | 4 +- ...oinModule.kt => MainKoinModule.android.kt} | 0 ...{MainContent.kt => MainContent.desktop.kt} | 0 ...oinModule.kt => MainKoinModule.desktop.kt} | 0 feature/search-impl/build.gradle.kts | 8 + ...nModule.kt => SearchKoinModule.android.kt} | 2 +- ...{SearchRoute.kt => SearchRoute.desktop.kt} | 12 +- .../movies/search/di/SearchKoinModule.kt | 5 + .../movies/search/SearchViewModel.kt | 10 + ...nModule.kt => SearchKoinModule.desktop.kt} | 4 +- .../movies/search/ui/SearchRoute.desktop.kt | 23 ++ ...igation.kt => SearchNavigation.android.kt} | 0 ...igation.kt => SearchNavigation.desktop.kt} | 10 +- ...tringKtx.kt => GenderStringKtx.android.kt} | 0 .../{Features.kt => Features.android.kt} | 0 ...tingsRoute.kt => SettingsRoute.android.kt} | 17 +- ...tringKtx.kt => GenderStringKtx.desktop.kt} | 0 .../{Features.kt => Features.desktop.kt} | 0 ...tingsRoute.kt => SettingsRoute.desktop.kt} | 8 +- ...ation.kt => SettingsNavigation.android.kt} | 0 ...ation.kt => SettingsNavigation.desktop.kt} | 0 gradle/libs.versions.toml | 15 +- readme.md | 1 + readme.ru.md | 1 + 127 files changed, 890 insertions(+), 82 deletions(-) rename core/analytics/src/androidMain/kotlin/org/michaelbel/movies/analytics/di/{MoviesAnalyticsKoinModule.kt => MoviesAnalyticsKoinModule.android.kt} (100%) rename core/analytics/src/desktopMain/kotlin/org/michaelbel/movies/analytics/di/{MoviesAnalyticsKoinModule.kt => MoviesAnalyticsKoinModule.desktop.kt} (100%) rename core/common/src/androidMain/kotlin/org/michaelbel/movies/common/browser/{Browser.kt => Browser.android.kt} (100%) rename core/common/src/androidMain/kotlin/org/michaelbel/movies/common/dispatchers/{UiDispatcher.kt => UiDispatcher.android.kt} (100%) rename core/common/src/androidMain/kotlin/org/michaelbel/movies/common/ktx/{SavedStateHandleKtx.kt => SavedStateHandleKtx.android.kt} (100%) rename core/common/src/androidMain/kotlin/org/michaelbel/movies/common/log/{Logger.kt => Logger.android.kt} (100%) rename core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/browser/{Browser.kt => Browser.desktop.kt} (100%) rename core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/dispatchers/{UiDispatcher.kt => UiDispatcher.desktop.kt} (100%) create mode 100644 core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/ktx/SavedStateHandleKtx.desktop.kt rename core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/log/{Logger.kt => Logger.desktop.kt} (100%) rename core/interactor/src/androidMain/kotlin/org/michaelbel/movies/interactor/di/{InteractorBlockingKoinModule.kt => InteractorBlockingKoinModule.android.kt} (100%) rename core/interactor/src/androidMain/kotlin/org/michaelbel/movies/interactor/di/{LocaleInteractorKoinModule.kt => LocaleInteractorKoinModule.android.kt} (100%) rename core/interactor/src/desktopMain/kotlin/org/michaelbel/movies/interactor/di/{InteractorBlockingKoinModule.kt => InteractorBlockingKoinModule.desktop.kt} (100%) rename core/interactor/src/desktopMain/kotlin/org/michaelbel/movies/interactor/di/{InteractorLocaleKoinModule.kt => InteractorLocaleKoinModule.desktop.kt} (100%) rename core/network/src/androidMain/kotlin/org/michaelbel/movies/network/config/{TmdbConfig.kt => TmdbConfig.android.kt} (88%) rename core/network/src/androidMain/kotlin/org/michaelbel/movies/network/ktor/di/{KtorKoinModule.kt => KtorKoinModule.android.kt} (100%) create mode 100644 core/network/src/desktopMain/kotlin/org/michaelbel/movies/network/config/TmdbConfig.desktop.kt delete mode 100644 core/network/src/desktopMain/kotlin/org/michaelbel/movies/network/config/TmdbConfig.kt rename core/network/src/desktopMain/kotlin/org/michaelbel/movies/network/ktor/di/{KtorKoinModule.kt => KtorKoinModule.desktop.kt} (62%) rename core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/database/di/{DatabaseKoinModule.kt => DatabaseKoinModule.android.kt} (100%) rename core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/database/di/{MoviesDatabaseKoinModule.kt => MoviesDatabaseKoinModule.android.kt} (100%) rename core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/database/di/{PersistenceBlockingKoinModule.kt => PersistenceBlockingKoinModule.android.kt} (100%) rename core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/datastore/di/{DataStoreKoinModule.kt => DataStoreKoinModule.android.kt} (100%) rename core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/database/di/{DatabaseKoinModule.kt => DatabaseKoinModule.desktop.kt} (100%) rename core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/database/di/{MoviesDatabaseKoinModule.kt => MoviesDatabaseKoinModule.desktop.kt} (100%) rename core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/database/di/{PersistenceBlockingKoinModule.kt => PersistenceBlockingKoinModule.desktop.kt} (100%) rename core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/datastore/di/{DataStoreKoinModule.kt => DataStoreKoinModule.desktop.kt} (100%) rename core/repository/src/androidMain/kotlin/org/michaelbel/movies/repository/di/{RepositoryBlockingKoinModule.kt => RepositoryBlockingKoinModule.android.kt} (100%) rename core/repository/src/androidMain/kotlin/org/michaelbel/movies/repository/ktx/{BuildKtx.kt => BuildKtx.android.kt} (100%) rename core/repository/src/androidMain/kotlin/org/michaelbel/movies/repository/ktx/{ExceptionKtx.kt => ExceptionKtx.android.kt} (100%) rename core/repository/src/desktopMain/kotlin/org/michaelbel/movies/repository/di/{RepositoryBlockingKoinModule.kt => RepositoryBlockingKoinModule.desktop.kt} (100%) rename core/repository/src/desktopMain/kotlin/org/michaelbel/movies/repository/ktx/{BuildKtx.kt => BuildKtx.desktop.kt} (100%) rename core/repository/src/desktopMain/kotlin/org/michaelbel/movies/repository/ktx/{ExceptionKtx.kt => ExceptionKtx.desktop.kt} (100%) rename core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/compose/movie/{MovieColumn.kt => MovieColumn.android.kt} (100%) rename core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/compose/movie/{MovieRow.kt => MovieRow.android.kt} (100%) rename core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/compose/page/{PageContent.kt => PageContent.android.kt} (100%) rename core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/{ConfigurationKtx.kt => ConfigurationKtx.android.kt} (100%) rename core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/{LazyPagingItemsKtx.kt => LazyPagingItemsKtx.android.kt} (100%) rename core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/{LifecycleKtx.kt => LifecycleKtx.android.kt} (100%) rename core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/{WindowInsetsKtx.kt => WindowInsetsKtx.android.kt} (100%) rename core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/theme/{Theme.kt => Theme.android.kt} (100%) create mode 100644 core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieColumn.desktop.kt create mode 100644 core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieRow.desktop.kt create mode 100644 core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/compose/page/PageContent.desktop.kt rename core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/ktx/{ConfigurationKtx.kt => ConfigurationKtx.desktop.kt} (100%) create mode 100644 core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/ktx/LazyPagingItemsKtx.desktop.kt rename core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/ktx/{LifecycleKtx.kt => LifecycleKtx.desktop.kt} (100%) rename core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/ktx/{WindowInsetsKtx.kt => WindowInsetsKtx.desktop.kt} (100%) rename core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/theme/{Theme.kt => Theme.desktop.kt} (100%) rename feature/account-impl/src/androidMain/kotlin/org/michaelbel/movies/account/ui/{AccountRoute.kt => AccountRoute.android.kt} (84%) rename feature/account-impl/src/desktopMain/kotlin/org/michaelbel/movies/account/ui/{AccountRoute.kt => AccountRoute.desktop.kt} (85%) rename feature/account/src/androidMain/kotlin/org/michaelbel/movies/account/{AccountNavigation.kt => AccountNavigation.android.kt} (100%) rename feature/account/src/desktopMain/kotlin/org/michaelbel/movies/account/{AccountNavigation.kt => AccountNavigation.desktop.kt} (100%) rename feature/auth-impl/src/androidMain/kotlin/org/michaelbel/movies/auth/di/{AuthKoinModule.kt => AuthKoinModule.android.kt} (89%) rename feature/auth-impl/src/androidMain/kotlin/org/michaelbel/movies/auth/ui/{AuthRoute.kt => AuthRoute.android.kt} (100%) create mode 100644 feature/auth-impl/src/commonMain/kotlin/org/michaelbel/movies/auth/di/AuthKoinModule.kt create mode 100644 feature/auth-impl/src/desktopMain/kotlin/org/michaelbel/movies/auth/AuthViewModel.kt rename feature/auth-impl/src/desktopMain/kotlin/org/michaelbel/movies/auth/di/{AuthKoinModule.kt => AuthKoinModule.desktop.kt} (59%) rename feature/auth-impl/src/desktopMain/kotlin/org/michaelbel/movies/auth/ui/{AuthRoute.kt => AuthRoute.desktop.kt} (77%) rename feature/auth/src/androidMain/kotlin/org/michaelbel/movies/auth/{AuthNavigation.kt => AuthNavigation.android.kt} (100%) rename feature/auth/src/androidMain/kotlin/org/michaelbel/movies/auth/{Settings.kt => Settings.android.kt} (100%) rename feature/auth/src/desktopMain/kotlin/org/michaelbel/movies/auth/{AuthNavigation.kt => AuthNavigation.desktop.kt} (100%) rename feature/auth/src/desktopMain/kotlin/org/michaelbel/movies/auth/{Settings.kt => Settings.desktop.kt} (100%) rename feature/details-impl/src/androidMain/kotlin/org/michaelbel/movies/details/di/{DetailsKoinModule.kt => DetailsKoinModule.android.kt} (91%) rename feature/details-impl/src/androidMain/kotlin/org/michaelbel/movies/details/ui/{DetailsRoute.kt => DetailsRoute.android.kt} (85%) create mode 100644 feature/details-impl/src/commonMain/kotlin/org/michaelbel/movies/details/di/DetailsKoinModule.kt create mode 100644 feature/details-impl/src/desktopMain/kotlin/org/michaelbel/movies/details/DetailsViewModel.kt rename feature/details-impl/src/desktopMain/kotlin/org/michaelbel/movies/details/di/{DetailsKoinModule.kt => DetailsKoinModule.desktop.kt} (82%) create mode 100644 feature/details-impl/src/desktopMain/kotlin/org/michaelbel/movies/details/ui/DetailsRoute.desktop.kt rename feature/details/src/androidMain/kotlin/org/michaelbel/movies/details/{DetailsNavigation.kt => DetailsNavigation.android.kt} (95%) rename feature/details/src/desktopMain/kotlin/org/michaelbel/movies/details/{DetailsNavigation.kt => DetailsNavigation.desktop.kt} (54%) rename feature/feed-impl/src/androidMain/kotlin/org/michaelbel/movies/feed/ui/{FeedRoute.kt => FeedRoute.android.kt} (100%) rename feature/feed-impl/src/androidMain/kotlin/org/michaelbel/movies/feed/ui/{FeedScreenContent.kt => FeedScreenContent.android.kt} (98%) rename feature/feed-impl/src/desktopMain/kotlin/org/michaelbel/movies/feed/ui/{FeedRoute.kt => FeedRoute.desktop.kt} (82%) rename feature/feed-impl/src/desktopMain/kotlin/org/michaelbel/movies/feed/ui/{FeedScreenContent.kt => FeedScreenContent.desktop.kt} (64%) rename feature/feed/src/androidMain/kotlin/org/michaelbel/movies/feed/{FeedNavigation.kt => FeedNavigation.android.kt} (100%) rename feature/feed/src/desktopMain/kotlin/org/michaelbel/movies/feed/{FeedNavigation.kt => FeedNavigation.desktop.kt} (100%) rename feature/gallery-impl/src/androidMain/kotlin/org/michaelbel/movies/gallery/di/{GalleryKoinModule.kt => GalleryKoinModule.android.kt} (91%) rename feature/gallery-impl/src/androidMain/kotlin/org/michaelbel/movies/gallery/ui/{GalleryRoute.kt => GalleryRoute.android.kt} (74%) create mode 100644 feature/gallery-impl/src/commonMain/kotlin/org/michaelbel/movies/gallery/di/GalleryKoinModule.kt create mode 100644 feature/gallery-impl/src/desktopMain/kotlin/org/michaelbel/movies/gallery/GalleryViewModel.kt rename feature/gallery-impl/src/desktopMain/kotlin/org/michaelbel/movies/gallery/di/{GalleryKoinModule.kt => GalleryKoinModule.desktop.kt} (58%) create mode 100644 feature/gallery-impl/src/desktopMain/kotlin/org/michaelbel/movies/gallery/ui/GalleryRoute.desktop.kt rename feature/gallery/src/androidMain/kotlin/org/michaelbel/movies/gallery/{GalleryNavigation.kt => GalleryNavigation.android.kt} (100%) rename feature/gallery/src/desktopMain/kotlin/org/michaelbel/movies/gallery/{GalleryNavigation.kt => GalleryNavigation.desktop.kt} (68%) rename feature/main-impl/src/androidMain/kotlin/org/michaelbel/movies/main/{MainContent.kt => MainContent.android.kt} (75%) rename feature/main-impl/src/androidMain/kotlin/org/michaelbel/movies/main/di/{MainKoinModule.kt => MainKoinModule.android.kt} (100%) rename feature/main-impl/src/desktopMain/kotlin/org/michaelbel/movies/main/{MainContent.kt => MainContent.desktop.kt} (100%) rename feature/main-impl/src/desktopMain/kotlin/org/michaelbel/movies/main/di/{MainKoinModule.kt => MainKoinModule.desktop.kt} (100%) rename feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/di/{SearchKoinModule.kt => SearchKoinModule.android.kt} (91%) rename feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/ui/{SearchRoute.kt => SearchRoute.desktop.kt} (81%) create mode 100644 feature/search-impl/src/commonMain/kotlin/org/michaelbel/movies/search/di/SearchKoinModule.kt create mode 100644 feature/search-impl/src/desktopMain/kotlin/org/michaelbel/movies/search/SearchViewModel.kt rename feature/search-impl/src/desktopMain/kotlin/org/michaelbel/movies/search/di/{SearchKoinModule.kt => SearchKoinModule.desktop.kt} (58%) create mode 100644 feature/search-impl/src/desktopMain/kotlin/org/michaelbel/movies/search/ui/SearchRoute.desktop.kt rename feature/search/src/androidMain/kotlin/org/michaelbel/movies/search/{SearchNavigation.kt => SearchNavigation.android.kt} (100%) rename feature/search/src/desktopMain/kotlin/org/michaelbel/movies/search/{SearchNavigation.kt => SearchNavigation.desktop.kt} (66%) rename feature/settings-impl/src/androidMain/kotlin/org/michaelbel/movies/settings/ktx/{GenderStringKtx.kt => GenderStringKtx.android.kt} (100%) rename feature/settings-impl/src/androidMain/kotlin/org/michaelbel/movies/settings/model/{Features.kt => Features.android.kt} (100%) rename feature/settings-impl/src/androidMain/kotlin/org/michaelbel/movies/settings/ui/{SettingsRoute.kt => SettingsRoute.android.kt} (97%) rename feature/settings-impl/src/desktopMain/kotlin/org/michaelbel/movies/settings/ktx/{GenderStringKtx.kt => GenderStringKtx.desktop.kt} (100%) rename feature/settings-impl/src/desktopMain/kotlin/org/michaelbel/movies/settings/model/{Features.kt => Features.desktop.kt} (100%) rename feature/settings-impl/src/desktopMain/kotlin/org/michaelbel/movies/settings/ui/{SettingsRoute.kt => SettingsRoute.desktop.kt} (97%) rename feature/settings/src/androidMain/kotlin/org/michaelbel/movies/settings/{SettingsNavigation.kt => SettingsNavigation.android.kt} (100%) rename feature/settings/src/desktopMain/kotlin/org/michaelbel/movies/settings/{SettingsNavigation.kt => SettingsNavigation.desktop.kt} (100%) diff --git a/build.gradle.kts b/build.gradle.kts index 3f528cba0..93674c7ba 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,6 +17,7 @@ plugins { alias(libs.plugins.google.firebase.crashlytics) apply false alias(libs.plugins.sqldelight) apply false alias(libs.plugins.androidx.navigation.safeargs) apply false + alias(libs.plugins.buildkonfig) apply false alias(libs.plugins.spotless) alias(libs.plugins.detekt) alias(libs.plugins.palantir.git) diff --git a/core/analytics/src/androidMain/kotlin/org/michaelbel/movies/analytics/di/MoviesAnalyticsKoinModule.kt b/core/analytics/src/androidMain/kotlin/org/michaelbel/movies/analytics/di/MoviesAnalyticsKoinModule.android.kt similarity index 100% rename from core/analytics/src/androidMain/kotlin/org/michaelbel/movies/analytics/di/MoviesAnalyticsKoinModule.kt rename to core/analytics/src/androidMain/kotlin/org/michaelbel/movies/analytics/di/MoviesAnalyticsKoinModule.android.kt diff --git a/core/analytics/src/desktopMain/kotlin/org/michaelbel/movies/analytics/di/MoviesAnalyticsKoinModule.kt b/core/analytics/src/desktopMain/kotlin/org/michaelbel/movies/analytics/di/MoviesAnalyticsKoinModule.desktop.kt similarity index 100% rename from core/analytics/src/desktopMain/kotlin/org/michaelbel/movies/analytics/di/MoviesAnalyticsKoinModule.kt rename to core/analytics/src/desktopMain/kotlin/org/michaelbel/movies/analytics/di/MoviesAnalyticsKoinModule.desktop.kt diff --git a/core/common/src/androidMain/kotlin/org/michaelbel/movies/common/browser/Browser.kt b/core/common/src/androidMain/kotlin/org/michaelbel/movies/common/browser/Browser.android.kt similarity index 100% rename from core/common/src/androidMain/kotlin/org/michaelbel/movies/common/browser/Browser.kt rename to core/common/src/androidMain/kotlin/org/michaelbel/movies/common/browser/Browser.android.kt diff --git a/core/common/src/androidMain/kotlin/org/michaelbel/movies/common/dispatchers/UiDispatcher.kt b/core/common/src/androidMain/kotlin/org/michaelbel/movies/common/dispatchers/UiDispatcher.android.kt similarity index 100% rename from core/common/src/androidMain/kotlin/org/michaelbel/movies/common/dispatchers/UiDispatcher.kt rename to core/common/src/androidMain/kotlin/org/michaelbel/movies/common/dispatchers/UiDispatcher.android.kt diff --git a/core/common/src/androidMain/kotlin/org/michaelbel/movies/common/ktx/SavedStateHandleKtx.kt b/core/common/src/androidMain/kotlin/org/michaelbel/movies/common/ktx/SavedStateHandleKtx.android.kt similarity index 100% rename from core/common/src/androidMain/kotlin/org/michaelbel/movies/common/ktx/SavedStateHandleKtx.kt rename to core/common/src/androidMain/kotlin/org/michaelbel/movies/common/ktx/SavedStateHandleKtx.android.kt diff --git a/core/common/src/androidMain/kotlin/org/michaelbel/movies/common/log/Logger.kt b/core/common/src/androidMain/kotlin/org/michaelbel/movies/common/log/Logger.android.kt similarity index 100% rename from core/common/src/androidMain/kotlin/org/michaelbel/movies/common/log/Logger.kt rename to core/common/src/androidMain/kotlin/org/michaelbel/movies/common/log/Logger.android.kt diff --git a/core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/browser/Browser.kt b/core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/browser/Browser.desktop.kt similarity index 100% rename from core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/browser/Browser.kt rename to core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/browser/Browser.desktop.kt diff --git a/core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/dispatchers/UiDispatcher.kt b/core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/dispatchers/UiDispatcher.desktop.kt similarity index 100% rename from core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/dispatchers/UiDispatcher.kt rename to core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/dispatchers/UiDispatcher.desktop.kt diff --git a/core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/ktx/SavedStateHandleKtx.desktop.kt b/core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/ktx/SavedStateHandleKtx.desktop.kt new file mode 100644 index 000000000..89a92b25e --- /dev/null +++ b/core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/ktx/SavedStateHandleKtx.desktop.kt @@ -0,0 +1,5 @@ +package org.michaelbel.movies.common.ktx + +import androidx.lifecycle.SavedStateHandle + +fun SavedStateHandle.require(key: String): T = requireNotNull(this[key]) \ No newline at end of file diff --git a/core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/log/Logger.kt b/core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/log/Logger.desktop.kt similarity index 100% rename from core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/log/Logger.kt rename to core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/log/Logger.desktop.kt diff --git a/core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/viewmodel/BaseViewModel.kt b/core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/viewmodel/BaseViewModel.kt index 318ade70e..4a7260333 100644 --- a/core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/viewmodel/BaseViewModel.kt +++ b/core/common/src/desktopMain/kotlin/org/michaelbel/movies/common/viewmodel/BaseViewModel.kt @@ -3,13 +3,12 @@ package org.michaelbel.movies.common.viewmodel import androidx.annotation.CallSuper import androidx.lifecycle.ViewModel import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.SupervisorJob -import kotlinx.coroutines.swing.Swing +import org.michaelbel.movies.common.dispatchers.uiDispatcher import org.michaelbel.movies.common.log.log open class BaseViewModel: ViewModel( - viewModelScope = CoroutineScope(Dispatchers.Swing + SupervisorJob()) + viewModelScope = CoroutineScope(uiDispatcher + SupervisorJob()) ) { @CallSuper diff --git a/core/interactor/src/androidMain/kotlin/org/michaelbel/movies/interactor/di/InteractorBlockingKoinModule.kt b/core/interactor/src/androidMain/kotlin/org/michaelbel/movies/interactor/di/InteractorBlockingKoinModule.android.kt similarity index 100% rename from core/interactor/src/androidMain/kotlin/org/michaelbel/movies/interactor/di/InteractorBlockingKoinModule.kt rename to core/interactor/src/androidMain/kotlin/org/michaelbel/movies/interactor/di/InteractorBlockingKoinModule.android.kt diff --git a/core/interactor/src/androidMain/kotlin/org/michaelbel/movies/interactor/di/LocaleInteractorKoinModule.kt b/core/interactor/src/androidMain/kotlin/org/michaelbel/movies/interactor/di/LocaleInteractorKoinModule.android.kt similarity index 100% rename from core/interactor/src/androidMain/kotlin/org/michaelbel/movies/interactor/di/LocaleInteractorKoinModule.kt rename to core/interactor/src/androidMain/kotlin/org/michaelbel/movies/interactor/di/LocaleInteractorKoinModule.android.kt diff --git a/core/interactor/src/commonMain/kotlin/org/michaelbel/movies/interactor/MovieInteractor.kt b/core/interactor/src/commonMain/kotlin/org/michaelbel/movies/interactor/MovieInteractor.kt index 3467c9e06..3d45b4019 100644 --- a/core/interactor/src/commonMain/kotlin/org/michaelbel/movies/interactor/MovieInteractor.kt +++ b/core/interactor/src/commonMain/kotlin/org/michaelbel/movies/interactor/MovieInteractor.kt @@ -45,4 +45,6 @@ interface MovieInteractor { containerColor: Int, onContainerColor: Int ) + + suspend fun moviesResult(pagingKey: PagingKey): List } \ No newline at end of file diff --git a/core/interactor/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/MovieInteractorImpl.kt b/core/interactor/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/MovieInteractorImpl.kt index 37254f4d5..8b4033bab 100644 --- a/core/interactor/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/MovieInteractorImpl.kt +++ b/core/interactor/src/commonMain/kotlin/org/michaelbel/movies/interactor/impl/MovieInteractorImpl.kt @@ -7,6 +7,7 @@ import org.michaelbel.movies.interactor.LocaleInteractor import org.michaelbel.movies.interactor.MovieInteractor import org.michaelbel.movies.persistence.database.entity.mini.MovieDbMini import org.michaelbel.movies.persistence.database.entity.pojo.MoviePojo +import org.michaelbel.movies.persistence.database.ktx.moviePojo import org.michaelbel.movies.persistence.database.typealiases.Limit import org.michaelbel.movies.persistence.database.typealiases.MovieId import org.michaelbel.movies.persistence.database.typealiases.PagingKey @@ -72,4 +73,12 @@ internal class MovieInteractorImpl( movieRepository.updateMovieColors(movieId, containerColor, onContainerColor) } } + + override suspend fun moviesResult(pagingKey: PagingKey): List { + return withContext(dispatchers.io) { + movieRepository.moviesResult2(pagingKey, localeInteractor.language, 1).results.mapIndexed { index, movieResponse -> + movieResponse.moviePojo(pagingKey, index, 1) + } + } + } } \ No newline at end of file diff --git a/core/interactor/src/desktopMain/kotlin/org/michaelbel/movies/interactor/di/InteractorBlockingKoinModule.kt b/core/interactor/src/desktopMain/kotlin/org/michaelbel/movies/interactor/di/InteractorBlockingKoinModule.desktop.kt similarity index 100% rename from core/interactor/src/desktopMain/kotlin/org/michaelbel/movies/interactor/di/InteractorBlockingKoinModule.kt rename to core/interactor/src/desktopMain/kotlin/org/michaelbel/movies/interactor/di/InteractorBlockingKoinModule.desktop.kt diff --git a/core/interactor/src/desktopMain/kotlin/org/michaelbel/movies/interactor/di/InteractorLocaleKoinModule.kt b/core/interactor/src/desktopMain/kotlin/org/michaelbel/movies/interactor/di/InteractorLocaleKoinModule.desktop.kt similarity index 100% rename from core/interactor/src/desktopMain/kotlin/org/michaelbel/movies/interactor/di/InteractorLocaleKoinModule.kt rename to core/interactor/src/desktopMain/kotlin/org/michaelbel/movies/interactor/di/InteractorLocaleKoinModule.desktop.kt diff --git a/core/network/build.gradle.kts b/core/network/build.gradle.kts index 28769abc7..b78966818 100644 --- a/core/network/build.gradle.kts +++ b/core/network/build.gradle.kts @@ -1,12 +1,14 @@ import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties +import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.STRING plugins { alias(libs.plugins.kotlin.multiplatform) alias(libs.plugins.kotlin.serialization) alias(libs.plugins.android.library) + alias(libs.plugins.buildkonfig) } -val tmdbApiKey: String by lazy { +private val tmdbApiKey: String by lazy { gradleLocalProperties(rootDir, providers).getProperty("TMDB_API_KEY").orEmpty().ifEmpty { System.getenv("TMDB_API_KEY").orEmpty() } @@ -69,4 +71,12 @@ android { debugImplementation(libs.bundles.flaker.android) releaseImplementation(libs.bundles.flaker.noop.android) } +} + +buildkonfig { + packageName = "org.michaelbel.movies.network" + + defaultConfigs { + buildConfigField(STRING, "TMDB_API_KEY", tmdbApiKey) + } } \ No newline at end of file diff --git a/core/network/src/androidMain/kotlin/org/michaelbel/movies/network/config/TmdbConfig.kt b/core/network/src/androidMain/kotlin/org/michaelbel/movies/network/config/TmdbConfig.android.kt similarity index 88% rename from core/network/src/androidMain/kotlin/org/michaelbel/movies/network/config/TmdbConfig.kt rename to core/network/src/androidMain/kotlin/org/michaelbel/movies/network/config/TmdbConfig.android.kt index 7bdaed375..9c3dc9549 100644 --- a/core/network/src/androidMain/kotlin/org/michaelbel/movies/network/config/TmdbConfig.kt +++ b/core/network/src/androidMain/kotlin/org/michaelbel/movies/network/config/TmdbConfig.android.kt @@ -2,7 +2,7 @@ package org.michaelbel.movies.network.config import org.michaelbel.movies.network.BuildConfig -private val tmdbApiKey: String +actual val tmdbApiKey: String get() = BuildConfig.TMDB_API_KEY actual val isTmdbApiKeyEmpty: Boolean diff --git a/core/network/src/androidMain/kotlin/org/michaelbel/movies/network/ktor/di/KtorKoinModule.kt b/core/network/src/androidMain/kotlin/org/michaelbel/movies/network/ktor/di/KtorKoinModule.android.kt similarity index 100% rename from core/network/src/androidMain/kotlin/org/michaelbel/movies/network/ktor/di/KtorKoinModule.kt rename to core/network/src/androidMain/kotlin/org/michaelbel/movies/network/ktor/di/KtorKoinModule.android.kt diff --git a/core/network/src/commonMain/kotlin/org/michaelbel/movies/network/MovieNetworkService.kt b/core/network/src/commonMain/kotlin/org/michaelbel/movies/network/MovieNetworkService.kt index 8b366f18f..6fcce3198 100644 --- a/core/network/src/commonMain/kotlin/org/michaelbel/movies/network/MovieNetworkService.kt +++ b/core/network/src/commonMain/kotlin/org/michaelbel/movies/network/MovieNetworkService.kt @@ -30,4 +30,12 @@ class MovieNetworkService internal constructor( ): ImagesResponse { return ktorMovieService.images(movieId) } + + suspend fun movies2( + list: String, + language: String, + page: Int + ): Result { + return ktorMovieService.movies2(list, language, page) + } } \ No newline at end of file diff --git a/core/network/src/commonMain/kotlin/org/michaelbel/movies/network/config/TmdbConfig.kt b/core/network/src/commonMain/kotlin/org/michaelbel/movies/network/config/TmdbConfig.kt index 89ba76364..19dca9ad9 100644 --- a/core/network/src/commonMain/kotlin/org/michaelbel/movies/network/config/TmdbConfig.kt +++ b/core/network/src/commonMain/kotlin/org/michaelbel/movies/network/config/TmdbConfig.kt @@ -1,3 +1,5 @@ package org.michaelbel.movies.network.config +expect val tmdbApiKey: String + expect val isTmdbApiKeyEmpty: Boolean \ No newline at end of file diff --git a/core/network/src/commonMain/kotlin/org/michaelbel/movies/network/ktor/KtorMovieService.kt b/core/network/src/commonMain/kotlin/org/michaelbel/movies/network/ktor/KtorMovieService.kt index c8db3f5d7..96abe2e4d 100644 --- a/core/network/src/commonMain/kotlin/org/michaelbel/movies/network/ktor/KtorMovieService.kt +++ b/core/network/src/commonMain/kotlin/org/michaelbel/movies/network/ktor/KtorMovieService.kt @@ -4,6 +4,7 @@ import io.ktor.client.HttpClient import io.ktor.client.call.body import io.ktor.client.request.get import io.ktor.client.request.parameter +import org.michaelbel.movies.network.config.tmdbApiKey import org.michaelbel.movies.network.model.ImagesResponse import org.michaelbel.movies.network.model.Movie import org.michaelbel.movies.network.model.MovieResponse @@ -38,4 +39,16 @@ internal class KtorMovieService( ): ImagesResponse { return ktorHttpClient.get("movie/$movieId/images").body() } + + suspend fun movies2( + list: String, + language: String, + page: Int + ): Result { + return ktorHttpClient.get("movie/$list") { + parameter("api_key", tmdbApiKey) + parameter("language", language) + parameter("page", page) + }.body() + } } \ No newline at end of file diff --git a/core/network/src/desktopMain/kotlin/org/michaelbel/movies/network/config/TmdbConfig.desktop.kt b/core/network/src/desktopMain/kotlin/org/michaelbel/movies/network/config/TmdbConfig.desktop.kt new file mode 100644 index 000000000..9a32d73d1 --- /dev/null +++ b/core/network/src/desktopMain/kotlin/org/michaelbel/movies/network/config/TmdbConfig.desktop.kt @@ -0,0 +1,9 @@ +package org.michaelbel.movies.network.config + +import org.michaelbel.movies.network.BuildKonfig + +actual val tmdbApiKey: String + get() = BuildKonfig.TMDB_API_KEY + +actual val isTmdbApiKeyEmpty: Boolean + get() = tmdbApiKey.isEmpty() || tmdbApiKey == "null" \ No newline at end of file diff --git a/core/network/src/desktopMain/kotlin/org/michaelbel/movies/network/config/TmdbConfig.kt b/core/network/src/desktopMain/kotlin/org/michaelbel/movies/network/config/TmdbConfig.kt deleted file mode 100644 index 596938f77..000000000 --- a/core/network/src/desktopMain/kotlin/org/michaelbel/movies/network/config/TmdbConfig.kt +++ /dev/null @@ -1,4 +0,0 @@ -package org.michaelbel.movies.network.config - -actual val isTmdbApiKeyEmpty: Boolean - get() = true \ No newline at end of file diff --git a/core/network/src/desktopMain/kotlin/org/michaelbel/movies/network/ktor/di/KtorKoinModule.kt b/core/network/src/desktopMain/kotlin/org/michaelbel/movies/network/ktor/di/KtorKoinModule.desktop.kt similarity index 62% rename from core/network/src/desktopMain/kotlin/org/michaelbel/movies/network/ktor/di/KtorKoinModule.kt rename to core/network/src/desktopMain/kotlin/org/michaelbel/movies/network/ktor/di/KtorKoinModule.desktop.kt index 85fbd3a3e..58e922fcb 100644 --- a/core/network/src/desktopMain/kotlin/org/michaelbel/movies/network/ktor/di/KtorKoinModule.kt +++ b/core/network/src/desktopMain/kotlin/org/michaelbel/movies/network/ktor/di/KtorKoinModule.desktop.kt @@ -1,6 +1,7 @@ package org.michaelbel.movies.network.ktor.di import io.ktor.client.HttpClient +import io.ktor.client.plugins.HttpTimeout import io.ktor.client.plugins.contentnegotiation.ContentNegotiation import io.ktor.client.plugins.defaultRequest import io.ktor.http.ContentType @@ -10,9 +11,13 @@ import kotlinx.serialization.json.Json import org.koin.dsl.module import org.michaelbel.movies.network.config.TMDB_API_ENDPOINT +private const val REQUEST_TIMEOUT_MILLIS = 10_000L +private const val SOCKET_TIMEOUT_SECONDS = 10_000L +private const val CONNECT_TIMEOUT_MILLIS = 10_000L + actual val ktorKoinModule = module { single { - val ktor = HttpClient() { + val ktor = HttpClient { defaultRequest { contentType(ContentType.Application.Json) url(TMDB_API_ENDPOINT) @@ -20,6 +25,11 @@ actual val ktorKoinModule = module { install(ContentNegotiation) { json(Json { ignoreUnknownKeys = true }) } + install(HttpTimeout) { + requestTimeoutMillis = REQUEST_TIMEOUT_MILLIS + connectTimeoutMillis = CONNECT_TIMEOUT_MILLIS + socketTimeoutMillis = SOCKET_TIMEOUT_SECONDS + } } ktor } diff --git a/core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/database/di/DatabaseKoinModule.kt b/core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/database/di/DatabaseKoinModule.android.kt similarity index 100% rename from core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/database/di/DatabaseKoinModule.kt rename to core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/database/di/DatabaseKoinModule.android.kt diff --git a/core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/database/di/MoviesDatabaseKoinModule.kt b/core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/database/di/MoviesDatabaseKoinModule.android.kt similarity index 100% rename from core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/database/di/MoviesDatabaseKoinModule.kt rename to core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/database/di/MoviesDatabaseKoinModule.android.kt diff --git a/core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/database/di/PersistenceBlockingKoinModule.kt b/core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/database/di/PersistenceBlockingKoinModule.android.kt similarity index 100% rename from core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/database/di/PersistenceBlockingKoinModule.kt rename to core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/database/di/PersistenceBlockingKoinModule.android.kt diff --git a/core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/datastore/di/DataStoreKoinModule.kt b/core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/datastore/di/DataStoreKoinModule.android.kt similarity index 100% rename from core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/datastore/di/DataStoreKoinModule.kt rename to core/persistence/src/androidMain/kotlin/org/michaelbel/movies/persistence/datastore/di/DataStoreKoinModule.android.kt diff --git a/core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/database/di/DatabaseKoinModule.kt b/core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/database/di/DatabaseKoinModule.desktop.kt similarity index 100% rename from core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/database/di/DatabaseKoinModule.kt rename to core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/database/di/DatabaseKoinModule.desktop.kt diff --git a/core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/database/di/MoviesDatabaseKoinModule.kt b/core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/database/di/MoviesDatabaseKoinModule.desktop.kt similarity index 100% rename from core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/database/di/MoviesDatabaseKoinModule.kt rename to core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/database/di/MoviesDatabaseKoinModule.desktop.kt diff --git a/core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/database/di/PersistenceBlockingKoinModule.kt b/core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/database/di/PersistenceBlockingKoinModule.desktop.kt similarity index 100% rename from core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/database/di/PersistenceBlockingKoinModule.kt rename to core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/database/di/PersistenceBlockingKoinModule.desktop.kt diff --git a/core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/datastore/di/DataStoreKoinModule.kt b/core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/datastore/di/DataStoreKoinModule.desktop.kt similarity index 100% rename from core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/datastore/di/DataStoreKoinModule.kt rename to core/persistence/src/desktopMain/kotlin/org/michaelbel/movies/persistence/datastore/di/DataStoreKoinModule.desktop.kt diff --git a/core/repository/src/androidMain/kotlin/org/michaelbel/movies/repository/di/RepositoryBlockingKoinModule.kt b/core/repository/src/androidMain/kotlin/org/michaelbel/movies/repository/di/RepositoryBlockingKoinModule.android.kt similarity index 100% rename from core/repository/src/androidMain/kotlin/org/michaelbel/movies/repository/di/RepositoryBlockingKoinModule.kt rename to core/repository/src/androidMain/kotlin/org/michaelbel/movies/repository/di/RepositoryBlockingKoinModule.android.kt diff --git a/core/repository/src/androidMain/kotlin/org/michaelbel/movies/repository/ktx/BuildKtx.kt b/core/repository/src/androidMain/kotlin/org/michaelbel/movies/repository/ktx/BuildKtx.android.kt similarity index 100% rename from core/repository/src/androidMain/kotlin/org/michaelbel/movies/repository/ktx/BuildKtx.kt rename to core/repository/src/androidMain/kotlin/org/michaelbel/movies/repository/ktx/BuildKtx.android.kt diff --git a/core/repository/src/androidMain/kotlin/org/michaelbel/movies/repository/ktx/ExceptionKtx.kt b/core/repository/src/androidMain/kotlin/org/michaelbel/movies/repository/ktx/ExceptionKtx.android.kt similarity index 100% rename from core/repository/src/androidMain/kotlin/org/michaelbel/movies/repository/ktx/ExceptionKtx.kt rename to core/repository/src/androidMain/kotlin/org/michaelbel/movies/repository/ktx/ExceptionKtx.android.kt diff --git a/core/repository/src/commonMain/kotlin/org/michaelbel/movies/repository/MovieRepository.kt b/core/repository/src/commonMain/kotlin/org/michaelbel/movies/repository/MovieRepository.kt index 0be916333..25a130dd8 100644 --- a/core/repository/src/commonMain/kotlin/org/michaelbel/movies/repository/MovieRepository.kt +++ b/core/repository/src/commonMain/kotlin/org/michaelbel/movies/repository/MovieRepository.kt @@ -23,6 +23,12 @@ interface MovieRepository { page: Page ): Result + suspend fun moviesResult2( + pagingKey: PagingKey, + language: String, + page: Page + ): Result + suspend fun movie( pagingKey: PagingKey, movieId: MovieId diff --git a/core/repository/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/MovieRepositoryImpl.kt b/core/repository/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/MovieRepositoryImpl.kt index 51a2ead98..7227ff57b 100644 --- a/core/repository/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/MovieRepositoryImpl.kt +++ b/core/repository/src/commonMain/kotlin/org/michaelbel/movies/repository/impl/MovieRepositoryImpl.kt @@ -142,4 +142,20 @@ internal class MovieRepositoryImpl( ) { moviePersistence.updateMovieColors(movieId, containerColor, onContainerColor) } + + override suspend fun moviesResult2( + pagingKey: PagingKey, + language: String, + page: Page + ): Result { + if (isTmdbApiKeyEmpty && moviePersistence.isEmpty(MoviePojo.MOVIES_LOCAL_LIST)) { + checkApiKeyNotNullException() + } + + return movieNetworkService.movies2( + list = pagingKey, + language = language, + page = page + ) + } } \ No newline at end of file diff --git a/core/repository/src/desktopMain/kotlin/org/michaelbel/movies/repository/di/RepositoryBlockingKoinModule.kt b/core/repository/src/desktopMain/kotlin/org/michaelbel/movies/repository/di/RepositoryBlockingKoinModule.desktop.kt similarity index 100% rename from core/repository/src/desktopMain/kotlin/org/michaelbel/movies/repository/di/RepositoryBlockingKoinModule.kt rename to core/repository/src/desktopMain/kotlin/org/michaelbel/movies/repository/di/RepositoryBlockingKoinModule.desktop.kt diff --git a/core/repository/src/desktopMain/kotlin/org/michaelbel/movies/repository/ktx/BuildKtx.kt b/core/repository/src/desktopMain/kotlin/org/michaelbel/movies/repository/ktx/BuildKtx.desktop.kt similarity index 100% rename from core/repository/src/desktopMain/kotlin/org/michaelbel/movies/repository/ktx/BuildKtx.kt rename to core/repository/src/desktopMain/kotlin/org/michaelbel/movies/repository/ktx/BuildKtx.desktop.kt diff --git a/core/repository/src/desktopMain/kotlin/org/michaelbel/movies/repository/ktx/ExceptionKtx.kt b/core/repository/src/desktopMain/kotlin/org/michaelbel/movies/repository/ktx/ExceptionKtx.desktop.kt similarity index 100% rename from core/repository/src/desktopMain/kotlin/org/michaelbel/movies/repository/ktx/ExceptionKtx.kt rename to core/repository/src/desktopMain/kotlin/org/michaelbel/movies/repository/ktx/ExceptionKtx.desktop.kt diff --git a/core/ui/build.gradle.kts b/core/ui/build.gradle.kts index 4c2f2ccff..d6c482545 100644 --- a/core/ui/build.gradle.kts +++ b/core/ui/build.gradle.kts @@ -45,6 +45,10 @@ kotlin { api(libs.bundles.google.material.android) implementation(libs.bundles.paging.common) // fixme ломает navigation } + val desktopMain by getting + desktopMain.dependencies { + implementation(libs.bundles.kamel.desktop) + } } } diff --git a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieColumn.kt b/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieColumn.android.kt similarity index 100% rename from core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieColumn.kt rename to core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieColumn.android.kt diff --git a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieRow.kt b/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieRow.android.kt similarity index 100% rename from core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieRow.kt rename to core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieRow.android.kt diff --git a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/compose/page/PageContent.kt b/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/compose/page/PageContent.android.kt similarity index 100% rename from core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/compose/page/PageContent.kt rename to core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/compose/page/PageContent.android.kt diff --git a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/ConfigurationKtx.kt b/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/ConfigurationKtx.android.kt similarity index 100% rename from core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/ConfigurationKtx.kt rename to core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/ConfigurationKtx.android.kt diff --git a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/LazyPagingItemsKtx.kt b/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/LazyPagingItemsKtx.android.kt similarity index 100% rename from core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/LazyPagingItemsKtx.kt rename to core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/LazyPagingItemsKtx.android.kt diff --git a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/LifecycleKtx.kt b/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/LifecycleKtx.android.kt similarity index 100% rename from core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/LifecycleKtx.kt rename to core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/LifecycleKtx.android.kt diff --git a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/WindowInsetsKtx.kt b/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/WindowInsetsKtx.android.kt similarity index 100% rename from core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/WindowInsetsKtx.kt rename to core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/ktx/WindowInsetsKtx.android.kt diff --git a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/theme/Theme.kt b/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/theme/Theme.android.kt similarity index 100% rename from core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/theme/Theme.kt rename to core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/theme/Theme.android.kt diff --git a/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieColumn.desktop.kt b/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieColumn.desktop.kt new file mode 100644 index 000000000..82df204c6 --- /dev/null +++ b/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieColumn.desktop.kt @@ -0,0 +1,124 @@ +package org.michaelbel.movies.ui.compose.movie + +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.animation.fadeIn +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.dp +import androidx.constraintlayout.compose.ConstraintLayout +import androidx.constraintlayout.compose.Dimension +import io.kamel.image.KamelImage +import io.kamel.image.asyncPainterResource +import org.michaelbel.movies.common.theme.AppTheme +import org.michaelbel.movies.network.config.formatPosterImage +import org.michaelbel.movies.persistence.database.entity.pojo.MoviePojo +import org.michaelbel.movies.ui.theme.MoviesTheme + +@Composable +internal fun MovieColumn( + movie: MoviePojo, + modifier: Modifier = Modifier +) { + var isNoImageVisible by remember { mutableStateOf(false) } + + ConstraintLayout( + modifier = modifier + ) { + val (image, noImageText, text) = createRefs() + + KamelImage( + resource = asyncPainterResource(movie.posterPath.formatPosterImage), + contentDescription = null, + modifier = Modifier.constrainAs(image) { + width = Dimension.fillToConstraints + height = Dimension.value(220.dp) + start.linkTo(parent.start) + top.linkTo(parent.top) + end.linkTo(parent.end) + }, + onFailure = { + isNoImageVisible = true + }, + contentScale = ContentScale.Crop + ) + + AnimatedVisibility( + visible = isNoImageVisible, + modifier = Modifier.constrainAs(noImageText) { + width = Dimension.wrapContent + height = Dimension.wrapContent + start.linkTo(parent.start) + top.linkTo(parent.top) + end.linkTo(parent.end) + bottom.linkTo(text.top) + }, + enter = fadeIn() + ) { + Text( + text = "No image", + style = MaterialTheme.typography.bodyLarge.copy(MaterialTheme.colorScheme.secondary) + ) + } + + Text( + text = movie.title, + modifier = Modifier.constrainAs(text) { + width = Dimension.fillToConstraints + height = Dimension.wrapContent + start.linkTo(parent.start, 16.dp) + top.linkTo(image.bottom, 16.dp) + end.linkTo(parent.end, 16.dp) + bottom.linkTo(parent.bottom, 16.dp) + }, + maxLines = 10, + overflow = TextOverflow.Ellipsis, + style = MaterialTheme.typography.bodyLarge.copy(MaterialTheme.colorScheme.onPrimaryContainer) + ) + } +} + +@Composable +private fun MovieColumnPreview( + /*@PreviewParameter(MoviePreviewParameterProvider::class)*/ movie: MoviePojo +) { + MoviesTheme { + MovieColumn( + movie = movie, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp, vertical = 4.dp) + .clip(MaterialTheme.shapes.small) + .background(MaterialTheme.colorScheme.inversePrimary) + ) + } +} + +@Composable +private fun MovieColumnAmoledPreview( + /*@PreviewParameter(MoviePreviewParameterProvider::class)*/ movie: MoviePojo +) { + MoviesTheme( + theme = AppTheme.Amoled + ) { + MovieColumn( + movie = movie, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp, vertical = 4.dp) + .clip(MaterialTheme.shapes.small) + .background(MaterialTheme.colorScheme.inversePrimary) + ) + } +} \ No newline at end of file diff --git a/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieRow.desktop.kt b/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieRow.desktop.kt new file mode 100644 index 000000000..83d1529d2 --- /dev/null +++ b/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieRow.desktop.kt @@ -0,0 +1,125 @@ +package org.michaelbel.movies.ui.compose.movie + +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.animation.fadeIn +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.dp +import androidx.constraintlayout.compose.ConstraintLayout +import androidx.constraintlayout.compose.Dimension +import io.kamel.image.KamelImage +import io.kamel.image.asyncPainterResource +import org.michaelbel.movies.common.theme.AppTheme +import org.michaelbel.movies.network.config.formatBackdropImage +import org.michaelbel.movies.persistence.database.entity.pojo.MoviePojo +import org.michaelbel.movies.ui.theme.MoviesTheme + +@Composable +internal fun MovieRow( + movie: MoviePojo, + modifier: Modifier = Modifier, + maxLines: Int = 10 +) { + var isNoImageVisible by remember { mutableStateOf(false) } + + ConstraintLayout( + modifier = modifier + ) { + val (image, noImageText, text) = createRefs() + + KamelImage( + resource = asyncPainterResource(movie.backdropPath.formatBackdropImage), + contentDescription = null, + modifier = Modifier.constrainAs(image) { + width = Dimension.fillToConstraints + height = Dimension.value(220.dp) + start.linkTo(parent.start) + top.linkTo(parent.top) + end.linkTo(parent.end) + }, + onFailure = { + isNoImageVisible = true + }, + contentScale = ContentScale.Crop + ) + + AnimatedVisibility( + visible = isNoImageVisible, + modifier = Modifier.constrainAs(noImageText) { + width = Dimension.wrapContent + height = Dimension.wrapContent + start.linkTo(parent.start) + top.linkTo(parent.top) + end.linkTo(parent.end) + bottom.linkTo(text.top) + }, + enter = fadeIn() + ) { + Text( + text = "No image", + style = MaterialTheme.typography.bodyLarge.copy(MaterialTheme.colorScheme.secondary) + ) + } + + Text( + text = movie.title, + modifier = Modifier.constrainAs(text) { + width = Dimension.fillToConstraints + height = Dimension.wrapContent + start.linkTo(parent.start, 16.dp) + top.linkTo(image.bottom, 16.dp) + end.linkTo(parent.end, 16.dp) + bottom.linkTo(parent.bottom, 16.dp) + }, + maxLines = maxLines, + overflow = TextOverflow.Ellipsis, + style = MaterialTheme.typography.bodyLarge.copy(MaterialTheme.colorScheme.onPrimaryContainer) + ) + } +} + +@Composable +private fun MovieRowPreview( + /*@PreviewParameter(MoviePreviewParameterProvider::class)*/ movie: MoviePojo +) { + MoviesTheme { + MovieRow( + movie = movie, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp, vertical = 4.dp) + .clip(MaterialTheme.shapes.small) + .background(MaterialTheme.colorScheme.inversePrimary) + ) + } +} + +@Composable +private fun MovieRowAmoledPreview( + /*@PreviewParameter(MoviePreviewParameterProvider::class)*/ movie: MoviePojo +) { + MoviesTheme( + theme = AppTheme.Amoled + ) { + MovieRow( + movie = movie, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp, vertical = 4.dp) + .clip(MaterialTheme.shapes.small) + .background(MaterialTheme.colorScheme.inversePrimary) + ) + } +} \ No newline at end of file diff --git a/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/compose/page/PageContent.desktop.kt b/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/compose/page/PageContent.desktop.kt new file mode 100644 index 000000000..5f0ea1b2c --- /dev/null +++ b/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/compose/page/PageContent.desktop.kt @@ -0,0 +1,226 @@ +package org.michaelbel.movies.ui.compose.page + +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.LazyListState +import androidx.compose.foundation.lazy.grid.GridCells +import androidx.compose.foundation.lazy.grid.LazyGridState +import androidx.compose.foundation.lazy.grid.LazyVerticalGrid +import androidx.compose.foundation.lazy.grid.items +import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.lazy.staggeredgrid.LazyStaggeredGridState +import androidx.compose.foundation.lazy.staggeredgrid.LazyVerticalStaggeredGrid +import androidx.compose.foundation.lazy.staggeredgrid.StaggeredGridCells +import androidx.compose.foundation.lazy.staggeredgrid.items +import androidx.compose.material3.MaterialTheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.unit.dp +import org.michaelbel.movies.common.appearance.FeedView +import org.michaelbel.movies.persistence.database.entity.pojo.MoviePojo +import org.michaelbel.movies.ui.compose.movie.MovieColumn +import org.michaelbel.movies.ui.compose.movie.MovieRow +import org.michaelbel.movies.ui.ktx.PageContentColumnModifier +import org.michaelbel.movies.ui.ktx.PageContentGridModifier +import org.michaelbel.movies.ui.ktx.PageContentStaggeredGridModifier +import org.michaelbel.movies.ui.ktx.gridColumnsCount +import org.michaelbel.movies.ui.ktx.isPagingFailure +import org.michaelbel.movies.ui.ktx.isPagingLoading +import org.michaelbel.movies.ui.ktx.isPortrait +import org.michaelbel.movies.ui.ktx.retry + +@Composable +fun PageContent( + feedView: FeedView, + lazyListState: LazyListState, + lazyGridState: LazyGridState, + lazyStaggeredGridState: LazyStaggeredGridState, + pagingItems: List, + onMovieClick: (String, Int) -> Unit, + modifier: Modifier, + contentPadding: PaddingValues +) { + when (feedView) { + is FeedView.FeedList -> { + if (isPortrait) { + PageContentColumn( + lazyListState = lazyListState, + pagingItems = pagingItems, + onMovieClick = onMovieClick, + contentPadding = contentPadding, + modifier = modifier + ) + } else { + PageContentGrid( + lazyGridState = lazyGridState, + pagingItems = pagingItems, + onMovieClick = onMovieClick, + contentPadding = contentPadding, + modifier = modifier + ) + } + } + is FeedView.FeedGrid -> { + PageContentStaggeredGrid( + lazyStaggeredGridState = lazyStaggeredGridState, + pagingItems = pagingItems, + onMovieClick = onMovieClick, + contentPadding = contentPadding, + modifier = modifier + ) + } + } +} + +@Composable +private fun PageContentColumn( + lazyListState: LazyListState, + pagingItems: List, + onMovieClick: (String, Int) -> Unit, + contentPadding: PaddingValues, + modifier: Modifier = Modifier +) { + LazyColumn( + modifier = modifier.padding(top = 4.dp), + state = lazyListState, + contentPadding = contentPadding + ) { + items( + pagingItems + ) { movieDb -> + MovieRow( + movie = movieDb, + modifier = PageContentColumnModifier.then(Modifier.clickable { onMovieClick(movieDb.movieList, movieDb.movieId) }) + ) + } + pagingItems.apply { + when { + isPagingLoading -> { + item { + PagingLoadingBox( + modifier = Modifier.fillMaxWidth().height(80.dp) + ) + } + } + isPagingFailure -> { + item { + PagingFailureBox( + modifier = Modifier + .fillMaxWidth() + .height(80.dp) + .padding(start = 8.dp, top = 4.dp, end = 8.dp) + .clip(MaterialTheme.shapes.small) + .clickable { retry() } + ) + } + } + } + } + } +} + +@Composable +private fun PageContentGrid( + lazyGridState: LazyGridState, + pagingItems: List, + onMovieClick: (String, Int) -> Unit, + contentPadding: PaddingValues, + modifier: Modifier = Modifier +) { + LazyVerticalGrid( + columns = GridCells.Fixed(2), + modifier = modifier.padding(start = 8.dp, top = 4.dp, end = 8.dp), + state = lazyGridState, + contentPadding = contentPadding, + horizontalArrangement = Arrangement.spacedBy(8.dp) + ) { + items( + pagingItems + ) { movieDb -> + MovieRow( + movie = movieDb, + maxLines = 1, + modifier = PageContentGridModifier.then(Modifier.clickable { onMovieClick(movieDb.movieList, movieDb.movieId) }) + ) + } + pagingItems.apply { + when { + isPagingLoading -> { + item { + PagingLoadingBox( + modifier = Modifier.fillMaxWidth().height(80.dp) + + ) + } + } + isPagingFailure -> { + item { + PagingFailureBox( + modifier = Modifier + .fillMaxWidth() + .height(80.dp) + .clip(MaterialTheme.shapes.small) + .clickable { retry() } + ) + } + } + } + } + } +} + +@Composable +private fun PageContentStaggeredGrid( + lazyStaggeredGridState: LazyStaggeredGridState, + pagingItems: List, + onMovieClick: (String, Int) -> Unit, + contentPadding: PaddingValues, + modifier: Modifier = Modifier +) { + LazyVerticalStaggeredGrid( + columns = StaggeredGridCells.Fixed(gridColumnsCount), + modifier = modifier.padding(start = 8.dp, top = 8.dp, end = 8.dp), + state = lazyStaggeredGridState, + contentPadding = contentPadding, + verticalItemSpacing = 8.dp, + horizontalArrangement = Arrangement.spacedBy(8.dp) + ) { + items( + pagingItems + ) { movieDb -> + MovieColumn( + movie = movieDb, + modifier = PageContentStaggeredGridModifier.then(Modifier.clickable { onMovieClick(movieDb.movieList, movieDb.movieId) }) + ) + } + pagingItems.apply { + when { + isPagingLoading -> { + item { + PagingLoadingBox( + modifier = Modifier.fillMaxWidth().height(80.dp) + + ) + } + } + isPagingFailure -> { + item { + PagingFailureBox( + modifier = Modifier + .fillMaxWidth() + .height(80.dp) + .clip(MaterialTheme.shapes.small) + .clickable { retry() } + ) + } + } + } + } + } +} \ No newline at end of file diff --git a/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/ktx/ConfigurationKtx.kt b/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/ktx/ConfigurationKtx.desktop.kt similarity index 100% rename from core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/ktx/ConfigurationKtx.kt rename to core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/ktx/ConfigurationKtx.desktop.kt diff --git a/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/ktx/LazyPagingItemsKtx.desktop.kt b/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/ktx/LazyPagingItemsKtx.desktop.kt new file mode 100644 index 000000000..c92b59428 --- /dev/null +++ b/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/ktx/LazyPagingItemsKtx.desktop.kt @@ -0,0 +1,9 @@ +package org.michaelbel.movies.ui.ktx + +internal val isPagingLoading: Boolean + get() = false + +internal val isPagingFailure: Boolean + get() = false + +internal fun retry() {} \ No newline at end of file diff --git a/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/ktx/LifecycleKtx.kt b/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/ktx/LifecycleKtx.desktop.kt similarity index 100% rename from core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/ktx/LifecycleKtx.kt rename to core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/ktx/LifecycleKtx.desktop.kt diff --git a/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/ktx/WindowInsetsKtx.kt b/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/ktx/WindowInsetsKtx.desktop.kt similarity index 100% rename from core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/ktx/WindowInsetsKtx.kt rename to core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/ktx/WindowInsetsKtx.desktop.kt diff --git a/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/theme/Theme.kt b/core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/theme/Theme.desktop.kt similarity index 100% rename from core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/theme/Theme.kt rename to core/ui/src/desktopMain/kotlin/org/michaelbel/movies/ui/theme/Theme.desktop.kt diff --git a/core/widget/src/androidMain/kotlin/org/michaelbel/movies/widget/configure/AppWidgetConfigureActivityContent.kt b/core/widget/src/androidMain/kotlin/org/michaelbel/movies/widget/configure/AppWidgetConfigureActivityContent.kt index 8d177c3c1..cc37979b5 100644 --- a/core/widget/src/androidMain/kotlin/org/michaelbel/movies/widget/configure/AppWidgetConfigureActivityContent.kt +++ b/core/widget/src/androidMain/kotlin/org/michaelbel/movies/widget/configure/AppWidgetConfigureActivityContent.kt @@ -21,9 +21,9 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow -import androidx.lifecycle.compose.collectAsStateWithLifecycle import org.koin.androidx.compose.koinViewModel import org.michaelbel.movies.ui.compose.iconbutton.CloseIcon +import org.michaelbel.movies.ui.ktx.collectAsStateCommon import org.michaelbel.movies.ui.ktx.displayCutoutWindowInsets import org.michaelbel.movies.ui.theme.MoviesTheme import org.michaelbel.movies.widget.R @@ -34,7 +34,7 @@ internal fun AppWidgetConfigureActivityContent( enableEdgeToEdge: (Any, Any) -> Unit, onBackClick: () -> Unit ) { - val themeData by viewModel.themeData.collectAsStateWithLifecycle() + val themeData by viewModel.themeData.collectAsStateCommon() val topAppBarScrollBehavior = TopAppBarDefaults.pinnedScrollBehavior() diff --git a/desktopApp/src/jvmMain/kotlin/org/michaelbel/movies/MainWindow.kt b/desktopApp/src/jvmMain/kotlin/org/michaelbel/movies/MainWindow.kt index b9803cfa2..31ce1376e 100644 --- a/desktopApp/src/jvmMain/kotlin/org/michaelbel/movies/MainWindow.kt +++ b/desktopApp/src/jvmMain/kotlin/org/michaelbel/movies/MainWindow.kt @@ -3,7 +3,6 @@ package org.michaelbel.movies import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.DisposableEffect -import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.window.Window @@ -17,6 +16,7 @@ import org.michaelbel.movies.common.ThemeData import org.michaelbel.movies.di.appKoinModule import org.michaelbel.movies.main.MainContent import org.michaelbel.movies.main.MainViewModel +import org.michaelbel.movies.ui.ktx.collectAsStateCommon import org.michaelbel.movies.ui.theme.MoviesTheme fun main() = application { @@ -38,7 +38,7 @@ private fun App() { } ) { val viewModel = koinInject() - val themeData by viewModel.themeData.collectAsState() + val themeData by viewModel.themeData.collectAsStateCommon() withViewModelStoreOwner { MoviesTheme( diff --git a/feature/account-impl/src/androidMain/kotlin/org/michaelbel/movies/account/ui/AccountRoute.kt b/feature/account-impl/src/androidMain/kotlin/org/michaelbel/movies/account/ui/AccountRoute.android.kt similarity index 84% rename from feature/account-impl/src/androidMain/kotlin/org/michaelbel/movies/account/ui/AccountRoute.kt rename to feature/account-impl/src/androidMain/kotlin/org/michaelbel/movies/account/ui/AccountRoute.android.kt index f35a89a84..0806af7aa 100644 --- a/feature/account-impl/src/androidMain/kotlin/org/michaelbel/movies/account/ui/AccountRoute.kt +++ b/feature/account-impl/src/androidMain/kotlin/org/michaelbel/movies/account/ui/AccountRoute.android.kt @@ -3,10 +3,10 @@ package org.michaelbel.movies.account.ui import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier -import androidx.lifecycle.compose.collectAsStateWithLifecycle import org.koin.androidx.compose.koinViewModel import org.michaelbel.movies.account.AccountViewModel import org.michaelbel.movies.persistence.database.ktx.orEmpty +import org.michaelbel.movies.ui.ktx.collectAsStateCommon @Composable fun AccountRoute( @@ -14,7 +14,7 @@ fun AccountRoute( modifier: Modifier = Modifier, viewModel: AccountViewModel = koinViewModel() ) { - val account by viewModel.account.collectAsStateWithLifecycle() + val account by viewModel.account.collectAsStateCommon() AccountScreenContent( account = account.orEmpty, diff --git a/feature/account-impl/src/desktopMain/kotlin/org/michaelbel/movies/account/ui/AccountRoute.kt b/feature/account-impl/src/desktopMain/kotlin/org/michaelbel/movies/account/ui/AccountRoute.desktop.kt similarity index 85% rename from feature/account-impl/src/desktopMain/kotlin/org/michaelbel/movies/account/ui/AccountRoute.kt rename to feature/account-impl/src/desktopMain/kotlin/org/michaelbel/movies/account/ui/AccountRoute.desktop.kt index 50b1df390..36b4e9ab1 100644 --- a/feature/account-impl/src/desktopMain/kotlin/org/michaelbel/movies/account/ui/AccountRoute.kt +++ b/feature/account-impl/src/desktopMain/kotlin/org/michaelbel/movies/account/ui/AccountRoute.desktop.kt @@ -1,12 +1,12 @@ package org.michaelbel.movies.account.ui import androidx.compose.runtime.Composable -import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import org.koin.compose.koinInject import org.michaelbel.movies.account.AccountViewModel import org.michaelbel.movies.persistence.database.ktx.orEmpty +import org.michaelbel.movies.ui.ktx.collectAsStateCommon @Composable fun AccountRoute( @@ -14,7 +14,7 @@ fun AccountRoute( modifier: Modifier = Modifier, viewModel: AccountViewModel = koinInject() ) { - val account by viewModel.account.collectAsState() + val account by viewModel.account.collectAsStateCommon() AccountScreenContent( account = account.orEmpty, diff --git a/feature/account/src/androidMain/kotlin/org/michaelbel/movies/account/AccountNavigation.kt b/feature/account/src/androidMain/kotlin/org/michaelbel/movies/account/AccountNavigation.android.kt similarity index 100% rename from feature/account/src/androidMain/kotlin/org/michaelbel/movies/account/AccountNavigation.kt rename to feature/account/src/androidMain/kotlin/org/michaelbel/movies/account/AccountNavigation.android.kt diff --git a/feature/account/src/desktopMain/kotlin/org/michaelbel/movies/account/AccountNavigation.kt b/feature/account/src/desktopMain/kotlin/org/michaelbel/movies/account/AccountNavigation.desktop.kt similarity index 100% rename from feature/account/src/desktopMain/kotlin/org/michaelbel/movies/account/AccountNavigation.kt rename to feature/account/src/desktopMain/kotlin/org/michaelbel/movies/account/AccountNavigation.desktop.kt diff --git a/feature/auth-impl/build.gradle.kts b/feature/auth-impl/build.gradle.kts index 79e5274e9..4235464e2 100644 --- a/feature/auth-impl/build.gradle.kts +++ b/feature/auth-impl/build.gradle.kts @@ -31,6 +31,14 @@ kotlin { implementation(compose.material3) implementation(libs.bundles.constraintlayout.common) } + val desktopMain by getting + desktopMain.dependencies { + implementation(compose.foundation) + implementation(compose.material) + implementation(compose.material3) + implementation(compose.runtime) + implementation(libs.koin.compose) + } } } diff --git a/feature/auth-impl/src/androidMain/kotlin/org/michaelbel/movies/auth/di/AuthKoinModule.kt b/feature/auth-impl/src/androidMain/kotlin/org/michaelbel/movies/auth/di/AuthKoinModule.android.kt similarity index 89% rename from feature/auth-impl/src/androidMain/kotlin/org/michaelbel/movies/auth/di/AuthKoinModule.kt rename to feature/auth-impl/src/androidMain/kotlin/org/michaelbel/movies/auth/di/AuthKoinModule.android.kt index 17f8e3924..dbdb2bcb8 100644 --- a/feature/auth-impl/src/androidMain/kotlin/org/michaelbel/movies/auth/di/AuthKoinModule.kt +++ b/feature/auth-impl/src/androidMain/kotlin/org/michaelbel/movies/auth/di/AuthKoinModule.android.kt @@ -5,7 +5,7 @@ import org.koin.dsl.module import org.michaelbel.movies.auth.AuthViewModel import org.michaelbel.movies.interactor.di.interactorKoinModule -val authKoinModule = module { +actual val authKoinModule = module { includes( interactorKoinModule ) diff --git a/feature/auth-impl/src/androidMain/kotlin/org/michaelbel/movies/auth/ui/AuthRoute.kt b/feature/auth-impl/src/androidMain/kotlin/org/michaelbel/movies/auth/ui/AuthRoute.android.kt similarity index 100% rename from feature/auth-impl/src/androidMain/kotlin/org/michaelbel/movies/auth/ui/AuthRoute.kt rename to feature/auth-impl/src/androidMain/kotlin/org/michaelbel/movies/auth/ui/AuthRoute.android.kt diff --git a/feature/auth-impl/src/commonMain/kotlin/org/michaelbel/movies/auth/di/AuthKoinModule.kt b/feature/auth-impl/src/commonMain/kotlin/org/michaelbel/movies/auth/di/AuthKoinModule.kt new file mode 100644 index 000000000..e8db6385d --- /dev/null +++ b/feature/auth-impl/src/commonMain/kotlin/org/michaelbel/movies/auth/di/AuthKoinModule.kt @@ -0,0 +1,5 @@ +package org.michaelbel.movies.auth.di + +import org.koin.core.module.Module + +expect val authKoinModule: Module \ No newline at end of file diff --git a/feature/auth-impl/src/desktopMain/kotlin/org/michaelbel/movies/auth/AuthViewModel.kt b/feature/auth-impl/src/desktopMain/kotlin/org/michaelbel/movies/auth/AuthViewModel.kt new file mode 100644 index 000000000..7fcd317b1 --- /dev/null +++ b/feature/auth-impl/src/desktopMain/kotlin/org/michaelbel/movies/auth/AuthViewModel.kt @@ -0,0 +1,10 @@ +package org.michaelbel.movies.auth + +import org.michaelbel.movies.common.viewmodel.BaseViewModel +import org.michaelbel.movies.interactor.Interactor + +class AuthViewModel( + private val interactor: Interactor +): BaseViewModel() { + +} \ No newline at end of file diff --git a/feature/auth-impl/src/desktopMain/kotlin/org/michaelbel/movies/auth/di/AuthKoinModule.kt b/feature/auth-impl/src/desktopMain/kotlin/org/michaelbel/movies/auth/di/AuthKoinModule.desktop.kt similarity index 59% rename from feature/auth-impl/src/desktopMain/kotlin/org/michaelbel/movies/auth/di/AuthKoinModule.kt rename to feature/auth-impl/src/desktopMain/kotlin/org/michaelbel/movies/auth/di/AuthKoinModule.desktop.kt index 4234c73ea..8ea5b7175 100644 --- a/feature/auth-impl/src/desktopMain/kotlin/org/michaelbel/movies/auth/di/AuthKoinModule.kt +++ b/feature/auth-impl/src/desktopMain/kotlin/org/michaelbel/movies/auth/di/AuthKoinModule.desktop.kt @@ -1,10 +1,12 @@ package org.michaelbel.movies.auth.di import org.koin.dsl.module +import org.michaelbel.movies.auth.AuthViewModel import org.michaelbel.movies.interactor.di.interactorKoinModule -val authKoinModule = module { +actual val authKoinModule = module { includes( interactorKoinModule ) + single { AuthViewModel(get()) } } \ No newline at end of file diff --git a/feature/auth-impl/src/desktopMain/kotlin/org/michaelbel/movies/auth/ui/AuthRoute.kt b/feature/auth-impl/src/desktopMain/kotlin/org/michaelbel/movies/auth/ui/AuthRoute.desktop.kt similarity index 77% rename from feature/auth-impl/src/desktopMain/kotlin/org/michaelbel/movies/auth/ui/AuthRoute.kt rename to feature/auth-impl/src/desktopMain/kotlin/org/michaelbel/movies/auth/ui/AuthRoute.desktop.kt index eaad0153c..e52495e92 100644 --- a/feature/auth-impl/src/desktopMain/kotlin/org/michaelbel/movies/auth/ui/AuthRoute.kt +++ b/feature/auth-impl/src/desktopMain/kotlin/org/michaelbel/movies/auth/ui/AuthRoute.desktop.kt @@ -2,12 +2,15 @@ package org.michaelbel.movies.auth.ui import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import org.koin.compose.koinInject +import org.michaelbel.movies.auth.AuthViewModel import org.michaelbel.movies.common.browser.openUrl @Composable fun AuthRoute( onBackClick: () -> Unit, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, + viewModel: AuthViewModel = koinInject() ) { AuthScreenContent( error = null, diff --git a/feature/auth/src/androidMain/kotlin/org/michaelbel/movies/auth/AuthNavigation.kt b/feature/auth/src/androidMain/kotlin/org/michaelbel/movies/auth/AuthNavigation.android.kt similarity index 100% rename from feature/auth/src/androidMain/kotlin/org/michaelbel/movies/auth/AuthNavigation.kt rename to feature/auth/src/androidMain/kotlin/org/michaelbel/movies/auth/AuthNavigation.android.kt diff --git a/feature/auth/src/androidMain/kotlin/org/michaelbel/movies/auth/Settings.kt b/feature/auth/src/androidMain/kotlin/org/michaelbel/movies/auth/Settings.android.kt similarity index 100% rename from feature/auth/src/androidMain/kotlin/org/michaelbel/movies/auth/Settings.kt rename to feature/auth/src/androidMain/kotlin/org/michaelbel/movies/auth/Settings.android.kt diff --git a/feature/auth/src/desktopMain/kotlin/org/michaelbel/movies/auth/AuthNavigation.kt b/feature/auth/src/desktopMain/kotlin/org/michaelbel/movies/auth/AuthNavigation.desktop.kt similarity index 100% rename from feature/auth/src/desktopMain/kotlin/org/michaelbel/movies/auth/AuthNavigation.kt rename to feature/auth/src/desktopMain/kotlin/org/michaelbel/movies/auth/AuthNavigation.desktop.kt diff --git a/feature/auth/src/desktopMain/kotlin/org/michaelbel/movies/auth/Settings.kt b/feature/auth/src/desktopMain/kotlin/org/michaelbel/movies/auth/Settings.desktop.kt similarity index 100% rename from feature/auth/src/desktopMain/kotlin/org/michaelbel/movies/auth/Settings.kt rename to feature/auth/src/desktopMain/kotlin/org/michaelbel/movies/auth/Settings.desktop.kt diff --git a/feature/debug-impl/src/androidMain/kotlin/org/michaelbel/movies/debug/ui/DebugActivityContent.kt b/feature/debug-impl/src/androidMain/kotlin/org/michaelbel/movies/debug/ui/DebugActivityContent.kt index 958df03be..5bfc5b9fa 100644 --- a/feature/debug-impl/src/androidMain/kotlin/org/michaelbel/movies/debug/ui/DebugActivityContent.kt +++ b/feature/debug-impl/src/androidMain/kotlin/org/michaelbel/movies/debug/ui/DebugActivityContent.kt @@ -28,12 +28,12 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.unit.dp -import androidx.lifecycle.compose.collectAsStateWithLifecycle import org.koin.androidx.compose.koinViewModel import org.michaelbel.movies.common.ktx.appSettingsIntent import org.michaelbel.movies.debug.DebugViewModel import org.michaelbel.movies.debug_impl.R import org.michaelbel.movies.ui.icons.MoviesAndroidIcons +import org.michaelbel.movies.ui.ktx.collectAsStateCommon import org.michaelbel.movies.ui.theme.MoviesTheme @Composable @@ -41,8 +41,8 @@ internal fun DebugActivityContent( viewModel: DebugViewModel = koinViewModel(), enableEdgeToEdge: (Any, Any) -> Unit ) { - val themeData by viewModel.themeDataFlow.collectAsStateWithLifecycle() - val firebaseToken by viewModel.firebaseTokenFlow.collectAsStateWithLifecycle("") + val themeData by viewModel.themeDataFlow.collectAsStateCommon() + val firebaseToken by viewModel.firebaseTokenFlow.collectAsStateCommon() val context = LocalContext.current val clipboardManager = LocalClipboardManager.current diff --git a/feature/details-impl/build.gradle.kts b/feature/details-impl/build.gradle.kts index 0ef932fe3..35ed03094 100644 --- a/feature/details-impl/build.gradle.kts +++ b/feature/details-impl/build.gradle.kts @@ -31,6 +31,14 @@ kotlin { implementation(compose.material3) implementation(libs.bundles.constraintlayout.common) } + val desktopMain by getting + desktopMain.dependencies { + implementation(compose.foundation) + implementation(compose.material) + implementation(compose.material3) + implementation(compose.runtime) + implementation(libs.koin.compose) + } } } diff --git a/feature/details-impl/src/androidMain/kotlin/org/michaelbel/movies/details/di/DetailsKoinModule.kt b/feature/details-impl/src/androidMain/kotlin/org/michaelbel/movies/details/di/DetailsKoinModule.android.kt similarity index 91% rename from feature/details-impl/src/androidMain/kotlin/org/michaelbel/movies/details/di/DetailsKoinModule.kt rename to feature/details-impl/src/androidMain/kotlin/org/michaelbel/movies/details/di/DetailsKoinModule.android.kt index 4f21c6e39..7f88d2d44 100644 --- a/feature/details-impl/src/androidMain/kotlin/org/michaelbel/movies/details/di/DetailsKoinModule.kt +++ b/feature/details-impl/src/androidMain/kotlin/org/michaelbel/movies/details/di/DetailsKoinModule.android.kt @@ -6,7 +6,7 @@ import org.michaelbel.movies.details.DetailsViewModel import org.michaelbel.movies.interactor.di.interactorKoinModule import org.michaelbel.movies.network.connectivity.di.networkManagerKoinModule -val detailsKoinModule = module { +actual val detailsKoinModule = module { includes( interactorKoinModule, networkManagerKoinModule diff --git a/feature/details-impl/src/androidMain/kotlin/org/michaelbel/movies/details/ui/DetailsRoute.kt b/feature/details-impl/src/androidMain/kotlin/org/michaelbel/movies/details/ui/DetailsRoute.android.kt similarity index 85% rename from feature/details-impl/src/androidMain/kotlin/org/michaelbel/movies/details/ui/DetailsRoute.kt rename to feature/details-impl/src/androidMain/kotlin/org/michaelbel/movies/details/ui/DetailsRoute.android.kt index e1dff9e55..15b875a2a 100644 --- a/feature/details-impl/src/androidMain/kotlin/org/michaelbel/movies/details/ui/DetailsRoute.kt +++ b/feature/details-impl/src/androidMain/kotlin/org/michaelbel/movies/details/ui/DetailsRoute.android.kt @@ -8,12 +8,12 @@ import androidx.activity.result.contract.ActivityResultContracts import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier -import androidx.lifecycle.compose.collectAsStateWithLifecycle import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.stringResource import org.koin.androidx.compose.koinViewModel import org.michaelbel.movies.common.theme.AppTheme import org.michaelbel.movies.details.DetailsViewModel +import org.michaelbel.movies.ui.ktx.collectAsStateCommon import org.michaelbel.movies.ui.strings.MoviesStrings @Composable @@ -23,9 +23,9 @@ fun DetailsRoute( modifier: Modifier = Modifier, viewModel: DetailsViewModel = koinViewModel() ) { - val detailsState by viewModel.detailsState.collectAsStateWithLifecycle() - val networkStatus by viewModel.networkStatus.collectAsStateWithLifecycle() - val currentTheme by viewModel.currentTheme.collectAsStateWithLifecycle() + val detailsState by viewModel.detailsState.collectAsStateCommon() + val networkStatus by viewModel.networkStatus.collectAsStateCommon() + val currentTheme by viewModel.currentTheme.collectAsStateCommon() val resultContract = rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) {} val shareTitle = stringResource(MoviesStrings.share_via) diff --git a/feature/details-impl/src/commonMain/kotlin/org/michaelbel/movies/details/di/DetailsKoinModule.kt b/feature/details-impl/src/commonMain/kotlin/org/michaelbel/movies/details/di/DetailsKoinModule.kt new file mode 100644 index 000000000..d8229515d --- /dev/null +++ b/feature/details-impl/src/commonMain/kotlin/org/michaelbel/movies/details/di/DetailsKoinModule.kt @@ -0,0 +1,5 @@ +package org.michaelbel.movies.details.di + +import org.koin.core.module.Module + +expect val detailsKoinModule: Module \ No newline at end of file diff --git a/feature/details-impl/src/desktopMain/kotlin/org/michaelbel/movies/details/DetailsViewModel.kt b/feature/details-impl/src/desktopMain/kotlin/org/michaelbel/movies/details/DetailsViewModel.kt new file mode 100644 index 000000000..a4a58c6f5 --- /dev/null +++ b/feature/details-impl/src/desktopMain/kotlin/org/michaelbel/movies/details/DetailsViewModel.kt @@ -0,0 +1,17 @@ +package org.michaelbel.movies.details + +import androidx.lifecycle.SavedStateHandle +import org.michaelbel.movies.common.ktx.require +import org.michaelbel.movies.common.viewmodel.BaseViewModel +import org.michaelbel.movies.interactor.Interactor +import org.michaelbel.movies.persistence.database.typealiases.MovieId +import org.michaelbel.movies.persistence.database.typealiases.PagingKey + +class DetailsViewModel( + savedStateHandle: SavedStateHandle, + private val interactor: Interactor +): BaseViewModel() { + + private val movieList: PagingKey? = savedStateHandle["movieList"] + private val movieId: MovieId = savedStateHandle.require("movieId") +} \ No newline at end of file diff --git a/feature/details-impl/src/desktopMain/kotlin/org/michaelbel/movies/details/di/DetailsKoinModule.kt b/feature/details-impl/src/desktopMain/kotlin/org/michaelbel/movies/details/di/DetailsKoinModule.desktop.kt similarity index 82% rename from feature/details-impl/src/desktopMain/kotlin/org/michaelbel/movies/details/di/DetailsKoinModule.kt rename to feature/details-impl/src/desktopMain/kotlin/org/michaelbel/movies/details/di/DetailsKoinModule.desktop.kt index d4f94cde5..2f4a8ea8b 100644 --- a/feature/details-impl/src/desktopMain/kotlin/org/michaelbel/movies/details/di/DetailsKoinModule.kt +++ b/feature/details-impl/src/desktopMain/kotlin/org/michaelbel/movies/details/di/DetailsKoinModule.desktop.kt @@ -3,7 +3,7 @@ package org.michaelbel.movies.details.di import org.koin.dsl.module import org.michaelbel.movies.interactor.di.interactorKoinModule -val detailsKoinModule = module { +actual val detailsKoinModule = module { includes( interactorKoinModule ) diff --git a/feature/details-impl/src/desktopMain/kotlin/org/michaelbel/movies/details/ui/DetailsRoute.desktop.kt b/feature/details-impl/src/desktopMain/kotlin/org/michaelbel/movies/details/ui/DetailsRoute.desktop.kt new file mode 100644 index 000000000..d05571ea0 --- /dev/null +++ b/feature/details-impl/src/desktopMain/kotlin/org/michaelbel/movies/details/ui/DetailsRoute.desktop.kt @@ -0,0 +1,25 @@ +package org.michaelbel.movies.details.ui + +import androidx.compose.foundation.clickable +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.lifecycle.createSavedStateHandle +import androidx.lifecycle.viewmodel.compose.viewModel +import org.koin.compose.koinInject +import org.michaelbel.movies.details.DetailsViewModel +import org.michaelbel.movies.interactor.Interactor + +@Composable +fun DetailsRoute( + onBackClick: () -> Unit, + onNavigateToGallery: (Int) -> Unit, + modifier: Modifier = Modifier, + interactor: Interactor = koinInject(), + viewModel: DetailsViewModel = viewModel { DetailsViewModel(createSavedStateHandle(), interactor) } +) { + Text( + text = "Details", + modifier = Modifier.clickable { onBackClick() } + ) +} \ No newline at end of file diff --git a/feature/details/src/androidMain/kotlin/org/michaelbel/movies/details/DetailsNavigation.kt b/feature/details/src/androidMain/kotlin/org/michaelbel/movies/details/DetailsNavigation.android.kt similarity index 95% rename from feature/details/src/androidMain/kotlin/org/michaelbel/movies/details/DetailsNavigation.kt rename to feature/details/src/androidMain/kotlin/org/michaelbel/movies/details/DetailsNavigation.android.kt index a382c468c..1acb73d04 100644 --- a/feature/details/src/androidMain/kotlin/org/michaelbel/movies/details/DetailsNavigation.kt +++ b/feature/details/src/androidMain/kotlin/org/michaelbel/movies/details/DetailsNavigation.android.kt @@ -25,7 +25,7 @@ fun NavGraphBuilder.detailsGraph( type = NavType.StringType nullable = true }, - navArgument("movieId") { type = NavType.LongType }, + navArgument("movieId") { type = NavType.LongType } ), deepLinks = listOf( navDeepLink { uriPattern = "https://www.themoviedb.org/movie/{movieId}" }, diff --git a/feature/details/src/desktopMain/kotlin/org/michaelbel/movies/details/DetailsNavigation.kt b/feature/details/src/desktopMain/kotlin/org/michaelbel/movies/details/DetailsNavigation.desktop.kt similarity index 54% rename from feature/details/src/desktopMain/kotlin/org/michaelbel/movies/details/DetailsNavigation.kt rename to feature/details/src/desktopMain/kotlin/org/michaelbel/movies/details/DetailsNavigation.desktop.kt index e3e7810e2..7348d46cf 100644 --- a/feature/details/src/desktopMain/kotlin/org/michaelbel/movies/details/DetailsNavigation.kt +++ b/feature/details/src/desktopMain/kotlin/org/michaelbel/movies/details/DetailsNavigation.desktop.kt @@ -1,11 +1,11 @@ package org.michaelbel.movies.details -import androidx.compose.foundation.clickable -import androidx.compose.material.Text -import androidx.compose.ui.Modifier import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavType import androidx.navigation.compose.composable +import androidx.navigation.navArgument +import org.michaelbel.movies.details.ui.DetailsRoute import org.michaelbel.movies.persistence.database.typealiases.MovieId import org.michaelbel.movies.persistence.database.typealiases.PagingKey @@ -18,11 +18,18 @@ fun NavGraphBuilder.detailsGraph( navigateToGallery: (MovieId) -> Unit ) { composable( - route = DetailsDestination.route + route = DetailsDestination.route, + arguments = listOf( + navArgument("movieList") { + type = NavType.StringType + nullable = true + }, + navArgument("movieId") { type = NavType.LongType } + ), ) { - Text( - text = "Details", - modifier = Modifier.clickable { navigateBack() } + DetailsRoute( + onBackClick = navigateBack, + onNavigateToGallery = navigateToGallery ) } } \ No newline at end of file diff --git a/feature/feed-impl/src/androidMain/kotlin/org/michaelbel/movies/feed/ui/FeedRoute.kt b/feature/feed-impl/src/androidMain/kotlin/org/michaelbel/movies/feed/ui/FeedRoute.android.kt similarity index 100% rename from feature/feed-impl/src/androidMain/kotlin/org/michaelbel/movies/feed/ui/FeedRoute.kt rename to feature/feed-impl/src/androidMain/kotlin/org/michaelbel/movies/feed/ui/FeedRoute.android.kt diff --git a/feature/feed-impl/src/androidMain/kotlin/org/michaelbel/movies/feed/ui/FeedScreenContent.kt b/feature/feed-impl/src/androidMain/kotlin/org/michaelbel/movies/feed/ui/FeedScreenContent.android.kt similarity index 98% rename from feature/feed-impl/src/androidMain/kotlin/org/michaelbel/movies/feed/ui/FeedScreenContent.kt rename to feature/feed-impl/src/androidMain/kotlin/org/michaelbel/movies/feed/ui/FeedScreenContent.android.kt index 49834c6e2..e260385a5 100644 --- a/feature/feed-impl/src/androidMain/kotlin/org/michaelbel/movies/feed/ui/FeedScreenContent.kt +++ b/feature/feed-impl/src/androidMain/kotlin/org/michaelbel/movies/feed/ui/FeedScreenContent.android.kt @@ -2,7 +2,6 @@ package org.michaelbel.movies.feed.ui -import android.util.Log import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding @@ -151,7 +150,6 @@ internal fun FeedScreenContent( ) } pagingItems.isFailure -> { - Log.e("2", "isFailure loadState=${pagingItems.loadState}") if (pagingItems.refreshThrowable is PageEmptyException) { FeedEmpty( modifier = Modifier diff --git a/feature/feed-impl/src/desktopMain/kotlin/org/michaelbel/movies/feed/FeedViewModel.kt b/feature/feed-impl/src/desktopMain/kotlin/org/michaelbel/movies/feed/FeedViewModel.kt index 1ff12a134..405209c04 100644 --- a/feature/feed-impl/src/desktopMain/kotlin/org/michaelbel/movies/feed/FeedViewModel.kt +++ b/feature/feed-impl/src/desktopMain/kotlin/org/michaelbel/movies/feed/FeedViewModel.kt @@ -1,23 +1,46 @@ package org.michaelbel.movies.feed import androidx.lifecycle.viewModelScope +import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.stateIn +import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking +import org.michaelbel.movies.common.appearance.FeedView import org.michaelbel.movies.common.list.MovieList import org.michaelbel.movies.common.viewmodel.BaseViewModel import org.michaelbel.movies.interactor.Interactor +import org.michaelbel.movies.interactor.ktx.nameOrLocalList +import org.michaelbel.movies.persistence.database.entity.pojo.MoviePojo class FeedViewModel( private val interactor: Interactor ): BaseViewModel() { + val currentFeedView: StateFlow = interactor.currentFeedView + .stateIn( + scope = viewModelScope, + started = SharingStarted.Lazily, + initialValue = runBlocking { interactor.currentFeedView.first() } + ) + val currentMovieList: StateFlow = interactor.currentMovieList .stateIn( scope = viewModelScope, started = SharingStarted.Lazily, initialValue = runBlocking { interactor.currentMovieList.first() } ) + + private val _pagingDataFlow = MutableStateFlow>(emptyList()) + val pagingDataFlow = _pagingDataFlow.asStateFlow() + + init { + viewModelScope.launch { + val result = interactor.moviesResult(currentMovieList.value.nameOrLocalList) + _pagingDataFlow.value = result + } + } } \ No newline at end of file diff --git a/feature/feed-impl/src/desktopMain/kotlin/org/michaelbel/movies/feed/ui/FeedRoute.kt b/feature/feed-impl/src/desktopMain/kotlin/org/michaelbel/movies/feed/ui/FeedRoute.desktop.kt similarity index 82% rename from feature/feed-impl/src/desktopMain/kotlin/org/michaelbel/movies/feed/ui/FeedRoute.kt rename to feature/feed-impl/src/desktopMain/kotlin/org/michaelbel/movies/feed/ui/FeedRoute.desktop.kt index d2bf33275..b7d643894 100644 --- a/feature/feed-impl/src/desktopMain/kotlin/org/michaelbel/movies/feed/ui/FeedRoute.kt +++ b/feature/feed-impl/src/desktopMain/kotlin/org/michaelbel/movies/feed/ui/FeedRoute.desktop.kt @@ -17,10 +17,14 @@ fun FeedRoute( modifier: Modifier = Modifier, viewModel: FeedViewModel = koinInject() ) { + val currentFeedView by viewModel.currentFeedView.collectAsStateCommon() val currentMovieList by viewModel.currentMovieList.collectAsStateCommon() + val pagingData by viewModel.pagingDataFlow.collectAsStateCommon() FeedScreenContent( + currentFeedView = currentFeedView, currentMovieList = currentMovieList, + pagingItems = pagingData, onNavigateToSearch = onNavigateToSearch, onNavigateToAuth = onNavigateToAuth, onNavigateToAccount = onNavigateToAccount, diff --git a/feature/feed-impl/src/desktopMain/kotlin/org/michaelbel/movies/feed/ui/FeedScreenContent.kt b/feature/feed-impl/src/desktopMain/kotlin/org/michaelbel/movies/feed/ui/FeedScreenContent.desktop.kt similarity index 64% rename from feature/feed-impl/src/desktopMain/kotlin/org/michaelbel/movies/feed/ui/FeedScreenContent.kt rename to feature/feed-impl/src/desktopMain/kotlin/org/michaelbel/movies/feed/ui/FeedScreenContent.desktop.kt index dcdcf78e2..1d9d49cd7 100644 --- a/feature/feed-impl/src/desktopMain/kotlin/org/michaelbel/movies/feed/ui/FeedScreenContent.kt +++ b/feature/feed-impl/src/desktopMain/kotlin/org/michaelbel/movies/feed/ui/FeedScreenContent.desktop.kt @@ -3,19 +3,27 @@ package org.michaelbel.movies.feed.ui import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.lazy.grid.rememberLazyGridState +import androidx.compose.foundation.lazy.rememberLazyListState +import androidx.compose.foundation.lazy.staggeredgrid.rememberLazyStaggeredGridState import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import org.michaelbel.movies.common.appearance.FeedView import org.michaelbel.movies.common.list.MovieList import org.michaelbel.movies.feed.ktx.titleText import org.michaelbel.movies.persistence.database.entity.pojo.AccountPojo +import org.michaelbel.movies.persistence.database.entity.pojo.MoviePojo +import org.michaelbel.movies.ui.compose.page.PageContent @Composable internal fun FeedScreenContent( + currentFeedView: FeedView, currentMovieList: MovieList, + pagingItems: List, onNavigateToSearch: () -> Unit, onNavigateToAuth: () -> Unit, onNavigateToAccount: () -> Unit, @@ -39,6 +47,15 @@ internal fun FeedScreenContent( }, containerColor = MaterialTheme.colorScheme.background ) { innerPadding -> - + PageContent( + feedView = currentFeedView, + lazyListState = rememberLazyListState(), + lazyGridState = rememberLazyGridState(), + lazyStaggeredGridState = rememberLazyStaggeredGridState(), + pagingItems = pagingItems, + onMovieClick = onNavigateToDetails, + contentPadding = innerPadding, + modifier = Modifier + ) } } \ No newline at end of file diff --git a/feature/feed/src/androidMain/kotlin/org/michaelbel/movies/feed/FeedNavigation.kt b/feature/feed/src/androidMain/kotlin/org/michaelbel/movies/feed/FeedNavigation.android.kt similarity index 100% rename from feature/feed/src/androidMain/kotlin/org/michaelbel/movies/feed/FeedNavigation.kt rename to feature/feed/src/androidMain/kotlin/org/michaelbel/movies/feed/FeedNavigation.android.kt diff --git a/feature/feed/src/desktopMain/kotlin/org/michaelbel/movies/feed/FeedNavigation.kt b/feature/feed/src/desktopMain/kotlin/org/michaelbel/movies/feed/FeedNavigation.desktop.kt similarity index 100% rename from feature/feed/src/desktopMain/kotlin/org/michaelbel/movies/feed/FeedNavigation.kt rename to feature/feed/src/desktopMain/kotlin/org/michaelbel/movies/feed/FeedNavigation.desktop.kt diff --git a/feature/gallery-impl/build.gradle.kts b/feature/gallery-impl/build.gradle.kts index bd876f431..b5613b1bc 100644 --- a/feature/gallery-impl/build.gradle.kts +++ b/feature/gallery-impl/build.gradle.kts @@ -30,6 +30,14 @@ kotlin { api(project(":core:navigation")) implementation(libs.bundles.constraintlayout.common) } + val desktopMain by getting + desktopMain.dependencies { + implementation(compose.foundation) + implementation(compose.material) + implementation(compose.material3) + implementation(compose.runtime) + implementation(libs.koin.compose) + } } } diff --git a/feature/gallery-impl/src/androidMain/kotlin/org/michaelbel/movies/gallery/di/GalleryKoinModule.kt b/feature/gallery-impl/src/androidMain/kotlin/org/michaelbel/movies/gallery/di/GalleryKoinModule.android.kt similarity index 91% rename from feature/gallery-impl/src/androidMain/kotlin/org/michaelbel/movies/gallery/di/GalleryKoinModule.kt rename to feature/gallery-impl/src/androidMain/kotlin/org/michaelbel/movies/gallery/di/GalleryKoinModule.android.kt index f260cc9b6..08cda2510 100644 --- a/feature/gallery-impl/src/androidMain/kotlin/org/michaelbel/movies/gallery/di/GalleryKoinModule.kt +++ b/feature/gallery-impl/src/androidMain/kotlin/org/michaelbel/movies/gallery/di/GalleryKoinModule.android.kt @@ -6,7 +6,7 @@ import org.michaelbel.movies.gallery.GalleryViewModel import org.michaelbel.movies.interactor.di.interactorKoinModule import org.michaelbel.movies.work.di.workKoinModule -val galleryKoinModule = module { +actual val galleryKoinModule = module { includes( interactorKoinModule, workKoinModule diff --git a/feature/gallery-impl/src/androidMain/kotlin/org/michaelbel/movies/gallery/ui/GalleryRoute.kt b/feature/gallery-impl/src/androidMain/kotlin/org/michaelbel/movies/gallery/ui/GalleryRoute.android.kt similarity index 74% rename from feature/gallery-impl/src/androidMain/kotlin/org/michaelbel/movies/gallery/ui/GalleryRoute.kt rename to feature/gallery-impl/src/androidMain/kotlin/org/michaelbel/movies/gallery/ui/GalleryRoute.android.kt index 0b3538b5e..2bdbe7318 100644 --- a/feature/gallery-impl/src/androidMain/kotlin/org/michaelbel/movies/gallery/ui/GalleryRoute.kt +++ b/feature/gallery-impl/src/androidMain/kotlin/org/michaelbel/movies/gallery/ui/GalleryRoute.android.kt @@ -3,9 +3,9 @@ package org.michaelbel.movies.gallery.ui import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier -import androidx.lifecycle.compose.collectAsStateWithLifecycle import org.koin.androidx.compose.koinViewModel import org.michaelbel.movies.gallery.GalleryViewModel +import org.michaelbel.movies.ui.ktx.collectAsStateCommon @Composable fun GalleryRoute( @@ -13,8 +13,8 @@ fun GalleryRoute( modifier: Modifier = Modifier, viewModel: GalleryViewModel = koinViewModel() ) { - val movieImages by viewModel.movieImagesFlow.collectAsStateWithLifecycle() - val workInfo by viewModel.workInfoFlow.collectAsStateWithLifecycle() + val movieImages by viewModel.movieImagesFlow.collectAsStateCommon() + val workInfo by viewModel.workInfoFlow.collectAsStateCommon() GalleryScreenContent( movieImages = movieImages, diff --git a/feature/gallery-impl/src/commonMain/kotlin/org/michaelbel/movies/gallery/di/GalleryKoinModule.kt b/feature/gallery-impl/src/commonMain/kotlin/org/michaelbel/movies/gallery/di/GalleryKoinModule.kt new file mode 100644 index 000000000..c63d31765 --- /dev/null +++ b/feature/gallery-impl/src/commonMain/kotlin/org/michaelbel/movies/gallery/di/GalleryKoinModule.kt @@ -0,0 +1,5 @@ +package org.michaelbel.movies.gallery.di + +import org.koin.core.module.Module + +expect val galleryKoinModule: Module \ No newline at end of file diff --git a/feature/gallery-impl/src/desktopMain/kotlin/org/michaelbel/movies/gallery/GalleryViewModel.kt b/feature/gallery-impl/src/desktopMain/kotlin/org/michaelbel/movies/gallery/GalleryViewModel.kt new file mode 100644 index 000000000..d0a42be0e --- /dev/null +++ b/feature/gallery-impl/src/desktopMain/kotlin/org/michaelbel/movies/gallery/GalleryViewModel.kt @@ -0,0 +1,10 @@ +package org.michaelbel.movies.gallery + +import org.michaelbel.movies.common.viewmodel.BaseViewModel +import org.michaelbel.movies.interactor.Interactor + +class GalleryViewModel( + private val interactor: Interactor +): BaseViewModel() { + +} \ No newline at end of file diff --git a/feature/gallery-impl/src/desktopMain/kotlin/org/michaelbel/movies/gallery/di/GalleryKoinModule.kt b/feature/gallery-impl/src/desktopMain/kotlin/org/michaelbel/movies/gallery/di/GalleryKoinModule.desktop.kt similarity index 58% rename from feature/gallery-impl/src/desktopMain/kotlin/org/michaelbel/movies/gallery/di/GalleryKoinModule.kt rename to feature/gallery-impl/src/desktopMain/kotlin/org/michaelbel/movies/gallery/di/GalleryKoinModule.desktop.kt index 525d5ef45..3d1f4ff80 100644 --- a/feature/gallery-impl/src/desktopMain/kotlin/org/michaelbel/movies/gallery/di/GalleryKoinModule.kt +++ b/feature/gallery-impl/src/desktopMain/kotlin/org/michaelbel/movies/gallery/di/GalleryKoinModule.desktop.kt @@ -1,10 +1,12 @@ package org.michaelbel.movies.gallery.di import org.koin.dsl.module +import org.michaelbel.movies.gallery.GalleryViewModel import org.michaelbel.movies.interactor.di.interactorKoinModule -val galleryKoinModule = module { +actual val galleryKoinModule = module { includes( interactorKoinModule ) + single { GalleryViewModel(get()) } } \ No newline at end of file diff --git a/feature/gallery-impl/src/desktopMain/kotlin/org/michaelbel/movies/gallery/ui/GalleryRoute.desktop.kt b/feature/gallery-impl/src/desktopMain/kotlin/org/michaelbel/movies/gallery/ui/GalleryRoute.desktop.kt new file mode 100644 index 000000000..697057f9c --- /dev/null +++ b/feature/gallery-impl/src/desktopMain/kotlin/org/michaelbel/movies/gallery/ui/GalleryRoute.desktop.kt @@ -0,0 +1,20 @@ +package org.michaelbel.movies.gallery.ui + +import androidx.compose.foundation.clickable +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import org.koin.compose.koinInject +import org.michaelbel.movies.gallery.GalleryViewModel + +@Composable +fun GalleryRoute( + onBackClick: () -> Unit, + modifier: Modifier = Modifier, + viewModel: GalleryViewModel = koinInject() +) { + Text( + text = "Gallery", + modifier = Modifier.clickable { onBackClick() } + ) +} \ No newline at end of file diff --git a/feature/gallery/src/androidMain/kotlin/org/michaelbel/movies/gallery/GalleryNavigation.kt b/feature/gallery/src/androidMain/kotlin/org/michaelbel/movies/gallery/GalleryNavigation.android.kt similarity index 100% rename from feature/gallery/src/androidMain/kotlin/org/michaelbel/movies/gallery/GalleryNavigation.kt rename to feature/gallery/src/androidMain/kotlin/org/michaelbel/movies/gallery/GalleryNavigation.android.kt diff --git a/feature/gallery/src/desktopMain/kotlin/org/michaelbel/movies/gallery/GalleryNavigation.kt b/feature/gallery/src/desktopMain/kotlin/org/michaelbel/movies/gallery/GalleryNavigation.desktop.kt similarity index 68% rename from feature/gallery/src/desktopMain/kotlin/org/michaelbel/movies/gallery/GalleryNavigation.kt rename to feature/gallery/src/desktopMain/kotlin/org/michaelbel/movies/gallery/GalleryNavigation.desktop.kt index 078f251c3..ea816f912 100644 --- a/feature/gallery/src/desktopMain/kotlin/org/michaelbel/movies/gallery/GalleryNavigation.kt +++ b/feature/gallery/src/desktopMain/kotlin/org/michaelbel/movies/gallery/GalleryNavigation.desktop.kt @@ -1,11 +1,9 @@ package org.michaelbel.movies.gallery -import androidx.compose.foundation.clickable -import androidx.compose.material.Text -import androidx.compose.ui.Modifier import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable +import org.michaelbel.movies.gallery.ui.GalleryRoute import org.michaelbel.movies.persistence.database.typealiases.MovieId fun NavController.navigateToGallery(movieId: MovieId) { @@ -18,9 +16,8 @@ fun NavGraphBuilder.galleryGraph( composable( route = GalleryDestination.route ) { - Text( - text = "Gallery", - modifier = Modifier.clickable { navigateBack() } + GalleryRoute( + onBackClick = navigateBack ) } } \ No newline at end of file diff --git a/feature/main-impl/src/androidMain/kotlin/org/michaelbel/movies/main/MainContent.kt b/feature/main-impl/src/androidMain/kotlin/org/michaelbel/movies/main/MainContent.android.kt similarity index 75% rename from feature/main-impl/src/androidMain/kotlin/org/michaelbel/movies/main/MainContent.kt rename to feature/main-impl/src/androidMain/kotlin/org/michaelbel/movies/main/MainContent.android.kt index a8059ae4b..4c4e7e3c1 100644 --- a/feature/main-impl/src/androidMain/kotlin/org/michaelbel/movies/main/MainContent.kt +++ b/feature/main-impl/src/androidMain/kotlin/org/michaelbel/movies/main/MainContent.android.kt @@ -2,15 +2,15 @@ package org.michaelbel.movies.main import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue -import androidx.lifecycle.compose.collectAsStateWithLifecycle import org.koin.androidx.compose.koinViewModel +import org.michaelbel.movies.ui.ktx.collectAsStateCommon @Composable fun MainContent( viewModel: MainViewModel = koinViewModel(), enableEdgeToEdge: (Any, Any) -> Unit ) { - val themeData by viewModel.themeData.collectAsStateWithLifecycle() + val themeData by viewModel.themeData.collectAsStateCommon() MainNavigationContent( themeData = themeData, diff --git a/feature/main-impl/src/androidMain/kotlin/org/michaelbel/movies/main/di/MainKoinModule.kt b/feature/main-impl/src/androidMain/kotlin/org/michaelbel/movies/main/di/MainKoinModule.android.kt similarity index 100% rename from feature/main-impl/src/androidMain/kotlin/org/michaelbel/movies/main/di/MainKoinModule.kt rename to feature/main-impl/src/androidMain/kotlin/org/michaelbel/movies/main/di/MainKoinModule.android.kt diff --git a/feature/main-impl/src/desktopMain/kotlin/org/michaelbel/movies/main/MainContent.kt b/feature/main-impl/src/desktopMain/kotlin/org/michaelbel/movies/main/MainContent.desktop.kt similarity index 100% rename from feature/main-impl/src/desktopMain/kotlin/org/michaelbel/movies/main/MainContent.kt rename to feature/main-impl/src/desktopMain/kotlin/org/michaelbel/movies/main/MainContent.desktop.kt diff --git a/feature/main-impl/src/desktopMain/kotlin/org/michaelbel/movies/main/di/MainKoinModule.kt b/feature/main-impl/src/desktopMain/kotlin/org/michaelbel/movies/main/di/MainKoinModule.desktop.kt similarity index 100% rename from feature/main-impl/src/desktopMain/kotlin/org/michaelbel/movies/main/di/MainKoinModule.kt rename to feature/main-impl/src/desktopMain/kotlin/org/michaelbel/movies/main/di/MainKoinModule.desktop.kt diff --git a/feature/search-impl/build.gradle.kts b/feature/search-impl/build.gradle.kts index 5463493a8..5f81ece86 100644 --- a/feature/search-impl/build.gradle.kts +++ b/feature/search-impl/build.gradle.kts @@ -33,6 +33,14 @@ kotlin { androidMain.dependencies { implementation(libs.bundles.paging.common) // fixme ломает navigation } + val desktopMain by getting + desktopMain.dependencies { + implementation(compose.foundation) + implementation(compose.material) + implementation(compose.material3) + implementation(compose.runtime) + implementation(libs.koin.compose) + } } } diff --git a/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/di/SearchKoinModule.kt b/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/di/SearchKoinModule.android.kt similarity index 91% rename from feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/di/SearchKoinModule.kt rename to feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/di/SearchKoinModule.android.kt index 2fe5984f5..0e56a30d2 100644 --- a/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/di/SearchKoinModule.kt +++ b/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/di/SearchKoinModule.android.kt @@ -6,7 +6,7 @@ import org.michaelbel.movies.interactor.di.interactorKoinModule import org.michaelbel.movies.network.connectivity.di.networkManagerKoinModule import org.michaelbel.movies.search.SearchViewModel -val searchKoinModule = module { +actual val searchKoinModule = module { includes( interactorKoinModule, networkManagerKoinModule diff --git a/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/ui/SearchRoute.kt b/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/ui/SearchRoute.desktop.kt similarity index 81% rename from feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/ui/SearchRoute.kt rename to feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/ui/SearchRoute.desktop.kt index a56b472ee..6be5660b8 100644 --- a/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/ui/SearchRoute.kt +++ b/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/ui/SearchRoute.desktop.kt @@ -3,12 +3,12 @@ package org.michaelbel.movies.search.ui import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier -import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.paging.compose.collectAsLazyPagingItems import org.koin.androidx.compose.koinViewModel import org.michaelbel.movies.persistence.database.typealiases.MovieId import org.michaelbel.movies.persistence.database.typealiases.PagingKey import org.michaelbel.movies.search.SearchViewModel +import org.michaelbel.movies.ui.ktx.collectAsStateCommon @Composable fun SearchRoute( @@ -18,11 +18,11 @@ fun SearchRoute( viewModel: SearchViewModel = koinViewModel() ) { val pagingItems = viewModel.pagingDataFlow.collectAsLazyPagingItems() - val currentFeedView by viewModel.currentFeedView.collectAsStateWithLifecycle() - val networkStatus by viewModel.networkStatus.collectAsStateWithLifecycle() - val suggestions by viewModel.suggestionsFlow.collectAsStateWithLifecycle() - val searchHistoryMovies by viewModel.searchHistoryMoviesFlow.collectAsStateWithLifecycle() - val active by viewModel.isSearchActive.collectAsStateWithLifecycle() + val currentFeedView by viewModel.currentFeedView.collectAsStateCommon() + val networkStatus by viewModel.networkStatus.collectAsStateCommon() + val suggestions by viewModel.suggestionsFlow.collectAsStateCommon() + val searchHistoryMovies by viewModel.searchHistoryMoviesFlow.collectAsStateCommon() + val active by viewModel.isSearchActive.collectAsStateCommon() SearchScreenContent( pagingItems = pagingItems, diff --git a/feature/search-impl/src/commonMain/kotlin/org/michaelbel/movies/search/di/SearchKoinModule.kt b/feature/search-impl/src/commonMain/kotlin/org/michaelbel/movies/search/di/SearchKoinModule.kt new file mode 100644 index 000000000..9f539f1bf --- /dev/null +++ b/feature/search-impl/src/commonMain/kotlin/org/michaelbel/movies/search/di/SearchKoinModule.kt @@ -0,0 +1,5 @@ +package org.michaelbel.movies.search.di + +import org.koin.core.module.Module + +expect val searchKoinModule: Module \ No newline at end of file diff --git a/feature/search-impl/src/desktopMain/kotlin/org/michaelbel/movies/search/SearchViewModel.kt b/feature/search-impl/src/desktopMain/kotlin/org/michaelbel/movies/search/SearchViewModel.kt new file mode 100644 index 000000000..93db7ebe9 --- /dev/null +++ b/feature/search-impl/src/desktopMain/kotlin/org/michaelbel/movies/search/SearchViewModel.kt @@ -0,0 +1,10 @@ +package org.michaelbel.movies.search + +import org.michaelbel.movies.common.viewmodel.BaseViewModel +import org.michaelbel.movies.interactor.Interactor + +class SearchViewModel( + private val interactor: Interactor +): BaseViewModel() { + +} \ No newline at end of file diff --git a/feature/search-impl/src/desktopMain/kotlin/org/michaelbel/movies/search/di/SearchKoinModule.kt b/feature/search-impl/src/desktopMain/kotlin/org/michaelbel/movies/search/di/SearchKoinModule.desktop.kt similarity index 58% rename from feature/search-impl/src/desktopMain/kotlin/org/michaelbel/movies/search/di/SearchKoinModule.kt rename to feature/search-impl/src/desktopMain/kotlin/org/michaelbel/movies/search/di/SearchKoinModule.desktop.kt index 5714c62ff..913f35810 100644 --- a/feature/search-impl/src/desktopMain/kotlin/org/michaelbel/movies/search/di/SearchKoinModule.kt +++ b/feature/search-impl/src/desktopMain/kotlin/org/michaelbel/movies/search/di/SearchKoinModule.desktop.kt @@ -2,9 +2,11 @@ package org.michaelbel.movies.search.di import org.koin.dsl.module import org.michaelbel.movies.interactor.di.interactorKoinModule +import org.michaelbel.movies.search.SearchViewModel -val searchKoinModule = module { +actual val searchKoinModule = module { includes( interactorKoinModule ) + single { SearchViewModel(get()) } } \ No newline at end of file diff --git a/feature/search-impl/src/desktopMain/kotlin/org/michaelbel/movies/search/ui/SearchRoute.desktop.kt b/feature/search-impl/src/desktopMain/kotlin/org/michaelbel/movies/search/ui/SearchRoute.desktop.kt new file mode 100644 index 000000000..aa2341dcc --- /dev/null +++ b/feature/search-impl/src/desktopMain/kotlin/org/michaelbel/movies/search/ui/SearchRoute.desktop.kt @@ -0,0 +1,23 @@ +package org.michaelbel.movies.search.ui + +import androidx.compose.foundation.clickable +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import org.koin.compose.koinInject +import org.michaelbel.movies.persistence.database.typealiases.MovieId +import org.michaelbel.movies.persistence.database.typealiases.PagingKey +import org.michaelbel.movies.search.SearchViewModel + +@Composable +fun SearchRoute( + onBackClick: () -> Unit, + onNavigateToDetails: (PagingKey, MovieId) -> Unit, + modifier: Modifier = Modifier, + viewModel: SearchViewModel = koinInject() +) { + Text( + text = "Feed", + modifier = Modifier.clickable { onBackClick() } + ) +} \ No newline at end of file diff --git a/feature/search/src/androidMain/kotlin/org/michaelbel/movies/search/SearchNavigation.kt b/feature/search/src/androidMain/kotlin/org/michaelbel/movies/search/SearchNavigation.android.kt similarity index 100% rename from feature/search/src/androidMain/kotlin/org/michaelbel/movies/search/SearchNavigation.kt rename to feature/search/src/androidMain/kotlin/org/michaelbel/movies/search/SearchNavigation.android.kt diff --git a/feature/search/src/desktopMain/kotlin/org/michaelbel/movies/search/SearchNavigation.kt b/feature/search/src/desktopMain/kotlin/org/michaelbel/movies/search/SearchNavigation.desktop.kt similarity index 66% rename from feature/search/src/desktopMain/kotlin/org/michaelbel/movies/search/SearchNavigation.kt rename to feature/search/src/desktopMain/kotlin/org/michaelbel/movies/search/SearchNavigation.desktop.kt index a694adc46..7b2acc654 100644 --- a/feature/search/src/desktopMain/kotlin/org/michaelbel/movies/search/SearchNavigation.kt +++ b/feature/search/src/desktopMain/kotlin/org/michaelbel/movies/search/SearchNavigation.desktop.kt @@ -1,11 +1,9 @@ package org.michaelbel.movies.search -import androidx.compose.foundation.clickable -import androidx.compose.material.Text -import androidx.compose.ui.Modifier import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable +import org.michaelbel.movies.search.ui.SearchRoute fun NavController.navigateToSearch() { navigate(SearchDestination.route) @@ -18,9 +16,9 @@ fun NavGraphBuilder.searchGraph( composable( route = SearchDestination.route ) { - Text( - text = "Feed", - modifier = Modifier.clickable { navigateBack() } + SearchRoute( + onBackClick = navigateBack, + onNavigateToDetails = navigateToDetails ) } } \ No newline at end of file diff --git a/feature/settings-impl/src/androidMain/kotlin/org/michaelbel/movies/settings/ktx/GenderStringKtx.kt b/feature/settings-impl/src/androidMain/kotlin/org/michaelbel/movies/settings/ktx/GenderStringKtx.android.kt similarity index 100% rename from feature/settings-impl/src/androidMain/kotlin/org/michaelbel/movies/settings/ktx/GenderStringKtx.kt rename to feature/settings-impl/src/androidMain/kotlin/org/michaelbel/movies/settings/ktx/GenderStringKtx.android.kt diff --git a/feature/settings-impl/src/androidMain/kotlin/org/michaelbel/movies/settings/model/Features.kt b/feature/settings-impl/src/androidMain/kotlin/org/michaelbel/movies/settings/model/Features.android.kt similarity index 100% rename from feature/settings-impl/src/androidMain/kotlin/org/michaelbel/movies/settings/model/Features.kt rename to feature/settings-impl/src/androidMain/kotlin/org/michaelbel/movies/settings/model/Features.android.kt diff --git a/feature/settings-impl/src/androidMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.kt b/feature/settings-impl/src/androidMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.android.kt similarity index 97% rename from feature/settings-impl/src/androidMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.kt rename to feature/settings-impl/src/androidMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.android.kt index 6af3a28b4..47148fd5b 100644 --- a/feature/settings-impl/src/androidMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.kt +++ b/feature/settings-impl/src/androidMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.android.kt @@ -4,7 +4,6 @@ package org.michaelbel.movies.settings.ui import android.Manifest import android.app.Activity -import android.app.GrammaticalInflectionManager import android.app.StatusBarManager import android.appwidget.AppWidgetManager import android.content.ComponentName @@ -25,7 +24,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.platform.LocalContext import androidx.core.content.ContextCompat -import androidx.lifecycle.compose.collectAsStateWithLifecycle import kotlinx.coroutines.launch import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.stringResource @@ -64,6 +62,7 @@ import org.michaelbel.movies.ui.appicon.enabledIcon import org.michaelbel.movies.ui.appicon.setIcon import org.michaelbel.movies.ui.icons.MoviesAndroidIcons import org.michaelbel.movies.ui.ktx.appNotificationSettingsIntent +import org.michaelbel.movies.ui.ktx.collectAsStateCommon import org.michaelbel.movies.ui.ktx.displayCutoutWindowInsets import org.michaelbel.movies.ui.lifecycle.OnResume import org.michaelbel.movies.ui.strings.MoviesStrings @@ -77,13 +76,13 @@ fun SettingsRoute( viewModel: SettingsViewModel = koinViewModel() ) { val currentLanguage = AppLanguage.transform(stringResource(MoviesStrings.language_code)) - val themeData by viewModel.themeData.collectAsStateWithLifecycle() - val currentFeedView by viewModel.currentFeedView.collectAsStateWithLifecycle() - val currentMovieList by viewModel.currentMovieList.collectAsStateWithLifecycle() - val isBiometricFeatureAvailable by viewModel.isBiometricFeatureEnabled.collectAsStateWithLifecycle() - val isBiometricEnabled by viewModel.isBiometricEnabled.collectAsStateWithLifecycle() - val isScreenshotBlockEnabled by viewModel.isScreenshotBlockEnabled.collectAsStateWithLifecycle() - val appVersionData by viewModel.appVersionData.collectAsStateWithLifecycle() + val themeData by viewModel.themeData.collectAsStateCommon() + val currentFeedView by viewModel.currentFeedView.collectAsStateCommon() + val currentMovieList by viewModel.currentMovieList.collectAsStateCommon() + val isBiometricFeatureAvailable by viewModel.isBiometricFeatureEnabled.collectAsStateCommon() + val isBiometricEnabled by viewModel.isBiometricEnabled.collectAsStateCommon() + val isScreenshotBlockEnabled by viewModel.isScreenshotBlockEnabled.collectAsStateCommon() + val appVersionData by viewModel.appVersionData.collectAsStateCommon() val context = LocalContext.current val resultContract = rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) {} diff --git a/feature/settings-impl/src/desktopMain/kotlin/org/michaelbel/movies/settings/ktx/GenderStringKtx.kt b/feature/settings-impl/src/desktopMain/kotlin/org/michaelbel/movies/settings/ktx/GenderStringKtx.desktop.kt similarity index 100% rename from feature/settings-impl/src/desktopMain/kotlin/org/michaelbel/movies/settings/ktx/GenderStringKtx.kt rename to feature/settings-impl/src/desktopMain/kotlin/org/michaelbel/movies/settings/ktx/GenderStringKtx.desktop.kt diff --git a/feature/settings-impl/src/desktopMain/kotlin/org/michaelbel/movies/settings/model/Features.kt b/feature/settings-impl/src/desktopMain/kotlin/org/michaelbel/movies/settings/model/Features.desktop.kt similarity index 100% rename from feature/settings-impl/src/desktopMain/kotlin/org/michaelbel/movies/settings/model/Features.kt rename to feature/settings-impl/src/desktopMain/kotlin/org/michaelbel/movies/settings/model/Features.desktop.kt diff --git a/feature/settings-impl/src/desktopMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.kt b/feature/settings-impl/src/desktopMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.desktop.kt similarity index 97% rename from feature/settings-impl/src/desktopMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.kt rename to feature/settings-impl/src/desktopMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.desktop.kt index 7438856d5..f6c0dfff9 100644 --- a/feature/settings-impl/src/desktopMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.kt +++ b/feature/settings-impl/src/desktopMain/kotlin/org/michaelbel/movies/settings/ui/SettingsRoute.desktop.kt @@ -3,7 +3,6 @@ package org.michaelbel.movies.settings.ui import androidx.compose.foundation.layout.WindowInsets import androidx.compose.material3.SnackbarHostState import androidx.compose.runtime.Composable -import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Modifier @@ -31,6 +30,7 @@ import org.michaelbel.movies.settings.model.isTileFeatureEnabled import org.michaelbel.movies.settings.model.isUpdateAppFeatureEnabled import org.michaelbel.movies.settings.model.isWidgetFeatureEnabled import org.michaelbel.movies.ui.appicon.IconAlias +import org.michaelbel.movies.ui.ktx.collectAsStateCommon import org.michaelbel.movies.ui.strings.MoviesStrings @Composable @@ -40,9 +40,9 @@ fun SettingsRoute( viewModel: SettingsViewModel = koinInject() ) { val currentLanguage = AppLanguage.transform(stringResource(MoviesStrings.language_code)) - val themeData by viewModel.themeData.collectAsState() - val currentFeedView by viewModel.currentFeedView.collectAsState() - val currentMovieList by viewModel.currentMovieList.collectAsState() + val themeData by viewModel.themeData.collectAsStateCommon() + val currentFeedView by viewModel.currentFeedView.collectAsStateCommon() + val currentMovieList by viewModel.currentMovieList.collectAsStateCommon() val snackbarHostState = remember { SnackbarHostState() } SettingsScreenContent( diff --git a/feature/settings/src/androidMain/kotlin/org/michaelbel/movies/settings/SettingsNavigation.kt b/feature/settings/src/androidMain/kotlin/org/michaelbel/movies/settings/SettingsNavigation.android.kt similarity index 100% rename from feature/settings/src/androidMain/kotlin/org/michaelbel/movies/settings/SettingsNavigation.kt rename to feature/settings/src/androidMain/kotlin/org/michaelbel/movies/settings/SettingsNavigation.android.kt diff --git a/feature/settings/src/desktopMain/kotlin/org/michaelbel/movies/settings/SettingsNavigation.kt b/feature/settings/src/desktopMain/kotlin/org/michaelbel/movies/settings/SettingsNavigation.desktop.kt similarity index 100% rename from feature/settings/src/desktopMain/kotlin/org/michaelbel/movies/settings/SettingsNavigation.kt rename to feature/settings/src/desktopMain/kotlin/org/michaelbel/movies/settings/SettingsNavigation.desktop.kt diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 10c21533c..05cf300a0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -85,6 +85,9 @@ sqldelight = "2.0.2" koin = "3.6.0-wasm-alpha2" constraintlayout-compose-multiplatform = "0.4.0" okio = "3.9.0" +buildkonfig = "0.15.1" +napier = "2.7.1" +kamel = "0.9.5" [libraries] kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } @@ -229,6 +232,8 @@ koin-test = { module = "io.insert-koin:koin-test", version.ref = "koin" } koin-test-junit4 = { module = "io.insert-koin:koin-test-junit4", version.ref = "koin" } constraintlayout-compose-multiplatform = { module = "tech.annexflow.compose:constraintlayout-compose-multiplatform", version.ref = "constraintlayout-compose-multiplatform" } okio = { module = "com.squareup.okio:okio", version.ref = "okio" } +napier = { module = "io.github.aakira:napier", version.ref = "napier" } +kamel = { module = "media.kamel:kamel-image", version.ref = "kamel" } lint-checks = { module = "com.slack.lint.compose:compose-lint-checks", version.ref = "lint-checks" } @@ -471,6 +476,13 @@ kotlinx-coroutines-desktop = [ datastore-desktop = [ "androidx-datastore-core-okio-jvm" ] +napier-desktop = [ + "napier" +] +kamel-desktop = [ + "ktor-client-cio", + "kamel" +] [plugins] android-application = { id = "com.android.application", version.ref = "agp" } @@ -495,4 +507,5 @@ sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" } detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } androidx-navigation-safeargs = { id = "androidx.navigation.safeargs.kotlin", version.ref = "androidx-navigation" } -palantir-git = { id = "com.palantir.git-version", version.ref = "palantir-git" } \ No newline at end of file +palantir-git = { id = "com.palantir.git-version", version.ref = "palantir-git" } +buildkonfig = { id = "com.codingfeline.buildkonfig", version.ref = "buildkonfig" } \ No newline at end of file diff --git a/readme.md b/readme.md index b1d596be2..43b0a7220 100644 --- a/readme.md +++ b/readme.md @@ -166,6 +166,7 @@ The app is still usable without an API key. In this case functionality will be l - [x] [ConstraintLayout Multiplatform](https://github.com/Lavmee/constraintlayout-compose-multiplatform) - [x] [Koin](https://github.com/InsertKoinIO/koin) - [x] [Screenshot Detection](https://d.android.com/about/versions/14/features/screenshot-detection) +- [x] [BuildKonfig](https://github.com/yshrsmz/BuildKonfig) - [x] [ConstraintLayout](https://d.android.com/develop/ui/views/layout/constraint-layout) removed in [44723cb](https://github.com/michaelbel/movies/commit/44723cbbafdad89bef6043f99cbd0fbab1ecf19a) - [x] [Dagger Hilt](https://github.com/google/dagger) removed in [#274](https://github.com/michaelbel/movies/pull/274) - [x] [Retrofit](https://github.com/square/retrofit) removed in [#275](https://github.com/michaelbel/movies/pull/275) diff --git a/readme.ru.md b/readme.ru.md index d380bb41a..2a6afe5d6 100644 --- a/readme.ru.md +++ b/readme.ru.md @@ -166,6 +166,7 @@ TMDB_API_KEY=your_own_tmdb_api_key - [x] [ConstraintLayout Multiplatform](https://github.com/Lavmee/constraintlayout-compose-multiplatform) - [x] [Koin](https://github.com/InsertKoinIO/koin) - [x] [Screenshot Detection](https://d.android.com/about/versions/14/features/screenshot-detection) +- [x] [BuildKonfig](https://github.com/yshrsmz/BuildKonfig) - [x] [ConstraintLayout](https://d.android.com/develop/ui/views/layout/constraint-layout) removed in [44723cb](https://github.com/michaelbel/movies/commit/44723cbbafdad89bef6043f99cbd0fbab1ecf19a) - [x] [Dagger Hilt](https://github.com/google/dagger) removed in [#274](https://github.com/michaelbel/movies/pull/274) - [x] [Retrofit](https://github.com/square/retrofit) removed in [#275](https://github.com/michaelbel/movies/pull/275)