-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat : app 모듈에 feature 모듈 네비게이션 그래프 바인딩
- Loading branch information
1 parent
0f35c3e
commit 0cc8396
Showing
18 changed files
with
189 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.dev.briefing | ||
|
||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.material3.Snackbar | ||
import androidx.compose.material3.SnackbarData | ||
import androidx.compose.material3.SnackbarHost | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
|
||
@Composable | ||
fun BriefingApp( | ||
appState: BriefingAppState = rememberBriefingAppState() | ||
) { | ||
Scaffold( | ||
snackbarHost = { | ||
SnackbarHost( | ||
hostState = appState.snackbarHostState, | ||
snackbar = { data: SnackbarData -> | ||
Snackbar( | ||
modifier = Modifier.padding( | ||
bottom = 30.dp, | ||
start = 20.dp, | ||
end = 20.dp | ||
) | ||
) { | ||
Text(text = data.visuals.message) | ||
} | ||
} | ||
) | ||
}, | ||
content = { innerPadding -> | ||
BriefingNavHost( | ||
modifier = Modifier.padding(innerPadding), | ||
appState = appState | ||
) | ||
} | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.dev.briefing | ||
|
||
import androidx.compose.material3.BottomSheetScaffoldState | ||
import androidx.compose.material3.SnackbarHostState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.Stable | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.rememberCoroutineScope | ||
import androidx.navigation.NavHostController | ||
import androidx.navigation.compose.rememberNavController | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.launch | ||
|
||
@Composable | ||
fun rememberBriefingAppState( | ||
navController: NavHostController = rememberNavController(), | ||
snackbarHostState: SnackbarHostState = remember { SnackbarHostState() }, | ||
scope: CoroutineScope = rememberCoroutineScope() | ||
): BriefingAppState { | ||
return remember { | ||
BriefingAppState( | ||
navController, | ||
snackbarHostState, | ||
scope | ||
) | ||
} | ||
} | ||
|
||
@Stable | ||
class BriefingAppState( | ||
val navController: NavHostController, | ||
val snackbarHostState: SnackbarHostState, | ||
val scope: CoroutineScope | ||
) { | ||
fun showSnackBar(message: String) { | ||
scope.launch { | ||
snackbarHostState.showSnackbar(message) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.dev.briefing | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.navigation.compose.NavHost | ||
import store.newsbriefing.app.feature.bookmark.bookmarkScreen | ||
import store.newsbriefing.app.feature.home.homeRoute | ||
import store.newsbriefing.app.feature.home.homeScreen | ||
import store.newsbriefing.app.feature.newsdetail.newsDetailScreen | ||
import store.newsbriefing.app.feature.setting.settingScreen | ||
|
||
@Composable | ||
fun BriefingNavHost( | ||
modifier: Modifier = Modifier, | ||
appState: BriefingAppState | ||
) { | ||
NavHost( | ||
modifier = modifier, | ||
navController = appState.navController, | ||
startDestination = homeRoute | ||
) { | ||
homeScreen( | ||
showSnackbar = appState::showSnackBar | ||
) | ||
bookmarkScreen( | ||
showSnackbar = appState::showSnackBar | ||
) | ||
newsDetailScreen( | ||
showSnackbar = appState::showSnackBar | ||
) | ||
settingScreen( | ||
showSnackbar = appState::showSnackBar | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 11 additions & 3 deletions
14
feature/home/src/main/java/store/newsbriefing/app/feature/home/HomeScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
package store.newsbriefing.app.feature.home | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.navigation.NavHostController | ||
|
||
@Composable | ||
internal fun HomeRoute() { | ||
HomeScreen() | ||
internal fun HomeRoute( | ||
showSnackbar: (String) -> Unit | ||
) { | ||
HomeScreen( | ||
showSnackbar = showSnackbar | ||
) | ||
} | ||
|
||
@Composable | ||
internal fun HomeScreen() { | ||
internal fun HomeScreen( | ||
showSnackbar: (String) -> Unit | ||
) { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters