From 16bbc688025496c478987e98881483cc8e8710c1 Mon Sep 17 00:00:00 2001 From: makeevrserg Date: Sun, 28 Jul 2024 02:05:04 +0300 Subject: [PATCH 1/4] split tabs module --- .gitignore | 4 +- gradle.properties | 2 +- modules/features/root/api/build.gradle.kts | 2 + .../mobile/features/root/screen/RootRouter.kt | 3 +- modules/features/root/impl/build.gradle.kts | 1 + .../mobile/features/root/di/RootModule.kt | 12 +++-- .../root/screen/DefaultRootScreenComponent.kt | 2 +- .../root/screen/RootScreenComponent.kt | 3 +- modules/features/root/ui/build.gradle.kts | 2 + modules/features/splash/ui/build.gradle.kts | 1 + modules/features/tabs/impl/build.gradle.kts | 44 +++++++++++++++ .../root/pager/DefaultPagerComponent.kt | 21 +++++--- .../features/root/pager/PagerComponent.kt | 0 .../pager/data/LastBottomItemRepository.kt | 0 .../features/root/pager/di/PagerModule.kt | 21 ++++++-- .../root/pager/model/PagerBottomBarItem.kt | 0 modules/features/tabs/ui/build.gradle.kts | 53 +++++++++++++++++++ .../features/ui/pager/PagerScreenComponent.kt | 8 +-- .../ui/pager/components/PagerBottomBar.kt | 0 .../components/PagerBottomBarItemIcon.kt | 0 settings.gradle.kts | 2 + 21 files changed, 157 insertions(+), 24 deletions(-) create mode 100644 modules/features/tabs/impl/build.gradle.kts rename modules/features/{root => tabs}/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/DefaultPagerComponent.kt (75%) rename modules/features/{root => tabs}/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/PagerComponent.kt (100%) rename modules/features/{root => tabs}/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/data/LastBottomItemRepository.kt (100%) rename modules/features/{root => tabs}/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/di/PagerModule.kt (53%) rename modules/features/{root => tabs}/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/model/PagerBottomBarItem.kt (100%) create mode 100644 modules/features/tabs/ui/build.gradle.kts rename modules/features/{root => tabs}/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/PagerScreenComponent.kt (94%) rename modules/features/{root => tabs}/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/components/PagerBottomBar.kt (100%) rename modules/features/{root => tabs}/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/components/PagerBottomBarItemIcon.kt (100%) diff --git a/.gitignore b/.gitignore index 5272a73c..e90a9b9d 100644 --- a/.gitignore +++ b/.gitignore @@ -61,4 +61,6 @@ modules/features/theme/api/build modules/features/theme/impl/build modules/features/theme/ui/build modules/features/towns/impl/build -modules/features/towns/ui/build \ No newline at end of file +modules/features/towns/ui/build +modules/features/tabs/impl/build +modules/features/tabs/ui/build \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 93feb5a6..1168efcb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -33,7 +33,7 @@ org.jetbrains.compose.experimental.uikit.enabled=true kotlin.mpp.enableCInteropCommonization=true kotlin.native.binary.memoryModel=experimental kotlin.mpp.androidSourceSetLayoutVersion=2 -kotlin.native.ignoreDisabledTargets=true +kotlin.native.ignoreDisabcxledTargets=true # Java makeevrserg.java.source=11 makeevrserg.java.target=17 diff --git a/modules/features/root/api/build.gradle.kts b/modules/features/root/api/build.gradle.kts index c30220ad..79e46790 100644 --- a/modules/features/root/api/build.gradle.kts +++ b/modules/features/root/api/build.gradle.kts @@ -18,6 +18,8 @@ kotlin { dependencies { // Decompose implementation(libs.decompose.core) + // Local + implementation(projects.modules.services.core) } } } diff --git a/modules/features/root/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/screen/RootRouter.kt b/modules/features/root/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/screen/RootRouter.kt index 7f2730a9..4fee1980 100644 --- a/modules/features/root/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/screen/RootRouter.kt +++ b/modules/features/root/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/screen/RootRouter.kt @@ -1,8 +1,9 @@ package com.makeevrserg.empireprojekt.mobile.features.root.screen +import com.makeevrserg.empireprojekt.mobile.services.core.PopComponent import kotlinx.serialization.Serializable -interface RootRouter { +interface RootRouter : PopComponent { fun push(configuration: Configuration) fun replaceCurrent(configuration: Configuration) fun replaceAll(configuration: Configuration) diff --git a/modules/features/root/impl/build.gradle.kts b/modules/features/root/impl/build.gradle.kts index 286f8c05..3fad0540 100644 --- a/modules/features/root/impl/build.gradle.kts +++ b/modules/features/root/impl/build.gradle.kts @@ -45,6 +45,7 @@ kotlin { implementation(projects.modules.features.theme.impl) implementation(projects.modules.features.status.impl) implementation(projects.modules.features.towns.impl) + implementation(projects.modules.features.tabs.impl) } } val androidMain by getting { diff --git a/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/di/RootModule.kt b/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/di/RootModule.kt index 03095404..f3cbdc9f 100644 --- a/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/di/RootModule.kt +++ b/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/di/RootModule.kt @@ -19,7 +19,7 @@ interface RootModule { val ratingUserModule: RatingUserModule val ratingUsersModule: RatingUsersModule val townsModule: TownsModule - val pagerModule: PagerModule + val pagerModule: com.makeevrserg.empireprojekt.mobile.features.root.pager.di.PagerModule val apiEmpireApiModule: ApiEmpireApiModule class Default : RootModule { @@ -70,8 +70,14 @@ interface RootModule { ) } - override val pagerModule: PagerModule by lazy { - PagerModule.Default(this) + override val pagerModule: com.makeevrserg.empireprojekt.mobile.features.root.pager.di.PagerModule by lazy { + com.makeevrserg.empireprojekt.mobile.features.root.pager.di.PagerModule.Default( + ratingUsersModule = ratingUsersModule, + themeSwitcherModule = themeSwitcherModule, + statusModule = statusModule, + townsModule = townsModule, + coreModule = coreModule + ) } } } diff --git a/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/screen/DefaultRootScreenComponent.kt b/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/screen/DefaultRootScreenComponent.kt index 173d4a19..4ee346a6 100644 --- a/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/screen/DefaultRootScreenComponent.kt +++ b/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/screen/DefaultRootScreenComponent.kt @@ -74,7 +74,7 @@ class DefaultRootScreenComponent( ) : Configuration class Pager( - val pagerComponent: PagerComponent + val pagerComponent: com.makeevrserg.empireprojekt.mobile.features.root.pager.PagerComponent ) : Configuration } } diff --git a/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/screen/RootScreenComponent.kt b/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/screen/RootScreenComponent.kt index c767bffc..c79d1711 100644 --- a/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/screen/RootScreenComponent.kt +++ b/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/screen/RootScreenComponent.kt @@ -3,8 +3,7 @@ package com.makeevrserg.empireprojekt.mobile.features.root.screen import com.arkivanov.decompose.router.stack.ChildStack import com.arkivanov.decompose.value.Value import com.arkivanov.essenty.backhandler.BackHandlerOwner -import com.makeevrserg.empireprojekt.mobile.services.core.PopComponent -interface RootScreenComponent : BackHandlerOwner, PopComponent, RootRouter { +interface RootScreenComponent : BackHandlerOwner, RootRouter { val childStack: Value> } diff --git a/modules/features/root/ui/build.gradle.kts b/modules/features/root/ui/build.gradle.kts index 305b8e10..359a5974 100644 --- a/modules/features/root/ui/build.gradle.kts +++ b/modules/features/root/ui/build.gradle.kts @@ -49,6 +49,8 @@ kotlin { implementation(projects.modules.features.towns.ui) implementation(projects.modules.features.info.ui) implementation(projects.modules.features.map.ui) + implementation(projects.modules.features.tabs.impl) + implementation(projects.modules.features.tabs.ui) } } val androidMain by getting { diff --git a/modules/features/splash/ui/build.gradle.kts b/modules/features/splash/ui/build.gradle.kts index 3f1caa49..dbe07ab0 100644 --- a/modules/features/splash/ui/build.gradle.kts +++ b/modules/features/splash/ui/build.gradle.kts @@ -26,6 +26,7 @@ kotlin { implementation(libs.moko.resources.core) // Local implementation(projects.modules.services.coreResources) + implementation(projects.modules.services.core) implementation(projects.modules.services.coreUi) implementation(projects.modules.features.splash.impl) implementation(projects.modules.features.root.api) diff --git a/modules/features/tabs/impl/build.gradle.kts b/modules/features/tabs/impl/build.gradle.kts new file mode 100644 index 00000000..05fffd35 --- /dev/null +++ b/modules/features/tabs/impl/build.gradle.kts @@ -0,0 +1,44 @@ +@file:Suppress("UnusedPrivateMember") + +import ru.astrainteractive.gradleplugin.property.extension.ModelPropertyValueExt.requireProjectInfo + +plugins { + id("com.android.library") + kotlin("multiplatform") + id("ru.astrainteractive.gradleplugin.java.core") + id("ru.astrainteractive.gradleplugin.android.core") +} + +kotlin { + androidTarget() + applyDefaultHierarchyTemplate() + sourceSets { + val commonMain by getting { + dependencies { + // Coroutines + implementation(libs.kotlin.coroutines.core) + // klibs + implementation(libs.klibs.mikro.core) + implementation(libs.klibs.mikro.platform) + implementation(libs.klibs.kstorage) + implementation(libs.klibs.kdi) + // settings + implementation(libs.mppsettings) + // Decompose + implementation(libs.decompose.core) + // Local + implementation(projects.modules.services.core) + implementation(projects.modules.features.root.api) + implementation(projects.modules.features.towns.impl) + implementation(projects.modules.features.rating.impl) + implementation(projects.modules.features.status.impl) + implementation(projects.modules.features.theme.api) + implementation(projects.modules.features.theme.impl) + } + } + } +} + +android { + namespace = "${requireProjectInfo.group}.features.tabs" +} diff --git a/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/DefaultPagerComponent.kt b/modules/features/tabs/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/DefaultPagerComponent.kt similarity index 75% rename from modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/DefaultPagerComponent.kt rename to modules/features/tabs/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/DefaultPagerComponent.kt index ba2c678b..b37ed807 100644 --- a/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/DefaultPagerComponent.kt +++ b/modules/features/tabs/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/DefaultPagerComponent.kt @@ -2,22 +2,29 @@ package com.makeevrserg.empireprojekt.mobile.features.root.pager import com.arkivanov.decompose.ComponentContext import com.arkivanov.decompose.childContext -import com.makeevrserg.empireprojekt.mobile.features.root.di.RootModule +import com.makeevrserg.empireprojekt.mobile.features.rating.users.di.RatingUsersModule import com.makeevrserg.empireprojekt.mobile.features.root.pager.data.LastBottomItemRepository import com.makeevrserg.empireprojekt.mobile.features.root.pager.model.PagerBottomBarItem import com.makeevrserg.empireprojekt.mobile.features.root.screen.RootRouter +import com.makeevrserg.empireprojekt.mobile.features.status.di.StatusModule +import com.makeevrserg.empireprojekt.mobile.features.theme.di.ThemeSwitcherModule +import com.makeevrserg.empireprojekt.mobile.features.towny.towns.di.TownsModule import kotlinx.coroutines.flow.StateFlow import ru.astrainteractive.klibs.mikro.core.util.mapStateFlow +@Suppress("LongParameterList") internal class DefaultPagerComponent( componentContext: ComponentContext, - rootModule: RootModule, + private val lastBottomItemRepository: LastBottomItemRepository, onRootNavigation: (RootRouter.Configuration) -> Unit, - private val lastBottomItemRepository: LastBottomItemRepository + ratingUsersModule: RatingUsersModule, + themeSwitcherModule: ThemeSwitcherModule, + statusModule: StatusModule, + townsModule: TownsModule, ) : PagerComponent, ComponentContext by componentContext { private val ratingUsersChild by lazy { PagerComponent.Child.RatingUsers( - ratingUsersComponent = rootModule.ratingUsersModule.createRatingUsersComponent( + ratingUsersComponent = ratingUsersModule.createRatingUsersComponent( componentContext = componentContext.childContext("RatingUsersComponent"), onShowUserRatingsClicked = { id, userName -> val configuration = RootRouter.Configuration.RatingUser(id, userName) @@ -29,14 +36,14 @@ internal class DefaultPagerComponent( private val statusChild by lazy { PagerComponent.Child.Status( - themeSwitcherComponent = rootModule.themeSwitcherModule.themeSwitcherComponent, - rootStatusComponent = rootModule.statusModule.rootStatusComponent + themeSwitcherComponent = themeSwitcherModule.themeSwitcherComponent, + rootStatusComponent = statusModule.rootStatusComponent ) } private val townsChild by lazy { PagerComponent.Child.Towns( - townsComponent = rootModule.townsModule.createTownsComponent( + townsComponent = townsModule.createTownsComponent( componentContext = componentContext.childContext("TownsComponent") ) ) diff --git a/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/PagerComponent.kt b/modules/features/tabs/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/PagerComponent.kt similarity index 100% rename from modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/PagerComponent.kt rename to modules/features/tabs/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/PagerComponent.kt diff --git a/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/data/LastBottomItemRepository.kt b/modules/features/tabs/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/data/LastBottomItemRepository.kt similarity index 100% rename from modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/data/LastBottomItemRepository.kt rename to modules/features/tabs/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/data/LastBottomItemRepository.kt diff --git a/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/di/PagerModule.kt b/modules/features/tabs/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/di/PagerModule.kt similarity index 53% rename from modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/di/PagerModule.kt rename to modules/features/tabs/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/di/PagerModule.kt index 5b0575ad..19fa6030 100644 --- a/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/di/PagerModule.kt +++ b/modules/features/tabs/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/di/PagerModule.kt @@ -1,11 +1,15 @@ package com.makeevrserg.empireprojekt.mobile.features.root.pager.di import com.arkivanov.decompose.ComponentContext -import com.makeevrserg.empireprojekt.mobile.features.root.di.RootModule +import com.makeevrserg.empireprojekt.mobile.features.rating.users.di.RatingUsersModule import com.makeevrserg.empireprojekt.mobile.features.root.pager.DefaultPagerComponent import com.makeevrserg.empireprojekt.mobile.features.root.pager.PagerComponent import com.makeevrserg.empireprojekt.mobile.features.root.pager.data.LastBottomItemRepositoryImpl import com.makeevrserg.empireprojekt.mobile.features.root.screen.RootRouter +import com.makeevrserg.empireprojekt.mobile.features.status.di.StatusModule +import com.makeevrserg.empireprojekt.mobile.features.theme.di.ThemeSwitcherModule +import com.makeevrserg.empireprojekt.mobile.features.towny.towns.di.TownsModule +import com.makeevrserg.empireprojekt.mobile.services.core.di.CoreModule interface PagerModule { fun createPagerComponent( @@ -13,15 +17,24 @@ interface PagerModule { onRootNavigation: (RootRouter.Configuration) -> Unit ): PagerComponent - class Default(private val rootModule: RootModule) : PagerModule { + class Default( + private val ratingUsersModule: RatingUsersModule, + private val themeSwitcherModule: ThemeSwitcherModule, + private val statusModule: StatusModule, + private val townsModule: TownsModule, + private val coreModule: CoreModule + ) : PagerModule { override fun createPagerComponent( componentContext: ComponentContext, onRootNavigation: (RootRouter.Configuration) -> Unit ): PagerComponent = DefaultPagerComponent( componentContext = componentContext, - rootModule = rootModule, onRootNavigation = onRootNavigation, - lastBottomItemRepository = LastBottomItemRepositoryImpl(rootModule.coreModule.settings) + lastBottomItemRepository = LastBottomItemRepositoryImpl(coreModule.settings), + themeSwitcherModule = themeSwitcherModule, + statusModule = statusModule, + townsModule = townsModule, + ratingUsersModule = ratingUsersModule ) } } diff --git a/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/model/PagerBottomBarItem.kt b/modules/features/tabs/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/model/PagerBottomBarItem.kt similarity index 100% rename from modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/model/PagerBottomBarItem.kt rename to modules/features/tabs/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/pager/model/PagerBottomBarItem.kt diff --git a/modules/features/tabs/ui/build.gradle.kts b/modules/features/tabs/ui/build.gradle.kts new file mode 100644 index 00000000..3fd8f9fc --- /dev/null +++ b/modules/features/tabs/ui/build.gradle.kts @@ -0,0 +1,53 @@ +@file:Suppress("UnusedPrivateMember") + +import ru.astrainteractive.gradleplugin.property.extension.ModelPropertyValueExt.requireProjectInfo + +plugins { + id("org.jetbrains.compose") + id("com.android.library") + kotlin("multiplatform") + id("ru.astrainteractive.gradleplugin.java.core") + id("ru.astrainteractive.gradleplugin.android.core") + alias(libs.plugins.kotlin.compose.gradle) +} + +kotlin { + androidTarget() + applyDefaultHierarchyTemplate() + sourceSets { + val commonMain by getting { + dependencies { + // Compose MPP + implementation(compose.foundation) + implementation(compose.ui) + implementation(compose.runtime) + implementation(compose.material) + implementation(compose.materialIconsExtended) + implementation(compose.uiTooling) + implementation(compose.preview) + // Moko + implementation(libs.moko.resources.core) + // Local + implementation(projects.modules.services.coreResources) + implementation(projects.modules.services.coreUi) + implementation(projects.modules.services.core) + implementation(projects.modules.features.splash.impl) + implementation(projects.modules.features.root.api) + implementation(projects.modules.features.tabs.impl) + implementation(projects.modules.features.map.ui) + implementation(projects.modules.features.towns.impl) + implementation(projects.modules.features.towns.ui) + implementation(projects.modules.features.rating.impl) + implementation(projects.modules.features.rating.ui) + implementation(projects.modules.features.status.impl) + implementation(projects.modules.features.status.ui) + implementation(projects.modules.features.theme.api) + implementation(projects.modules.features.theme.impl) + } + } + } +} + +android { + namespace = "${requireProjectInfo.group}.features.tabs.ui" +} diff --git a/modules/features/root/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/PagerScreenComponent.kt b/modules/features/tabs/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/PagerScreenComponent.kt similarity index 94% rename from modules/features/root/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/PagerScreenComponent.kt rename to modules/features/tabs/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/PagerScreenComponent.kt index 274a3495..19c572b1 100644 --- a/modules/features/root/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/PagerScreenComponent.kt +++ b/modules/features/tabs/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/PagerScreenComponent.kt @@ -9,9 +9,9 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier -import com.makeevrserg.empireprojekt.mobile.features.root.modal.RootBottomSheetComponent +import com.makeevrserg.empireprojekt.mobile.features.root.modal.RootBottomSheetRouter import com.makeevrserg.empireprojekt.mobile.features.root.pager.PagerComponent -import com.makeevrserg.empireprojekt.mobile.features.root.screen.RootScreenComponent +import com.makeevrserg.empireprojekt.mobile.features.root.screen.RootRouter import com.makeevrserg.empireprojekt.mobile.features.ui.map.AndroidMapView import com.makeevrserg.empireprojekt.mobile.features.ui.pager.components.PagerBottomBar import com.makeevrserg.empireprojekt.mobile.features.ui.rating.users.RatingUsersScreenComponent @@ -21,8 +21,8 @@ import com.makeevrserg.empireprojekt.mobile.features.ui.towny.towns.TownsScreenC @Composable fun PagerScreenComponent( pagerComponent: PagerComponent, - rootScreenComponent: RootScreenComponent, - rootBottomSheetComponent: RootBottomSheetComponent, + rootScreenComponent: RootRouter, + rootBottomSheetComponent: RootBottomSheetRouter, modifier: Modifier = Modifier ) { val selectedChild by pagerComponent.selectedChild.collectAsState() diff --git a/modules/features/root/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/components/PagerBottomBar.kt b/modules/features/tabs/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/components/PagerBottomBar.kt similarity index 100% rename from modules/features/root/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/components/PagerBottomBar.kt rename to modules/features/tabs/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/components/PagerBottomBar.kt diff --git a/modules/features/root/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/components/PagerBottomBarItemIcon.kt b/modules/features/tabs/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/components/PagerBottomBarItemIcon.kt similarity index 100% rename from modules/features/root/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/components/PagerBottomBarItemIcon.kt rename to modules/features/tabs/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/components/PagerBottomBarItemIcon.kt diff --git a/settings.gradle.kts b/settings.gradle.kts index 4a719dcc..2feae5c0 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -37,6 +37,8 @@ include(":modules:services:api-empireapi") include(":modules:features:root:api") include(":modules:features:root:impl") include(":modules:features:root:ui") +include(":modules:features:tabs:impl") +include(":modules:features:tabs:ui") include(":modules:features:splash:impl") include(":modules:features:splash:ui") include(":modules:features:theme:api") From f9819ecb181f358915d2dc173458a73da4d7b276 Mon Sep 17 00:00:00 2001 From: makeevrserg Date: Sun, 28 Jul 2024 02:46:49 +0300 Subject: [PATCH 2/4] improve api/impl system --- instances/androidApp/build.gradle.kts | 1 + .../mobile/wear/di/WearRootModule.kt | 3 +- modules/features/rating/api/build.gradle.kts | 29 ++++++++++ .../rating/user/di/RatingUserModule.kt | 12 ++++ .../user/presentation/RatingUserComponent.kt | 0 .../rating/users/di/RatingUsersModule.kt | 11 ++++ .../presentation/RatingUsersComponent.kt | 0 modules/features/rating/impl/build.gradle.kts | 2 + .../rating/user/di/RatingUserModule.kt | 41 ------------- .../rating/user/di/RatingUserModuleImpl.kt | 33 +++++++++++ .../rating/users/di/RatingUsersModule.kt | 58 ------------------- .../rating/users/di/RatingUsersModuleImpl.kt | 51 ++++++++++++++++ modules/features/rating/ui/build.gradle.kts | 1 + modules/features/root/impl/build.gradle.kts | 3 + .../mobile/features/root/di/RootModule.kt | 16 +++-- .../root/screen/DefaultRootScreenComponent.kt | 2 +- modules/features/root/ui/build.gradle.kts | 3 + .../features/ui/root/ApplicationContent.kt | 28 ++++++++- modules/features/status/api/build.gradle.kts | 28 +++++++++ .../mobile/features/status/di/StatusModule.kt | 8 +++ .../root/presentation/RootStatusComponent.kt | 0 .../url/presentation/UrlStatusComponent.kt | 0 modules/features/status/impl/build.gradle.kts | 1 + .../mobile/features/status/di/StatusModule.kt | 27 --------- .../features/status/di/StatusModuleImpl.kt | 22 +++++++ modules/features/status/ui/build.gradle.kts | 1 + modules/features/tabs/impl/build.gradle.kts | 7 +-- modules/features/tabs/ui/build.gradle.kts | 15 ++--- .../features/ui/pager/PagerScreenComponent.kt | 39 ++++++------- .../features/theme/di/ThemeSwitcherModule.kt | 8 +++ .../features/theme/di/ThemeSwitcherModule.kt | 22 ------- .../theme/di/ThemeSwitcherModuleImpl.kt | 16 +++++ modules/features/towns/api/build.gradle.kts | 29 ++++++++++ .../features/towny/towns/di/TownsModule.kt | 8 +++ .../towns/presentation/TownsComponent.kt | 0 modules/features/towns/impl/build.gradle.kts | 1 + .../features/towny/towns/di/TownsModule.kt | 27 --------- .../towny/towns/di/TownsModuleImpl.kt | 24 ++++++++ modules/features/towns/ui/build.gradle.kts | 1 + .../mobile/core/ui/DecomposeScreen.kt | 9 +++ settings.gradle.kts | 3 + 41 files changed, 371 insertions(+), 219 deletions(-) create mode 100644 modules/features/rating/api/build.gradle.kts create mode 100644 modules/features/rating/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/user/di/RatingUserModule.kt rename modules/features/rating/{impl => api}/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/user/presentation/RatingUserComponent.kt (100%) create mode 100644 modules/features/rating/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/users/di/RatingUsersModule.kt rename modules/features/rating/{impl => api}/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/users/presentation/RatingUsersComponent.kt (100%) delete mode 100644 modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/user/di/RatingUserModule.kt create mode 100644 modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/user/di/RatingUserModuleImpl.kt delete mode 100644 modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/users/di/RatingUsersModule.kt create mode 100644 modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/users/di/RatingUsersModuleImpl.kt create mode 100644 modules/features/status/api/build.gradle.kts create mode 100644 modules/features/status/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/di/StatusModule.kt rename modules/features/status/{impl => api}/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/root/presentation/RootStatusComponent.kt (100%) rename modules/features/status/{impl => api}/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/url/presentation/UrlStatusComponent.kt (100%) delete mode 100644 modules/features/status/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/di/StatusModule.kt create mode 100644 modules/features/status/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/di/StatusModuleImpl.kt create mode 100644 modules/features/theme/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/theme/di/ThemeSwitcherModule.kt delete mode 100644 modules/features/theme/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/theme/di/ThemeSwitcherModule.kt create mode 100644 modules/features/theme/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/theme/di/ThemeSwitcherModuleImpl.kt create mode 100644 modules/features/towns/api/build.gradle.kts create mode 100644 modules/features/towns/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/towny/towns/di/TownsModule.kt rename modules/features/towns/{impl => api}/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/towny/towns/presentation/TownsComponent.kt (100%) delete mode 100644 modules/features/towns/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/towny/towns/di/TownsModule.kt create mode 100644 modules/features/towns/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/towny/towns/di/TownsModuleImpl.kt create mode 100644 modules/services/core-ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/core/ui/DecomposeScreen.kt diff --git a/instances/androidApp/build.gradle.kts b/instances/androidApp/build.gradle.kts index 97ef426e..0d668f4a 100644 --- a/instances/androidApp/build.gradle.kts +++ b/instances/androidApp/build.gradle.kts @@ -148,6 +148,7 @@ dependencies { implementation(projects.modules.features.theme.api) implementation(projects.modules.features.theme.impl) implementation(projects.modules.features.theme.ui) + implementation(projects.modules.features.status.api) implementation(projects.modules.features.status.impl) implementation(projects.modules.services.coreUi) implementation(projects.modules.services.core) diff --git a/instances/wearApp/src/main/java/com/makeevrserg/empireprojekt/mobile/wear/di/WearRootModule.kt b/instances/wearApp/src/main/java/com/makeevrserg/empireprojekt/mobile/wear/di/WearRootModule.kt index 600fc663..f021b1f4 100644 --- a/instances/wearApp/src/main/java/com/makeevrserg/empireprojekt/mobile/wear/di/WearRootModule.kt +++ b/instances/wearApp/src/main/java/com/makeevrserg/empireprojekt/mobile/wear/di/WearRootModule.kt @@ -1,6 +1,7 @@ package com.makeevrserg.empireprojekt.mobile.wear.di import com.makeevrserg.empireprojekt.mobile.features.theme.di.ThemeSwitcherModule +import com.makeevrserg.empireprojekt.mobile.features.theme.di.ThemeSwitcherModuleImpl import com.makeevrserg.empireprojekt.mobile.services.core.di.CoreModule import com.makeevrserg.empireprojekt.mobile.wear.features.ping.di.PingModule import com.makeevrserg.empireprojekt.mobile.wear.features.status.presentation.DefaultWearStatusComponent @@ -21,7 +22,7 @@ interface WearRootModule { CoreModule.Default() } override val themeSwitcherModule: ThemeSwitcherModule by lazy { - ThemeSwitcherModule.Default(coreModule = coreModule) + ThemeSwitcherModuleImpl(coreModule = coreModule) } override val wearMessengerModule: WearMessengerModule by Single { diff --git a/modules/features/rating/api/build.gradle.kts b/modules/features/rating/api/build.gradle.kts new file mode 100644 index 00000000..cecd0a0b --- /dev/null +++ b/modules/features/rating/api/build.gradle.kts @@ -0,0 +1,29 @@ +@file:Suppress("UnusedPrivateMember") + +import ru.astrainteractive.gradleplugin.property.extension.ModelPropertyValueExt.requireProjectInfo + +plugins { + id("com.android.library") + kotlin("multiplatform") + id("ru.astrainteractive.gradleplugin.java.core") + id("ru.astrainteractive.gradleplugin.android.core") + alias(libs.plugins.kotlin.serialization) +} + +kotlin { + androidTarget() + applyDefaultHierarchyTemplate() + sourceSets { + val commonMain by getting { + dependencies { + // Coroutines + implementation(libs.kotlin.coroutines.core) + implementation(libs.decompose.core) + implementation(projects.modules.services.apiEmpireapi) + } + } + } +} +android { + namespace = "${requireProjectInfo.group}.rating.api" +} diff --git a/modules/features/rating/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/user/di/RatingUserModule.kt b/modules/features/rating/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/user/di/RatingUserModule.kt new file mode 100644 index 00000000..4c01614f --- /dev/null +++ b/modules/features/rating/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/user/di/RatingUserModule.kt @@ -0,0 +1,12 @@ +package com.makeevrserg.empireprojekt.mobile.features.rating.user.di + +import com.arkivanov.decompose.ComponentContext +import com.makeevrserg.empireprojekt.mobile.features.rating.user.presentation.RatingUserComponent + +interface RatingUserModule { + fun createRatingUserComponent( + componentContext: ComponentContext, + userId: Long, + userName: String + ): RatingUserComponent +} diff --git a/modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/user/presentation/RatingUserComponent.kt b/modules/features/rating/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/user/presentation/RatingUserComponent.kt similarity index 100% rename from modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/user/presentation/RatingUserComponent.kt rename to modules/features/rating/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/user/presentation/RatingUserComponent.kt diff --git a/modules/features/rating/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/users/di/RatingUsersModule.kt b/modules/features/rating/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/users/di/RatingUsersModule.kt new file mode 100644 index 00000000..5bfe2bc0 --- /dev/null +++ b/modules/features/rating/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/users/di/RatingUsersModule.kt @@ -0,0 +1,11 @@ +package com.makeevrserg.empireprojekt.mobile.features.rating.users.di + +import com.arkivanov.decompose.ComponentContext +import com.makeevrserg.empireprojekt.mobile.features.rating.users.presentation.RatingUsersComponent + +interface RatingUsersModule { + fun createRatingUsersComponent( + componentContext: ComponentContext, + onShowUserRatingsClicked: (userId: Long, userName: String) -> Unit + ): RatingUsersComponent +} diff --git a/modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/users/presentation/RatingUsersComponent.kt b/modules/features/rating/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/users/presentation/RatingUsersComponent.kt similarity index 100% rename from modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/users/presentation/RatingUsersComponent.kt rename to modules/features/rating/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/users/presentation/RatingUsersComponent.kt diff --git a/modules/features/rating/impl/build.gradle.kts b/modules/features/rating/impl/build.gradle.kts index 62557c8d..7fc32a30 100644 --- a/modules/features/rating/impl/build.gradle.kts +++ b/modules/features/rating/impl/build.gradle.kts @@ -1,5 +1,6 @@ @file:Suppress("UnusedPrivateMember") +import com.android.build.gradle.internal.ide.kmp.KotlinAndroidSourceSetMarker.Companion.android import ru.astrainteractive.gradleplugin.property.extension.ModelPropertyValueExt.requireProjectInfo plugins { @@ -41,6 +42,7 @@ kotlin { implementation(projects.modules.services.coreResources) implementation(projects.modules.services.core) implementation(projects.modules.services.apiEmpireapi) + implementation(projects.modules.features.rating.api) } } } diff --git a/modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/user/di/RatingUserModule.kt b/modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/user/di/RatingUserModule.kt deleted file mode 100644 index c13f8b87..00000000 --- a/modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/user/di/RatingUserModule.kt +++ /dev/null @@ -1,41 +0,0 @@ -package com.makeevrserg.empireprojekt.mobile.features.rating.user.di - -import com.arkivanov.decompose.ComponentContext -import com.makeevrserg.empireprojekt.mobile.api.empireapi.di.ApiEmpireApiModule -import com.makeevrserg.empireprojekt.mobile.features.rating.user.data.RatingUserRepositoryImpl -import com.makeevrserg.empireprojekt.mobile.features.rating.user.presentation.DefaultRatingUserComponent -import com.makeevrserg.empireprojekt.mobile.features.rating.user.presentation.RatingUserComponent -import com.makeevrserg.empireprojekt.mobile.services.core.di.CoreModule - -interface RatingUserModule { - fun createRatingUserComponent( - componentContext: ComponentContext, - userId: Long, - userName: String - ): RatingUserComponent - - class Default( - apiEmpireApiModule: ApiEmpireApiModule, - coreModule: CoreModule - ) : RatingUserModule { - private val ratingUserRepository by lazy { - RatingUserRepositoryImpl( - ratingApi = apiEmpireApiModule.ratingApi, - dispatchers = coreModule.dispatchers - ) - } - - override fun createRatingUserComponent( - componentContext: ComponentContext, - userId: Long, - userName: String - ): RatingUserComponent { - return DefaultRatingUserComponent( - componentContext = componentContext, - userId = userId, - userName = userName, - ratingUserRepository = ratingUserRepository - ) - } - } -} diff --git a/modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/user/di/RatingUserModuleImpl.kt b/modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/user/di/RatingUserModuleImpl.kt new file mode 100644 index 00000000..7cd9530c --- /dev/null +++ b/modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/user/di/RatingUserModuleImpl.kt @@ -0,0 +1,33 @@ +package com.makeevrserg.empireprojekt.mobile.features.rating.user.di + +import com.arkivanov.decompose.ComponentContext +import com.makeevrserg.empireprojekt.mobile.api.empireapi.di.ApiEmpireApiModule +import com.makeevrserg.empireprojekt.mobile.features.rating.user.data.RatingUserRepositoryImpl +import com.makeevrserg.empireprojekt.mobile.features.rating.user.presentation.DefaultRatingUserComponent +import com.makeevrserg.empireprojekt.mobile.features.rating.user.presentation.RatingUserComponent +import com.makeevrserg.empireprojekt.mobile.services.core.di.CoreModule + +class RatingUserModuleImpl( + apiEmpireApiModule: ApiEmpireApiModule, + coreModule: CoreModule +) : RatingUserModule { + private val ratingUserRepository by lazy { + RatingUserRepositoryImpl( + ratingApi = apiEmpireApiModule.ratingApi, + dispatchers = coreModule.dispatchers + ) + } + + override fun createRatingUserComponent( + componentContext: ComponentContext, + userId: Long, + userName: String + ): RatingUserComponent { + return DefaultRatingUserComponent( + componentContext = componentContext, + userId = userId, + userName = userName, + ratingUserRepository = ratingUserRepository + ) + } +} diff --git a/modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/users/di/RatingUsersModule.kt b/modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/users/di/RatingUsersModule.kt deleted file mode 100644 index b61909d4..00000000 --- a/modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/users/di/RatingUsersModule.kt +++ /dev/null @@ -1,58 +0,0 @@ -package com.makeevrserg.empireprojekt.mobile.features.rating.users.di - -import com.arkivanov.decompose.ComponentContext -import com.makeevrserg.empireprojekt.mobile.api.empireapi.di.ApiEmpireApiModule -import com.makeevrserg.empireprojekt.mobile.features.rating.users.data.RatingUsersRepository -import com.makeevrserg.empireprojekt.mobile.features.rating.users.data.RatingUsersRepositoryImpl -import com.makeevrserg.empireprojekt.mobile.features.rating.users.presentation.DefaultRatingUsersComponent -import com.makeevrserg.empireprojekt.mobile.features.rating.users.presentation.RatingUsersComponent -import com.makeevrserg.empireprojekt.mobile.features.rating.users.presentation.feature.FilterFeature -import com.makeevrserg.empireprojekt.mobile.features.rating.users.presentation.feature.RatingUsersFeature -import com.makeevrserg.empireprojekt.mobile.features.rating.users.storage.RatingsFilterStorageValue -import com.makeevrserg.empireprojekt.mobile.services.core.di.CoreModule - -interface RatingUsersModule { - fun createRatingUsersComponent( - componentContext: ComponentContext, - onShowUserRatingsClicked: (userId: Long, userName: String) -> Unit - ): RatingUsersComponent - - class Default( - apiEmpireApiModule: ApiEmpireApiModule, - private val coreModule: CoreModule - ) : RatingUsersModule { - private val ratingUsersRepository: RatingUsersRepository by lazy { - RatingUsersRepositoryImpl( - ratingApi = apiEmpireApiModule.ratingApi, - dispatchers = coreModule.dispatchers, - ) - } - - override fun createRatingUsersComponent( - componentContext: ComponentContext, - onShowUserRatingsClicked: (userId: Long, userName: String) -> Unit - ): RatingUsersComponent { - val dependencies = RatingUsersDependencies.Default( - ratingUsersRepository = ratingUsersRepository - ) - return DefaultRatingUsersComponent( - componentContext = componentContext, - onShowUserRatingsClicked = onShowUserRatingsClicked, - createRatingUsersFeature = { filterProvider -> - RatingUsersFeature( - dependencies = dependencies, - filterProvider = filterProvider - ) - }, - createFilterFeature = { - FilterFeature( - ratingsFilterStorageValue = RatingsFilterStorageValue( - settings = coreModule.settings, - key = "ratings_filter_storage_key" - ) - ) - } - ) - } - } -} diff --git a/modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/users/di/RatingUsersModuleImpl.kt b/modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/users/di/RatingUsersModuleImpl.kt new file mode 100644 index 00000000..31033bbc --- /dev/null +++ b/modules/features/rating/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/rating/users/di/RatingUsersModuleImpl.kt @@ -0,0 +1,51 @@ +package com.makeevrserg.empireprojekt.mobile.features.rating.users.di + +import com.arkivanov.decompose.ComponentContext +import com.makeevrserg.empireprojekt.mobile.api.empireapi.di.ApiEmpireApiModule +import com.makeevrserg.empireprojekt.mobile.features.rating.users.data.RatingUsersRepository +import com.makeevrserg.empireprojekt.mobile.features.rating.users.data.RatingUsersRepositoryImpl +import com.makeevrserg.empireprojekt.mobile.features.rating.users.presentation.DefaultRatingUsersComponent +import com.makeevrserg.empireprojekt.mobile.features.rating.users.presentation.RatingUsersComponent +import com.makeevrserg.empireprojekt.mobile.features.rating.users.presentation.feature.FilterFeature +import com.makeevrserg.empireprojekt.mobile.features.rating.users.presentation.feature.RatingUsersFeature +import com.makeevrserg.empireprojekt.mobile.features.rating.users.storage.RatingsFilterStorageValue +import com.makeevrserg.empireprojekt.mobile.services.core.di.CoreModule + +class RatingUsersModuleImpl( + apiEmpireApiModule: ApiEmpireApiModule, + private val coreModule: CoreModule +) : RatingUsersModule { + private val ratingUsersRepository: RatingUsersRepository by lazy { + RatingUsersRepositoryImpl( + ratingApi = apiEmpireApiModule.ratingApi, + dispatchers = coreModule.dispatchers, + ) + } + + override fun createRatingUsersComponent( + componentContext: ComponentContext, + onShowUserRatingsClicked: (userId: Long, userName: String) -> Unit + ): RatingUsersComponent { + val dependencies = RatingUsersDependencies.Default( + ratingUsersRepository = ratingUsersRepository + ) + return DefaultRatingUsersComponent( + componentContext = componentContext, + onShowUserRatingsClicked = onShowUserRatingsClicked, + createRatingUsersFeature = { filterProvider -> + RatingUsersFeature( + dependencies = dependencies, + filterProvider = filterProvider + ) + }, + createFilterFeature = { + FilterFeature( + ratingsFilterStorageValue = RatingsFilterStorageValue( + settings = coreModule.settings, + key = "ratings_filter_storage_key" + ) + ) + } + ) + } +} diff --git a/modules/features/rating/ui/build.gradle.kts b/modules/features/rating/ui/build.gradle.kts index 53686eec..a2e038c1 100644 --- a/modules/features/rating/ui/build.gradle.kts +++ b/modules/features/rating/ui/build.gradle.kts @@ -37,6 +37,7 @@ kotlin { implementation(projects.modules.features.rating.impl) implementation(projects.modules.services.apiEmpireapi) implementation(projects.modules.services.core) + implementation(projects.modules.features.rating.api) } } } diff --git a/modules/features/root/impl/build.gradle.kts b/modules/features/root/impl/build.gradle.kts index 3fad0540..fd146807 100644 --- a/modules/features/root/impl/build.gradle.kts +++ b/modules/features/root/impl/build.gradle.kts @@ -40,10 +40,13 @@ kotlin { implementation(projects.modules.services.apiEmpireapi) implementation(projects.modules.features.root.api) implementation(projects.modules.features.splash.impl) + implementation(projects.modules.features.rating.api) implementation(projects.modules.features.rating.impl) implementation(projects.modules.features.theme.api) implementation(projects.modules.features.theme.impl) + implementation(projects.modules.features.status.api) implementation(projects.modules.features.status.impl) + implementation(projects.modules.features.towns.api) implementation(projects.modules.features.towns.impl) implementation(projects.modules.features.tabs.impl) } diff --git a/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/di/RootModule.kt b/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/di/RootModule.kt index f3cbdc9f..a3df0dff 100644 --- a/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/di/RootModule.kt +++ b/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/di/RootModule.kt @@ -2,12 +2,16 @@ package com.makeevrserg.empireprojekt.mobile.features.root.di import com.makeevrserg.empireprojekt.mobile.api.empireapi.di.ApiEmpireApiModule import com.makeevrserg.empireprojekt.mobile.features.rating.user.di.RatingUserModule +import com.makeevrserg.empireprojekt.mobile.features.rating.user.di.RatingUserModuleImpl import com.makeevrserg.empireprojekt.mobile.features.rating.users.di.RatingUsersModule -import com.makeevrserg.empireprojekt.mobile.features.root.pager.di.PagerModule +import com.makeevrserg.empireprojekt.mobile.features.rating.users.di.RatingUsersModuleImpl import com.makeevrserg.empireprojekt.mobile.features.splash.di.SplashComponentModule import com.makeevrserg.empireprojekt.mobile.features.status.di.StatusModule +import com.makeevrserg.empireprojekt.mobile.features.status.di.StatusModuleImpl import com.makeevrserg.empireprojekt.mobile.features.theme.di.ThemeSwitcherModule +import com.makeevrserg.empireprojekt.mobile.features.theme.di.ThemeSwitcherModuleImpl import com.makeevrserg.empireprojekt.mobile.features.towny.towns.di.TownsModule +import com.makeevrserg.empireprojekt.mobile.features.towny.towns.di.TownsModuleImpl import com.makeevrserg.empireprojekt.mobile.services.core.di.CoreModule interface RootModule { @@ -34,11 +38,11 @@ interface RootModule { ) } override val themeSwitcherModule: ThemeSwitcherModule by lazy { - ThemeSwitcherModule.Default(coreModule = coreModule) + ThemeSwitcherModuleImpl(coreModule = coreModule) } override val statusModule: StatusModule by lazy { - StatusModule.Default( + StatusModuleImpl( coreModule = coreModule ) } @@ -50,20 +54,20 @@ interface RootModule { } override val townsModule: TownsModule by lazy { - TownsModule.Default( + TownsModuleImpl( apiEmpireApiModule = apiEmpireApiModule, coreModule = coreModule ) } override val ratingUserModule: RatingUserModule - get() = RatingUserModule.Default( + get() = RatingUserModuleImpl( apiEmpireApiModule = apiEmpireApiModule, coreModule = coreModule ) override val ratingUsersModule: RatingUsersModule by lazy { - RatingUsersModule.Default( + RatingUsersModuleImpl( apiEmpireApiModule = apiEmpireApiModule, coreModule = coreModule diff --git a/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/screen/DefaultRootScreenComponent.kt b/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/screen/DefaultRootScreenComponent.kt index 4ee346a6..173d4a19 100644 --- a/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/screen/DefaultRootScreenComponent.kt +++ b/modules/features/root/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/root/screen/DefaultRootScreenComponent.kt @@ -74,7 +74,7 @@ class DefaultRootScreenComponent( ) : Configuration class Pager( - val pagerComponent: com.makeevrserg.empireprojekt.mobile.features.root.pager.PagerComponent + val pagerComponent: PagerComponent ) : Configuration } } diff --git a/modules/features/root/ui/build.gradle.kts b/modules/features/root/ui/build.gradle.kts index 359a5974..b24dafca 100644 --- a/modules/features/root/ui/build.gradle.kts +++ b/modules/features/root/ui/build.gradle.kts @@ -36,15 +36,18 @@ kotlin { implementation(projects.modules.services.core) implementation(projects.modules.features.root.api) implementation(projects.modules.features.root.impl) + implementation(projects.modules.features.rating.api) implementation(projects.modules.features.rating.impl) implementation(projects.modules.features.rating.ui) implementation(projects.modules.features.splash.impl) implementation(projects.modules.features.splash.ui) + implementation(projects.modules.features.status.api) implementation(projects.modules.features.status.impl) implementation(projects.modules.features.status.ui) implementation(projects.modules.features.theme.api) implementation(projects.modules.features.theme.impl) implementation(projects.modules.features.theme.ui) + implementation(projects.modules.features.towns.api) implementation(projects.modules.features.towns.impl) implementation(projects.modules.features.towns.ui) implementation(projects.modules.features.info.ui) diff --git a/modules/features/root/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/root/ApplicationContent.kt b/modules/features/root/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/root/ApplicationContent.kt index 0847c39c..6d10b6a8 100644 --- a/modules/features/root/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/root/ApplicationContent.kt +++ b/modules/features/root/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/root/ApplicationContent.kt @@ -10,9 +10,13 @@ import com.arkivanov.decompose.extensions.compose.stack.animation.stackAnimation import com.arkivanov.decompose.extensions.compose.subscribeAsState import com.makeevrserg.empireprojekt.mobile.features.root.RootComponent import com.makeevrserg.empireprojekt.mobile.features.root.screen.DefaultRootScreenComponent +import com.makeevrserg.empireprojekt.mobile.features.ui.map.AndroidMapView import com.makeevrserg.empireprojekt.mobile.features.ui.pager.PagerScreenComponent import com.makeevrserg.empireprojekt.mobile.features.ui.rating.user.RatingUserScreenComponent +import com.makeevrserg.empireprojekt.mobile.features.ui.rating.users.RatingUsersScreenComponent import com.makeevrserg.empireprojekt.mobile.features.ui.splash.SplashScreenComponent +import com.makeevrserg.empireprojekt.mobile.features.ui.status.StatusScreen +import com.makeevrserg.empireprojekt.mobile.features.ui.towny.towns.TownsScreenComponent @Composable fun ApplicationContent( @@ -39,8 +43,28 @@ fun ApplicationContent( is DefaultRootScreenComponent.Configuration.Pager -> PagerScreenComponent( pagerComponent = screen.pagerComponent, - rootBottomSheetComponent = rootComponent.rootBottomSheetComponent, - rootScreenComponent = rootComponent.rootScreenComponent + ratingUsersScreen = { modifier, child -> + RatingUsersScreenComponent( + ratingUsersComponent = child.ratingUsersComponent, + popComponent = rootComponent.rootScreenComponent + ) + }, + townsScreen = { modifier, child -> + TownsScreenComponent( + popComponent = rootComponent.rootScreenComponent, + townsComponent = child.townsComponent + ) + }, + statusScreen = { modifier, child -> + StatusScreen( + themeSwitcherComponent = child.themeSwitcherComponent, + rootStatusComponent = child.rootStatusComponent, + rootBottomSheetRouter = rootComponent.rootBottomSheetComponent + ) + }, + mapScreen = { modifier, child -> + AndroidMapView() + } ) } } diff --git a/modules/features/status/api/build.gradle.kts b/modules/features/status/api/build.gradle.kts new file mode 100644 index 00000000..421b5cf6 --- /dev/null +++ b/modules/features/status/api/build.gradle.kts @@ -0,0 +1,28 @@ +@file:Suppress("UnusedPrivateMember") + +import ru.astrainteractive.gradleplugin.property.extension.ModelPropertyValueExt.requireProjectInfo + +plugins { + id("com.android.library") + kotlin("multiplatform") + id("ru.astrainteractive.gradleplugin.java.core") + id("ru.astrainteractive.gradleplugin.android.core") + alias(libs.plugins.kotlin.serialization) +} + +kotlin { + androidTarget() + applyDefaultHierarchyTemplate() + sourceSets { + val commonMain by getting { + dependencies { + // Coroutines + implementation(libs.kotlin.coroutines.core) + implementation(libs.moko.resources.core) + } + } + } +} +android { + namespace = "${requireProjectInfo.group}.status.api" +} diff --git a/modules/features/status/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/di/StatusModule.kt b/modules/features/status/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/di/StatusModule.kt new file mode 100644 index 00000000..b6e97c5f --- /dev/null +++ b/modules/features/status/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/di/StatusModule.kt @@ -0,0 +1,8 @@ +package com.makeevrserg.empireprojekt.mobile.features.status.di + +import com.makeevrserg.empireprojekt.mobile.features.status.root.presentation.RootStatusComponent + +interface StatusModule { + + val rootStatusComponent: RootStatusComponent +} diff --git a/modules/features/status/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/root/presentation/RootStatusComponent.kt b/modules/features/status/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/root/presentation/RootStatusComponent.kt similarity index 100% rename from modules/features/status/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/root/presentation/RootStatusComponent.kt rename to modules/features/status/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/root/presentation/RootStatusComponent.kt diff --git a/modules/features/status/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/url/presentation/UrlStatusComponent.kt b/modules/features/status/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/url/presentation/UrlStatusComponent.kt similarity index 100% rename from modules/features/status/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/url/presentation/UrlStatusComponent.kt rename to modules/features/status/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/url/presentation/UrlStatusComponent.kt diff --git a/modules/features/status/impl/build.gradle.kts b/modules/features/status/impl/build.gradle.kts index e5363e2b..55b0ef93 100644 --- a/modules/features/status/impl/build.gradle.kts +++ b/modules/features/status/impl/build.gradle.kts @@ -35,6 +35,7 @@ kotlin { implementation(libs.ktor.client.core) // Local implementation(projects.modules.services.core) + implementation(projects.modules.features.status.api) } } diff --git a/modules/features/status/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/di/StatusModule.kt b/modules/features/status/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/di/StatusModule.kt deleted file mode 100644 index 6ec9b53a..00000000 --- a/modules/features/status/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/di/StatusModule.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.makeevrserg.empireprojekt.mobile.features.status.di - -import com.arkivanov.mvikotlin.main.store.DefaultStoreFactory -import com.makeevrserg.empireprojekt.mobile.features.status.root.presentation.DefaultRootStatusComponent -import com.makeevrserg.empireprojekt.mobile.features.status.root.presentation.RootStatusComponent -import com.makeevrserg.empireprojekt.mobile.services.core.di.CoreModule - -interface StatusModule { - - val rootStatusComponent: RootStatusComponent - - class Default( - private val coreModule: CoreModule - ) : StatusModule { - - override val rootStatusComponent: RootStatusComponent by lazy { - val dependencies = RootStatusComponentDependencies.Default( - dispatchers = coreModule.dispatchers, - storeFactory = DefaultStoreFactory(), - httpClient = coreModule.httpClient - ) - DefaultRootStatusComponent( - dependencies = dependencies - ) - } - } -} diff --git a/modules/features/status/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/di/StatusModuleImpl.kt b/modules/features/status/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/di/StatusModuleImpl.kt new file mode 100644 index 00000000..c4ba6196 --- /dev/null +++ b/modules/features/status/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/status/di/StatusModuleImpl.kt @@ -0,0 +1,22 @@ +package com.makeevrserg.empireprojekt.mobile.features.status.di + +import com.arkivanov.mvikotlin.main.store.DefaultStoreFactory +import com.makeevrserg.empireprojekt.mobile.features.status.root.presentation.DefaultRootStatusComponent +import com.makeevrserg.empireprojekt.mobile.features.status.root.presentation.RootStatusComponent +import com.makeevrserg.empireprojekt.mobile.services.core.di.CoreModule + +class StatusModuleImpl( + private val coreModule: CoreModule +) : StatusModule { + + override val rootStatusComponent: RootStatusComponent by lazy { + val dependencies = RootStatusComponentDependencies.Default( + dispatchers = coreModule.dispatchers, + storeFactory = DefaultStoreFactory(), + httpClient = coreModule.httpClient + ) + DefaultRootStatusComponent( + dependencies = dependencies + ) + } +} diff --git a/modules/features/status/ui/build.gradle.kts b/modules/features/status/ui/build.gradle.kts index a207adf9..df4b96c7 100644 --- a/modules/features/status/ui/build.gradle.kts +++ b/modules/features/status/ui/build.gradle.kts @@ -31,6 +31,7 @@ kotlin { implementation(projects.modules.services.coreResources) implementation(projects.modules.services.coreUi) implementation(projects.modules.services.buildKonfig) + implementation(projects.modules.features.status.api) implementation(projects.modules.features.status.impl) implementation(projects.modules.features.root.api) implementation(projects.modules.features.theme.api) diff --git a/modules/features/tabs/impl/build.gradle.kts b/modules/features/tabs/impl/build.gradle.kts index 05fffd35..0ff0dfd2 100644 --- a/modules/features/tabs/impl/build.gradle.kts +++ b/modules/features/tabs/impl/build.gradle.kts @@ -29,11 +29,10 @@ kotlin { // Local implementation(projects.modules.services.core) implementation(projects.modules.features.root.api) - implementation(projects.modules.features.towns.impl) - implementation(projects.modules.features.rating.impl) - implementation(projects.modules.features.status.impl) + implementation(projects.modules.features.towns.api) + implementation(projects.modules.features.rating.api) + implementation(projects.modules.features.status.api) implementation(projects.modules.features.theme.api) - implementation(projects.modules.features.theme.impl) } } } diff --git a/modules/features/tabs/ui/build.gradle.kts b/modules/features/tabs/ui/build.gradle.kts index 3fd8f9fc..5db09bf6 100644 --- a/modules/features/tabs/ui/build.gradle.kts +++ b/modules/features/tabs/ui/build.gradle.kts @@ -31,18 +31,13 @@ kotlin { implementation(projects.modules.services.coreResources) implementation(projects.modules.services.coreUi) implementation(projects.modules.services.core) - implementation(projects.modules.features.splash.impl) + // Features implementation(projects.modules.features.root.api) - implementation(projects.modules.features.tabs.impl) - implementation(projects.modules.features.map.ui) - implementation(projects.modules.features.towns.impl) - implementation(projects.modules.features.towns.ui) - implementation(projects.modules.features.rating.impl) - implementation(projects.modules.features.rating.ui) - implementation(projects.modules.features.status.impl) - implementation(projects.modules.features.status.ui) + implementation(projects.modules.features.towns.api) + implementation(projects.modules.features.rating.api) + implementation(projects.modules.features.status.api) implementation(projects.modules.features.theme.api) - implementation(projects.modules.features.theme.impl) + implementation(projects.modules.features.tabs.impl) } } } diff --git a/modules/features/tabs/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/PagerScreenComponent.kt b/modules/features/tabs/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/PagerScreenComponent.kt index 19c572b1..09fca916 100644 --- a/modules/features/tabs/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/PagerScreenComponent.kt +++ b/modules/features/tabs/ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/ui/pager/PagerScreenComponent.kt @@ -9,21 +9,18 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier -import com.makeevrserg.empireprojekt.mobile.features.root.modal.RootBottomSheetRouter +import com.makeevrserg.empireprojekt.mobile.core.ui.DecomposeScreen import com.makeevrserg.empireprojekt.mobile.features.root.pager.PagerComponent -import com.makeevrserg.empireprojekt.mobile.features.root.screen.RootRouter -import com.makeevrserg.empireprojekt.mobile.features.ui.map.AndroidMapView import com.makeevrserg.empireprojekt.mobile.features.ui.pager.components.PagerBottomBar -import com.makeevrserg.empireprojekt.mobile.features.ui.rating.users.RatingUsersScreenComponent -import com.makeevrserg.empireprojekt.mobile.features.ui.status.StatusScreen -import com.makeevrserg.empireprojekt.mobile.features.ui.towny.towns.TownsScreenComponent @Composable fun PagerScreenComponent( pagerComponent: PagerComponent, - rootScreenComponent: RootRouter, - rootBottomSheetComponent: RootBottomSheetRouter, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, + ratingUsersScreen: DecomposeScreen, + statusScreen: DecomposeScreen, + townsScreen: DecomposeScreen, + mapScreen: DecomposeScreen ) { val selectedChild by pagerComponent.selectedChild.collectAsState() val selectedBottomBarItem by pagerComponent.selectedBottomBarItem.collectAsState() @@ -44,23 +41,25 @@ fun PagerScreenComponent( label = "Crossfade instance composable" ) { instance -> when (instance) { - is PagerComponent.Child.RatingUsers -> RatingUsersScreenComponent( - ratingUsersComponent = instance.ratingUsersComponent, - popComponent = rootScreenComponent + is PagerComponent.Child.RatingUsers -> ratingUsersScreen.Render( + child = instance, + modifier = Modifier ) - is PagerComponent.Child.Status -> StatusScreen( - themeSwitcherComponent = instance.themeSwitcherComponent, - rootStatusComponent = instance.rootStatusComponent, - rootBottomSheetRouter = rootBottomSheetComponent + is PagerComponent.Child.Status -> statusScreen.Render( + child = instance, + modifier = Modifier ) - is PagerComponent.Child.Towns -> TownsScreenComponent( - popComponent = rootScreenComponent, - townsComponent = instance.townsComponent + is PagerComponent.Child.Towns -> townsScreen.Render( + child = instance, + modifier = Modifier ) - PagerComponent.Child.Map -> AndroidMapView() + is PagerComponent.Child.Map -> mapScreen.Render( + child = instance, + modifier = Modifier + ) } } } diff --git a/modules/features/theme/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/theme/di/ThemeSwitcherModule.kt b/modules/features/theme/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/theme/di/ThemeSwitcherModule.kt new file mode 100644 index 00000000..bcf791b3 --- /dev/null +++ b/modules/features/theme/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/theme/di/ThemeSwitcherModule.kt @@ -0,0 +1,8 @@ +package com.makeevrserg.empireprojekt.mobile.features.theme.di + +import com.makeevrserg.empireprojekt.mobile.features.theme.presentation.ThemeSwitcherComponent + +interface ThemeSwitcherModule { + + val themeSwitcherComponent: ThemeSwitcherComponent +} diff --git a/modules/features/theme/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/theme/di/ThemeSwitcherModule.kt b/modules/features/theme/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/theme/di/ThemeSwitcherModule.kt deleted file mode 100644 index 5c8ded48..00000000 --- a/modules/features/theme/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/theme/di/ThemeSwitcherModule.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.makeevrserg.empireprojekt.mobile.features.theme.di - -import com.makeevrserg.empireprojekt.mobile.features.theme.data.ThemeSwitcherRepositoryImpl -import com.makeevrserg.empireprojekt.mobile.features.theme.presentation.DefaultThemeSwitcherComponent -import com.makeevrserg.empireprojekt.mobile.features.theme.presentation.ThemeSwitcherComponent -import com.makeevrserg.empireprojekt.mobile.services.core.di.CoreModule -import ru.astrainteractive.klibs.kdi.getValue - -interface ThemeSwitcherModule { - - val themeSwitcherComponent: ThemeSwitcherComponent - - class Default(coreModule: CoreModule) : ThemeSwitcherModule { - override val themeSwitcherComponent: ThemeSwitcherComponent by lazy { - DefaultThemeSwitcherComponent( - themeSwitcherRepository = ThemeSwitcherRepositoryImpl( - settings = coreModule.settings - ) - ) - } - } -} diff --git a/modules/features/theme/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/theme/di/ThemeSwitcherModuleImpl.kt b/modules/features/theme/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/theme/di/ThemeSwitcherModuleImpl.kt new file mode 100644 index 00000000..fd99c72e --- /dev/null +++ b/modules/features/theme/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/theme/di/ThemeSwitcherModuleImpl.kt @@ -0,0 +1,16 @@ +package com.makeevrserg.empireprojekt.mobile.features.theme.di + +import com.makeevrserg.empireprojekt.mobile.features.theme.data.ThemeSwitcherRepositoryImpl +import com.makeevrserg.empireprojekt.mobile.features.theme.presentation.DefaultThemeSwitcherComponent +import com.makeevrserg.empireprojekt.mobile.features.theme.presentation.ThemeSwitcherComponent +import com.makeevrserg.empireprojekt.mobile.services.core.di.CoreModule + +class ThemeSwitcherModuleImpl(coreModule: CoreModule) : ThemeSwitcherModule { + override val themeSwitcherComponent: ThemeSwitcherComponent by lazy { + DefaultThemeSwitcherComponent( + themeSwitcherRepository = ThemeSwitcherRepositoryImpl( + settings = coreModule.settings + ) + ) + } +} diff --git a/modules/features/towns/api/build.gradle.kts b/modules/features/towns/api/build.gradle.kts new file mode 100644 index 00000000..4c53cc01 --- /dev/null +++ b/modules/features/towns/api/build.gradle.kts @@ -0,0 +1,29 @@ +@file:Suppress("UnusedPrivateMember") + +import ru.astrainteractive.gradleplugin.property.extension.ModelPropertyValueExt.requireProjectInfo + +plugins { + id("com.android.library") + kotlin("multiplatform") + id("ru.astrainteractive.gradleplugin.java.core") + id("ru.astrainteractive.gradleplugin.android.core") + alias(libs.plugins.kotlin.serialization) +} + +kotlin { + androidTarget() + applyDefaultHierarchyTemplate() + sourceSets { + val commonMain by getting { + dependencies { + // Coroutines + implementation(libs.kotlin.coroutines.core) + implementation(libs.decompose.core) + implementation(projects.modules.services.apiEmpireapi) + } + } + } +} +android { + namespace = "${requireProjectInfo.group}.towns.api" +} diff --git a/modules/features/towns/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/towny/towns/di/TownsModule.kt b/modules/features/towns/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/towny/towns/di/TownsModule.kt new file mode 100644 index 00000000..992876b8 --- /dev/null +++ b/modules/features/towns/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/towny/towns/di/TownsModule.kt @@ -0,0 +1,8 @@ +package com.makeevrserg.empireprojekt.mobile.features.towny.towns.di + +import com.arkivanov.decompose.ComponentContext +import com.makeevrserg.empireprojekt.mobile.features.towny.towns.presentation.TownsComponent + +interface TownsModule { + fun createTownsComponent(componentContext: ComponentContext): TownsComponent +} diff --git a/modules/features/towns/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/towny/towns/presentation/TownsComponent.kt b/modules/features/towns/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/towny/towns/presentation/TownsComponent.kt similarity index 100% rename from modules/features/towns/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/towny/towns/presentation/TownsComponent.kt rename to modules/features/towns/api/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/towny/towns/presentation/TownsComponent.kt diff --git a/modules/features/towns/impl/build.gradle.kts b/modules/features/towns/impl/build.gradle.kts index 045b9b0e..4e976a8d 100644 --- a/modules/features/towns/impl/build.gradle.kts +++ b/modules/features/towns/impl/build.gradle.kts @@ -41,6 +41,7 @@ kotlin { implementation(projects.modules.services.coreResources) implementation(projects.modules.services.core) implementation(projects.modules.services.apiEmpireapi) + implementation(projects.modules.features.towns.api) } } } diff --git a/modules/features/towns/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/towny/towns/di/TownsModule.kt b/modules/features/towns/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/towny/towns/di/TownsModule.kt deleted file mode 100644 index e0673fd7..00000000 --- a/modules/features/towns/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/towny/towns/di/TownsModule.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.makeevrserg.empireprojekt.mobile.features.towny.towns.di - -import com.arkivanov.decompose.ComponentContext -import com.makeevrserg.empireprojekt.mobile.api.empireapi.di.ApiEmpireApiModule -import com.makeevrserg.empireprojekt.mobile.features.towny.towns.presentation.DefaultTownsComponent -import com.makeevrserg.empireprojekt.mobile.features.towny.towns.presentation.TownsComponent -import com.makeevrserg.empireprojekt.mobile.services.core.di.CoreModule - -interface TownsModule { - fun createTownsComponent(componentContext: ComponentContext): TownsComponent - class Default( - private val apiEmpireApiModule: ApiEmpireApiModule, - private val coreModule: CoreModule - ) : TownsModule { - override fun createTownsComponent(componentContext: ComponentContext): TownsComponent { - val dependencies = TownsDependencies.Default( - apiEmpireApiModule = apiEmpireApiModule, - dispatchers = coreModule.dispatchers, - settings = coreModule.settings - ) - return DefaultTownsComponent( - componentContext = componentContext, - dependencies = dependencies - ) - } - } -} diff --git a/modules/features/towns/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/towny/towns/di/TownsModuleImpl.kt b/modules/features/towns/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/towny/towns/di/TownsModuleImpl.kt new file mode 100644 index 00000000..39ac5182 --- /dev/null +++ b/modules/features/towns/impl/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/features/towny/towns/di/TownsModuleImpl.kt @@ -0,0 +1,24 @@ +package com.makeevrserg.empireprojekt.mobile.features.towny.towns.di + +import com.arkivanov.decompose.ComponentContext +import com.makeevrserg.empireprojekt.mobile.api.empireapi.di.ApiEmpireApiModule +import com.makeevrserg.empireprojekt.mobile.features.towny.towns.presentation.DefaultTownsComponent +import com.makeevrserg.empireprojekt.mobile.features.towny.towns.presentation.TownsComponent +import com.makeevrserg.empireprojekt.mobile.services.core.di.CoreModule + +class TownsModuleImpl( + private val apiEmpireApiModule: ApiEmpireApiModule, + private val coreModule: CoreModule +) : TownsModule { + override fun createTownsComponent(componentContext: ComponentContext): TownsComponent { + val dependencies = TownsDependencies.Default( + apiEmpireApiModule = apiEmpireApiModule, + dispatchers = coreModule.dispatchers, + settings = coreModule.settings + ) + return DefaultTownsComponent( + componentContext = componentContext, + dependencies = dependencies + ) + } +} diff --git a/modules/features/towns/ui/build.gradle.kts b/modules/features/towns/ui/build.gradle.kts index 100278a8..4fd8e817 100644 --- a/modules/features/towns/ui/build.gradle.kts +++ b/modules/features/towns/ui/build.gradle.kts @@ -37,6 +37,7 @@ kotlin { implementation(projects.modules.services.coreUi) implementation(projects.modules.services.core) implementation(projects.modules.services.apiEmpireapi) + implementation(projects.modules.features.towns.api) implementation(projects.modules.features.towns.impl) } } diff --git a/modules/services/core-ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/core/ui/DecomposeScreen.kt b/modules/services/core-ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/core/ui/DecomposeScreen.kt new file mode 100644 index 00000000..ac021b30 --- /dev/null +++ b/modules/services/core-ui/src/commonMain/kotlin/com/makeevrserg/empireprojekt/mobile/core/ui/DecomposeScreen.kt @@ -0,0 +1,9 @@ +package com.makeevrserg.empireprojekt.mobile.core.ui + +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier + +fun interface DecomposeScreen { + @Composable + fun Render(modifier: Modifier, child: T) +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 2feae5c0..d444b973 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -44,10 +44,13 @@ include(":modules:features:splash:ui") include(":modules:features:theme:api") include(":modules:features:theme:impl") include(":modules:features:theme:ui") +include(":modules:features:status:api") include(":modules:features:status:impl") include(":modules:features:status:ui") +include(":modules:features:rating:api") include(":modules:features:rating:impl") include(":modules:features:rating:ui") +include(":modules:features:towns:api") include(":modules:features:towns:impl") include(":modules:features:towns:ui") include(":modules:features:info:ui") From c4c0d597a796301ff1cce2a7bb66172ad39ffb6f Mon Sep 17 00:00:00 2001 From: makeevrserg Date: Sun, 28 Jul 2024 02:50:44 +0300 Subject: [PATCH 3/4] up version 0.7.1 25 --- .gitignore | 3 +++ gradle.properties | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e90a9b9d..3ccba16d 100644 --- a/.gitignore +++ b/.gitignore @@ -48,6 +48,7 @@ modules/services/wear-messenger/common/build # Features ---------------------------------- modules/features/info/ui/build modules/features/map/ui/build +modules/features/rating/api/build modules/features/rating/impl/build modules/features/rating/ui/build modules/features/root/api/build @@ -55,11 +56,13 @@ modules/features/root/impl/build modules/features/root/ui/build modules/features/splash/impl/build modules/features/splash/ui/build +modules/features/status/api/build modules/features/status/impl/build modules/features/status/ui/build modules/features/theme/api/build modules/features/theme/impl/build modules/features/theme/ui/build +modules/features/towns/api/build modules/features/towns/impl/build modules/features/towns/ui/build modules/features/tabs/impl/build diff --git a/gradle.properties b/gradle.properties index 1168efcb..d45b8a30 100644 --- a/gradle.properties +++ b/gradle.properties @@ -45,8 +45,8 @@ makeevrserg.android.sdk.target=34 # Project makeevrserg.project.name=EmpireProjektMobile makeevrserg.project.group=com.makeevrserg.empireprojekt.mobile -makeevrserg.project.version.string=0.7.0 -makeevrserg.project.version.code=24 +makeevrserg.project.version.string=0.7.1 +makeevrserg.project.version.code=25 makeevrserg.project.description=EmpireProjekt mobile application makeevrserg.project.developers=makeevrserg|Makeev Roman|makeevrserg@gmail.com makeevrserg.project.url=https://empireprojekt.ru From 968d4086ff9abc0ade08d6ee0a4658c5e7021ad8 Mon Sep 17 00:00:00 2001 From: makeevrserg Date: Sun, 28 Jul 2024 03:01:35 +0300 Subject: [PATCH 4/4] fix wear app build --- instances/wearApp/build.gradle.kts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/instances/wearApp/build.gradle.kts b/instances/wearApp/build.gradle.kts index 8db6f09c..8797ae75 100644 --- a/instances/wearApp/build.gradle.kts +++ b/instances/wearApp/build.gradle.kts @@ -129,10 +129,12 @@ dependencies { implementation(libs.decompose.compose) implementation(libs.google.gms.services.wearable) // Local + implementation(projects.modules.features.root.api) implementation(projects.modules.features.root.impl) implementation(projects.modules.features.theme.api) implementation(projects.modules.features.theme.impl) implementation(projects.modules.features.theme.ui) + implementation(projects.modules.features.status.api) implementation(projects.modules.features.status.impl) implementation(projects.modules.services.coreUi) implementation(projects.modules.services.coreResources)