From c1c0f32bba7143cf97bf751ad3a4bd9bd83e0ede Mon Sep 17 00:00:00 2001 From: rladmsdh Date: Tue, 6 Feb 2024 17:32:23 +0900 Subject: [PATCH] =?UTF-8?q?refactor=20::=20navHostControl=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../retum/jobisandroidv2/navigation/MainNavigation.kt | 8 ++++---- .../java/team/retum/jobisandroidv2/root/RootNavigation.kt | 3 ++- .../java/team/retum/jobisandroidv2/root/RootScreen.kt | 2 +- .../main/java/team/retum/jobisandroidv2/ui/JobisApp.kt | 5 +++-- .../java/team/retum/alarm/navigation/AlarmNavigation.kt | 6 +++--- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/team/retum/jobisandroidv2/navigation/MainNavigation.kt b/app/src/main/java/team/retum/jobisandroidv2/navigation/MainNavigation.kt index d66ef1711..a18fb92ff 100644 --- a/app/src/main/java/team/retum/jobisandroidv2/navigation/MainNavigation.kt +++ b/app/src/main/java/team/retum/jobisandroidv2/navigation/MainNavigation.kt @@ -1,7 +1,7 @@ package team.retum.jobisandroidv2.navigation -import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavHostController import androidx.navigation.navigation import team.retum.alarm.navigation.alarm import team.retum.jobisandroidv2.root.NAVIGATION_ROOT @@ -9,12 +9,12 @@ import team.retum.jobisandroidv2.root.root const val NAVIGATION_MAIN = "main" -fun NavGraphBuilder.mainNavigation(navController: NavController) { +fun NavGraphBuilder.mainNavigation(navHostController: NavHostController) { navigation( route = NAVIGATION_MAIN, startDestination = NAVIGATION_ROOT, ) { - root(navHostController = navController) - alarm(onBackPressed = navController::popBackStack) + root(navHostController = navHostController) + alarm(onBackPressed = navHostController::popBackStack) } } diff --git a/app/src/main/java/team/retum/jobisandroidv2/root/RootNavigation.kt b/app/src/main/java/team/retum/jobisandroidv2/root/RootNavigation.kt index 9a6cef744..2bcaa3ee1 100644 --- a/app/src/main/java/team/retum/jobisandroidv2/root/RootNavigation.kt +++ b/app/src/main/java/team/retum/jobisandroidv2/root/RootNavigation.kt @@ -2,11 +2,12 @@ package team.retum.jobisandroidv2.root import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavHostController import androidx.navigation.compose.composable const val NAVIGATION_ROOT = "root" -fun NavGraphBuilder.root(navHostController: NavController) { +fun NavGraphBuilder.root(navHostController: NavHostController) { composable(NAVIGATION_ROOT) { Root(navHostController = navHostController) } diff --git a/app/src/main/java/team/retum/jobisandroidv2/root/RootScreen.kt b/app/src/main/java/team/retum/jobisandroidv2/root/RootScreen.kt index eeab7b575..67c5dd723 100644 --- a/app/src/main/java/team/retum/jobisandroidv2/root/RootScreen.kt +++ b/app/src/main/java/team/retum/jobisandroidv2/root/RootScreen.kt @@ -13,7 +13,7 @@ import team.retum.home.navigation.home import team.retum.jobisandroidv2.ui.BottomNavigationBar @Composable -fun Root(navHostController: NavController) { +fun Root(navHostController: NavHostController) { val navController = rememberNavController() RootScreen( diff --git a/app/src/main/java/team/retum/jobisandroidv2/ui/JobisApp.kt b/app/src/main/java/team/retum/jobisandroidv2/ui/JobisApp.kt index 164239638..5c8ba7504 100644 --- a/app/src/main/java/team/retum/jobisandroidv2/ui/JobisApp.kt +++ b/app/src/main/java/team/retum/jobisandroidv2/ui/JobisApp.kt @@ -7,6 +7,7 @@ import androidx.compose.ui.Modifier import androidx.navigation.compose.NavHost import androidx.navigation.compose.rememberNavController import team.retum.jobisandroidv2.navigation.NAVIGATION_AUTH +import team.retum.jobisandroidv2.navigation.NAVIGATION_MAIN import team.retum.jobisandroidv2.navigation.authNavigation import team.retum.jobisandroidv2.navigation.mainNavigation @@ -19,9 +20,9 @@ internal fun JobisApp() { .navigationBarsPadding() .statusBarsPadding(), navController = navController, - startDestination = NAVIGATION_AUTH, + startDestination = NAVIGATION_MAIN, ) { authNavigation(navController = navController) - mainNavigation(navController = navController) + mainNavigation(navHostController = navController) } } diff --git a/feature/alarm/src/main/java/team/retum/alarm/navigation/AlarmNavigation.kt b/feature/alarm/src/main/java/team/retum/alarm/navigation/AlarmNavigation.kt index c0cc5241b..94d1ba14c 100644 --- a/feature/alarm/src/main/java/team/retum/alarm/navigation/AlarmNavigation.kt +++ b/feature/alarm/src/main/java/team/retum/alarm/navigation/AlarmNavigation.kt @@ -3,13 +3,13 @@ package team.retum.alarm.navigation import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable -import team.retum.alarm.ui.AlarmScreen +import team.retum.alarm.ui.Alarm const val NAVIGATION_ALARM = "alarm" fun NavGraphBuilder.alarm(onBackPressed: () -> Unit) { - composable(route = NAVIGATION_ALARM) { - AlarmScreen(onBackPressed = onBackPressed) + composable(NAVIGATION_ALARM) { + Alarm(onBackPressed = onBackPressed) } }