Skip to content

Commit

Permalink
(ENG)[#252] feature 모듈 내 main 과 다른 모듈에 대해 수평 구조화
Browse files Browse the repository at this point in the history
  • Loading branch information
SeongUgJung committed Sep 10, 2023
1 parent 133b6dd commit e4d3144
Show file tree
Hide file tree
Showing 68 changed files with 837 additions and 128 deletions.
7 changes: 6 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ dependencies {
implementation(projects.core.datastoreApi)
implementation(projects.core.domain)
implementation(projects.core.domainApi)
implementation(projects.feature.main)
implementation(projects.feature.bookmark)
implementation(projects.feature.contributor)
implementation(projects.feature.home)
implementation(projects.feature.main)
implementation(projects.feature.mainNavGraph)
implementation(projects.feature.session)
implementation(projects.feature.setting)

implementation(projects.core.designsystem)
}
Binary file modified arts/architecture-module-graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import com.droidknights.app2023.configureCoroutineAndroid
import com.droidknights.app2023.configureKotest
import com.droidknights.app2023.configureKotlinAndroid

plugins {
id("com.android.library")
id("droidknights.verify.detekt")
}

configureKotlinAndroid()
configureKotest()
configureCoroutineAndroid()
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
package com.droidknights.app2023.core.domain.di

import com.droidknights.app2023.core.domain.usecase.api.BookmarkSessionUseCase
import com.droidknights.app2023.core.domain.usecase.BookmarkSessionUseCaseImpl
import com.droidknights.app2023.core.domain.usecase.api.GetBookmarkedSessionIdsUseCase
import com.droidknights.app2023.core.domain.usecase.GetBookmarkedSessionIdsUseCaseImpl
import com.droidknights.app2023.core.domain.usecase.api.GetBookmarkedSessionsUseCase
import com.droidknights.app2023.core.domain.usecase.GetBookmarkedSessionsUseCaseImpl
import com.droidknights.app2023.core.domain.usecase.api.GetContributorsUseCase
import com.droidknights.app2023.core.domain.usecase.GetContributorsUseCaseImpl
import com.droidknights.app2023.core.domain.usecase.api.GetSessionUseCase
import com.droidknights.app2023.core.domain.usecase.GetSessionUseCaseImpl
import com.droidknights.app2023.core.domain.usecase.api.GetSessionsUseCase
import com.droidknights.app2023.core.domain.usecase.GetSessionsUseCaseImpl
import com.droidknights.app2023.core.domain.usecase.api.GetSponsorsUseCase
import com.droidknights.app2023.core.domain.usecase.GetSponsorsUseCaseImpl
import com.droidknights.app2023.core.domain.usecase.api.BookmarkSessionUseCase
import com.droidknights.app2023.core.domain.usecase.api.GetBookmarkedSessionIdsUseCase
import com.droidknights.app2023.core.domain.usecase.api.GetBookmarkedSessionsUseCase
import com.droidknights.app2023.core.domain.usecase.api.GetContributorsUseCase
import com.droidknights.app2023.core.domain.usecase.api.GetSessionUseCase
import com.droidknights.app2023.core.domain.usecase.api.GetSessionsUseCase
import com.droidknights.app2023.core.domain.usecase.api.GetSponsorsUseCase
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ViewModelComponent
import dagger.hilt.components.SingletonComponent

@Module
@InstallIn(ViewModelComponent::class)
Expand Down
13 changes: 13 additions & 0 deletions feature/bookmark-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
id("droidknights.android.library-no-hilt")
id("droidknights.android.compose")
}

android {
namespace = "com.droidknights.app2023.feature.bookmark.api"
}

dependencies {
implementation(projects.feature.mainNavGraph)
implementation(libs.androidx.compose.navigation)
}
2 changes: 2 additions & 0 deletions feature/bookmark-api/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.droidknights.app2023.feature.bookmark.api

import androidx.navigation.NavOptions
import com.droidknights.app2023.feature.nav.DroidKnightsNavController

interface BookmarkNavController : DroidKnightsNavController<BookmarkNavControllerInfo>

data class BookmarkNavControllerInfo(
val navOptions: NavOptions,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.droidknights.app2023.feature.bookmark.api

import com.droidknights.app2023.feature.nav.DroidKnightsNavGraph

interface BookmarkNavGraph : DroidKnightsNavGraph<BookmarkNavGraphInfo>

data class BookmarkNavGraphInfo(
val onShowErrorSnackBar: (throwable: Throwable?) -> Unit,
)
4 changes: 4 additions & 0 deletions feature/bookmark/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ android {
}

dependencies {

implementation(projects.feature.bookmarkApi)
implementation(projects.feature.mainNavGraph)

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.activity.compose)
implementation(libs.kotlinx.immutable)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.droidknights.app2023.feature.bookmark.di

import com.droidknights.app2023.feature.bookmark.api.BookmarkNavController
import com.droidknights.app2023.feature.bookmark.api.BookmarkNavGraph
import com.droidknights.app2023.feature.bookmark.navigation.BookmarkNavControllerImpl
import com.droidknights.app2023.feature.bookmark.navigation.BookmarkNavGraphImpl
import com.droidknights.app2023.feature.bookmark.navigation.BookmarkTab
import com.droidknights.app2023.feature.nav.DroidKnightsTab
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ActivityComponent
import dagger.multibindings.IntoSet

@Module
@InstallIn(ActivityComponent::class)
internal abstract class BookmarkBindModule {
@Binds
abstract fun bookmarkNavControllerImpl(
dataSource: BookmarkNavControllerImpl,
): BookmarkNavController

@Binds
abstract fun bookmarkNavGraphImpl(
dataSource: BookmarkNavGraphImpl,
): BookmarkNavGraph

@Binds
@IntoSet
abstract fun bookmarkTab(
dataSource: BookmarkTab,
): DroidKnightsTab
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.droidknights.app2023.feature.bookmark.navigation

import androidx.navigation.NavController
import com.droidknights.app2023.feature.bookmark.api.BookmarkNavController
import com.droidknights.app2023.feature.bookmark.api.BookmarkNavControllerInfo
import javax.inject.Inject

internal class BookmarkNavControllerImpl @Inject constructor() : BookmarkNavController {
override fun route(): String = BookmarkRoute.route

override fun navigate(navController: NavController, navInfo: BookmarkNavControllerInfo) {
navController.navigateBookmark(navInfo.navOptions)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.droidknights.app2023.feature.bookmark.navigation

import androidx.navigation.NavGraphBuilder
import com.droidknights.app2023.feature.bookmark.api.BookmarkNavGraph
import com.droidknights.app2023.feature.bookmark.api.BookmarkNavGraphInfo
import javax.inject.Inject

internal class BookmarkNavGraphImpl @Inject constructor() : BookmarkNavGraph {
override fun buildNavGraph(navGraphBuilder: NavGraphBuilder, navInfo: BookmarkNavGraphInfo) {
navGraphBuilder.bookmarkNavGraph(navInfo.onShowErrorSnackBar)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import androidx.navigation.NavOptions
import androidx.navigation.compose.composable
import com.droidknights.app2023.feature.bookmark.BookmarkRoute

fun NavController.navigateBookmark(navOptions: NavOptions) {
internal fun NavController.navigateBookmark(navOptions: NavOptions) {
navigate(BookmarkRoute.route, navOptions)
}

fun NavGraphBuilder.bookmarkNavGraph(
onShowErrorSnackBar: (throwable: Throwable?) -> Unit
internal fun NavGraphBuilder.bookmarkNavGraph(
onShowErrorSnackBar: (throwable: Throwable?) -> Unit,
) {
composable(route = BookmarkRoute.route) {
BookmarkRoute(onShowErrorSnackBar)
}
}

object BookmarkRoute {
internal object BookmarkRoute {
const val route = "bookmark"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.droidknights.app2023.feature.bookmark.navigation

import com.droidknights.app2023.feature.bookmark.R
import com.droidknights.app2023.feature.nav.DroidKnightsTab
import javax.inject.Inject

internal class BookmarkTab @Inject constructor() : DroidKnightsTab {
override val iconResId: Int = R.drawable.ic_bookmark
override val contentDescription: String = "북마크"
override val route: String = BookmarkRoute.route
override val order: Int = 2
override val isStartDestination: Boolean = false
}
13 changes: 13 additions & 0 deletions feature/contributor-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
id("droidknights.android.library-no-hilt")
id("droidknights.android.compose")
}

android {
namespace = "com.droidknights.app2023.feature.contributor.api"
}

dependencies {
implementation(projects.feature.mainNavGraph)
implementation(libs.androidx.compose.navigation)
}
2 changes: 2 additions & 0 deletions feature/contributor-api/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.droidknights.app2023.feature.contributor.api

import com.droidknights.app2023.feature.nav.DroidKnightsNavController

interface ContributorNavController : DroidKnightsNavController<Unit>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.droidknights.app2023.feature.contributor.api

import com.droidknights.app2023.feature.nav.DroidKnightsNavGraph

interface ContributorNavGraph : DroidKnightsNavGraph<ContributorNavGraphInfo>

data class ContributorNavGraphInfo(
val onBackClick: () -> Unit,
val onShowErrorSnackBar: (throwable: Throwable?) -> Unit,
)
4 changes: 4 additions & 0 deletions feature/contributor/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ android {
}

dependencies {

implementation(projects.feature.contributorApi)
implementation(projects.feature.mainNavGraph)

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.activity.compose)
implementation(libs.compose.shimmer)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.droidknights.app2023.feature.contributor.di

import com.droidknights.app2023.feature.contributor.api.ContributorNavController
import com.droidknights.app2023.feature.contributor.api.ContributorNavGraph
import com.droidknights.app2023.feature.contributor.navigation.ContributorNavControllerImpl
import com.droidknights.app2023.feature.contributor.navigation.ContributorNavGraphImpl
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ActivityComponent

@Module
@InstallIn(ActivityComponent::class)
internal abstract class ContributorBindModule {
@Binds
abstract fun contributorNavControllerImpl(
dataSource: ContributorNavControllerImpl,
): ContributorNavController

@Binds
abstract fun contributorNavGraphImpl(
dataSource: ContributorNavGraphImpl,
): ContributorNavGraph
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.droidknights.app2023.feature.contributor.navigation

import androidx.navigation.NavController
import com.droidknights.app2023.feature.contributor.api.ContributorNavController
import javax.inject.Inject

internal class ContributorNavControllerImpl @Inject constructor() : ContributorNavController {
override fun navigate(navController: NavController, navInfo: Unit) {
navController.navigateContributor()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.droidknights.app2023.feature.contributor.navigation

import androidx.navigation.NavGraphBuilder
import com.droidknights.app2023.feature.contributor.api.ContributorNavGraph
import com.droidknights.app2023.feature.contributor.api.ContributorNavGraphInfo
import javax.inject.Inject

internal class ContributorNavGraphImpl @Inject constructor() : ContributorNavGraph {
override fun buildNavGraph(navGraphBuilder: NavGraphBuilder, navInfo: ContributorNavGraphInfo) {
navGraphBuilder.contributorNavGraph(
navInfo.onBackClick,
navInfo.onShowErrorSnackBar
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.droidknights.app2023.feature.contributor.ContributorRoute

fun NavController.navigateContributor() {
internal fun NavController.navigateContributor() {
this.navigate(ContributorRoute.route)
}

fun NavGraphBuilder.contributorNavGraph(
internal fun NavGraphBuilder.contributorNavGraph(
onBackClick: () -> Unit,
onShowErrorSnackBar: (throwable: Throwable?) -> Unit
onShowErrorSnackBar: (throwable: Throwable?) -> Unit,
) {
composable(route = ContributorRoute.route) {
ContributorRoute(
Expand All @@ -21,6 +21,6 @@ fun NavGraphBuilder.contributorNavGraph(
}
}

object ContributorRoute {
internal object ContributorRoute {
const val route = "contributor"
}
13 changes: 13 additions & 0 deletions feature/home-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
id("droidknights.android.library-no-hilt")
id("droidknights.android.compose")
}

android {
namespace = "com.droidknights.app2023.feature.home.api"
}

dependencies {
implementation(projects.feature.mainNavGraph)
implementation(libs.androidx.compose.navigation)
}
2 changes: 2 additions & 0 deletions feature/home-api/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.droidknights.app2023.feature.home.api

import androidx.navigation.NavOptions
import com.droidknights.app2023.feature.nav.DroidKnightsNavController

interface HomeNavController : DroidKnightsNavController<HomeNavControllerInfo> {
fun isHomeRoute(currentRoute: String?): Boolean
}

data class HomeNavControllerInfo(
val navOptions: NavOptions,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.droidknights.app2023.feature.home.api

import androidx.compose.foundation.layout.PaddingValues
import com.droidknights.app2023.feature.nav.DroidKnightsNavGraph

interface HomeNavGraph : DroidKnightsNavGraph<HomeNavGraphInfo>

data class HomeNavGraphInfo(
val padding: PaddingValues,
val onSessionClick: () -> Unit,
val onContributorClick: () -> Unit,
val onShowErrorSnackBar: (throwable: Throwable?) -> Unit,
)
4 changes: 4 additions & 0 deletions feature/home/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ android {
}

dependencies {

implementation(projects.feature.homeApi)
implementation(projects.feature.mainNavGraph)

implementation(libs.kotlinx.immutable)
implementation(libs.compose.shimmer)
}
Loading

0 comments on commit e4d3144

Please sign in to comment.