Skip to content

Commit 715019b

Browse files
committed
refactor: multi module
1 parent 450719d commit 715019b

File tree

120 files changed

+1902
-1376
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+1902
-1376
lines changed

.github/workflows/Build.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ jobs:
4545
# - name: Run local tests
4646
# run: ./gradlew testDebug testProdDebug --stacktrace
4747

48-
- name: Upload build outputs (APKs)
49-
uses: actions/upload-artifact@v3
50-
with:
51-
name: build-outputs
52-
path: app/build/outputs
48+
# - name: Upload build outputs (APKs)
49+
# uses: actions/upload-artifact@v3
50+
# with:
51+
# name: build-outputs
52+
# path: app/build/outputs
5353

5454
- name: Upload build reports
5555
if: always()

app/build.gradle.kts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,15 @@ android {
2626

2727
dependencies {
2828

29-
implementation(project(":presentation"))
30-
implementation(project(":domain"))
31-
implementation(project(":data"))
29+
implementation(project(":core:designsystem"))
3230

33-
implementation(libs.material)
31+
implementation(project(":feature:main"))
32+
implementation(project(":feature:detail"))
3433

34+
implementation(libs.material)
3535
implementation(libs.androidx.startup)
36-
37-
implementation(libs.androidx.core.ktx)
38-
implementation(libs.androidx.appcompat)
3936
implementation(libs.androidx.activity.compose)
37+
implementation(libs.androidx.hilt.navigation.compose)
4038

4139
implementation(libs.timber)
42-
4340
}

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<uses-permission android:name="android.permission.INTERNET" />
66

77
<application
8-
android:name=".app.BrBaApp"
8+
android:name=".app.BrBaApplication"
99
android:allowBackup="true"
1010
android:hardwareAccelerated="true"
1111
android:icon="@mipmap/ic_launcher"
@@ -14,7 +14,7 @@
1414
android:supportsRtl="true"
1515
android:theme="@style/Theme.BrBaCompose">
1616
<activity
17-
android:name=".app.ui.MainActivity"
17+
android:name=".app.MainActivity"
1818
android:exported="true"
1919
android:theme="@style/Theme.BrBaCompose.NoActionBar">
2020
<intent-filter>

app/src/main/java/io/github/shinhyo/brba/app/BrBaApp.kt renamed to app/src/main/java/io/github/shinhyo/brba/app/BrBaApplication.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ import android.app.Application
1919
import dagger.hilt.android.HiltAndroidApp
2020

2121
@HiltAndroidApp
22-
class BrBaApp : Application()
22+
class BrBaApplication : Application()

app/src/main/java/io/github/shinhyo/brba/app/ui/MainActivity.kt renamed to app/src/main/java/io/github/shinhyo/brba/app/MainActivity.kt

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,27 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package io.github.shinhyo.brba.app.ui
16+
package io.github.shinhyo.brba.app
1717

1818
import android.os.Bundle
1919
import androidx.activity.compose.setContent
2020
import androidx.appcompat.app.AppCompatActivity
21-
import androidx.compose.runtime.Composable
2221
import androidx.core.view.WindowCompat
2322
import dagger.hilt.android.AndroidEntryPoint
24-
import io.github.shinhyo.brba.presentation.theme.BrBaComposeTheme
25-
import io.github.shinhyo.brba.presentation.ui.NavGraph
23+
import io.github.shinhyo.brba.app.ui.BrbaApp
24+
import io.github.shinhyo.brba.core.designsystem.theme.BrBaComposeTheme
2625

2726
@AndroidEntryPoint
2827
class MainActivity : AppCompatActivity() {
2928

3029
override fun onCreate(savedInstanceState: Bundle?) {
3130
super.onCreate(savedInstanceState)
3231
WindowCompat.setDecorFitsSystemWindows(window, false)
32+
3333
setContent {
34-
ComposeApp {
35-
NavGraph()
34+
BrBaComposeTheme {
35+
BrbaApp()
3636
}
3737
}
3838
}
3939
}
40-
41-
@Composable
42-
fun ComposeApp(content: @Composable () -> Unit) {
43-
BrBaComposeTheme {
44-
content()
45-
}
46-
}

app/src/main/java/io/github/shinhyo/brba/app/di/CoroutinesModule.kt

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,25 @@
1616
package io.github.shinhyo.brba.app.di
1717

1818
import dagger.Module
19-
import dagger.Provides
2019
import dagger.hilt.InstallIn
2120
import dagger.hilt.components.SingletonComponent
22-
import io.github.shinhyo.brba.domain.di.DefaultDispatcher
23-
import io.github.shinhyo.brba.domain.di.IoDispatcher
24-
import io.github.shinhyo.brba.domain.di.MainDispatcher
25-
import io.github.shinhyo.brba.domain.di.MainImmediateDispatcher
26-
import kotlinx.coroutines.CoroutineDispatcher
27-
import kotlinx.coroutines.Dispatchers
2821

2922
@InstallIn(SingletonComponent::class)
3023
@Module
3124
internal object CoroutinesModule {
32-
@DefaultDispatcher
33-
@Provides
34-
fun providesDefaultDispatcher(): CoroutineDispatcher = Dispatchers.Default
35-
36-
@IoDispatcher
37-
@Provides
38-
fun providesIoDispatcher(): CoroutineDispatcher = Dispatchers.IO
39-
40-
@MainDispatcher
41-
@Provides
42-
fun providesMainDispatcher(): CoroutineDispatcher = Dispatchers.Main
43-
44-
@MainImmediateDispatcher
45-
@Provides
46-
fun providesMainImmediateDispatcher(): CoroutineDispatcher = Dispatchers.Main.immediate
25+
// @DefaultDispatcher
26+
// @Provides
27+
// fun providesDefaultDispatcher(): CoroutineDispatcher = Dispatchers.Default
28+
//
29+
// @IoDispatcher
30+
// @Provides
31+
// fun providesIoDispatcher(): CoroutineDispatcher = Dispatchers.IO
32+
//
33+
// @MainDispatcher
34+
// @Provides
35+
// fun providesMainDispatcher(): CoroutineDispatcher = Dispatchers.Main
36+
//
37+
// @MainImmediateDispatcher
38+
// @Provides
39+
// fun providesMainImmediateDispatcher(): CoroutineDispatcher = Dispatchers.Main.immediate
4740
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2021 shinhyo
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.github.shinhyo.brba.app.navigation
17+
18+
import androidx.compose.runtime.Composable
19+
import androidx.navigation.compose.NavHost
20+
import androidx.navigation.compose.rememberNavController
21+
import io.github.shinhyo.brba.feature.detail.navigaion.detailScreen
22+
import io.github.shinhyo.brba.feature.detail.navigaion.navigateToDetail
23+
import io.github.shinhyo.brba.feature.main.navigation.mainRoute
24+
import io.github.shinhyo.brba.feature.main.navigation.mainScreen
25+
26+
@Composable
27+
fun BrbaNavHost(startDestination: String = mainRoute) {
28+
val navController = rememberNavController()
29+
30+
NavHost(
31+
navController = navController,
32+
startDestination = startDestination
33+
) {
34+
mainScreen { id ->
35+
navController.navigateToDetail(id)
36+
}
37+
detailScreen()
38+
}
39+
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021 shinhyo
2+
* Copyright 2022 shinhyo
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,12 +13,12 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package io.github.shinhyo.brba.presentation.utils
16+
package io.github.shinhyo.brba.app.ui
1717

18-
import kotlinx.coroutines.flow.Flow
19-
import kotlinx.coroutines.flow.flow
20-
import kotlinx.coroutines.flow.toList
18+
import androidx.compose.runtime.Composable
19+
import io.github.shinhyo.brba.app.navigation.BrbaNavHost
2120

22-
fun <T> Flow<T>.toListSingle(): Flow<List<T>> = flow {
23-
emit(toList(mutableListOf()))
21+
@Composable
22+
fun BrbaApp() {
23+
BrbaNavHost()
2424
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright 2022 shinhyo
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.github.shinhyo.brba.app.ui
17+
18+
import androidx.compose.runtime.Composable
19+
import androidx.compose.runtime.Stable
20+
import androidx.compose.runtime.remember
21+
import androidx.compose.runtime.rememberCoroutineScope
22+
import androidx.navigation.NavHostController
23+
import androidx.navigation.compose.rememberNavController
24+
import kotlinx.coroutines.CoroutineScope
25+
26+
@Composable
27+
fun rememberAppState(
28+
coroutineScope: CoroutineScope = rememberCoroutineScope(),
29+
navController: NavHostController = rememberNavController()
30+
) = remember(navController, coroutineScope) {
31+
BrbaAppState(navController, coroutineScope)
32+
}
33+
34+
@Stable
35+
class BrbaAppState(
36+
val navController: NavHostController,
37+
val coroutineScope: CoroutineScope,
38+
) {
39+
40+
fun onBackClick() {
41+
navController.popBackStack()
42+
}
43+
}

app/src/main/res/values/themes.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
<resources>
22
<!-- Base application theme. -->
33
<style name="Theme.BrBaCompose" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
4-
<!-- Primary brand color. -->
5-
<!-- <item name="colorPrimary">@color/purple_500</item>-->
6-
<!-- <item name="colorPrimaryVariant">@color/purple_700</item>-->
7-
<!-- <item name="colorOnPrimary">@color/white</item>-->
8-
<!-- &lt;!&ndash; Secondary brand color. &ndash;&gt;-->
9-
<!-- <item name="colorSecondary">@color/teal_200</item>-->
10-
<!-- <item name="colorSecondaryVariant">@color/teal_700</item>-->
11-
<!-- <item name="colorOnSecondary">@color/black</item>-->
12-
<!-- Status bar color. -->
134
<item name="android:statusBarColor">@color/immersive_sys_ui</item>
14-
<!-- Customize your theme here. -->
155
</style>
166

177
<style name="Theme.BrBaCompose.NoActionBar">

0 commit comments

Comments
 (0)