Skip to content

Commit

Permalink
Multimodule refactor
Browse files Browse the repository at this point in the history
- split api/impl modules
- add tab module
  • Loading branch information
makeevrserg authored Jul 28, 2024
2 parents 2038bf1 + 968d408 commit eb10c10
Show file tree
Hide file tree
Showing 54 changed files with 515 additions and 225 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,22 @@ 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
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/towns/ui/build
modules/features/tabs/impl/build
modules/features/tabs/ui/build
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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|[email protected]
makeevrserg.project.url=https://empireprojekt.ru
Expand Down
1 change: 1 addition & 0 deletions instances/androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions instances/wearApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 {
Expand Down
29 changes: 29 additions & 0 deletions modules/features/rating/api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 2 additions & 0 deletions modules/features/rating/impl/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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)
}
}
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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
)
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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"
)
)
}
)
}
}
1 change: 1 addition & 0 deletions modules/features/rating/ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions modules/features/root/api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ kotlin {
dependencies {
// Decompose
implementation(libs.decompose.core)
// Local
implementation(projects.modules.services.core)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 4 additions & 0 deletions modules/features/root/impl/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@ 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)
}
}
val androidMain by getting {
Expand Down
Loading

0 comments on commit eb10c10

Please sign in to comment.