diff --git a/presentation/src/main/java/com/mashup/presentation/feature/home/navigation/HomeNavigation.kt b/presentation/src/main/java/com/mashup/presentation/feature/home/navigation/HomeNavigation.kt new file mode 100644 index 000000000..7a26627f8 --- /dev/null +++ b/presentation/src/main/java/com/mashup/presentation/feature/home/navigation/HomeNavigation.kt @@ -0,0 +1,55 @@ +package com.mashup.presentation.feature.home.navigation + +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavOptions +import androidx.navigation.compose.composable +import androidx.navigation.compose.navigation +import com.mashup.presentation.navigation.KeyLinkNavigationRoute + +/** + * Ssam_D_Android + * @author jaesung + * @created 2023/07/04 + */ +fun NavController.navigateToGuideRoute(navOptions: NavOptions? = null) { + navigate( + route = KeyLinkNavigationRoute.HomeGraph.GuideRoute.route, + navOptions = navOptions + ) +} + +fun NavController.navigateToEditKeywordRoute(navOptions: NavOptions? = null) { + navigate( + route = KeyLinkNavigationRoute.HomeGraph.EditKeywordRoute.route, + navOptions = navOptions + ) +} + +fun NavController.navigateToProfileRoute(navOptions: NavOptions? = null) { + navigate( + route = KeyLinkNavigationRoute.HomeGraph.ProfileRoute.route, + navOptions = navOptions + ) +} + +fun NavGraphBuilder.homeGraph() { + navigation( + route = KeyLinkNavigationRoute.HomeGraph.route, + startDestination = KeyLinkNavigationRoute.HomeGraph.HomeRoute.route + ) { + composable(route = KeyLinkNavigationRoute.HomeGraph.HomeRoute.route) { + // HomeRoute + } + composable(route = KeyLinkNavigationRoute.HomeGraph.GuideRoute.route) { + // GuideRoute + } + composable(route = KeyLinkNavigationRoute.HomeGraph.EditKeywordRoute.route) { + // KeywordRoute + } + composable(route = KeyLinkNavigationRoute.HomeGraph.ProfileRoute.route) { + // ProfileRoute + } + } + +} \ No newline at end of file diff --git a/presentation/src/main/java/com/mashup/presentation/navigation/KeyLinkNavHost.kt b/presentation/src/main/java/com/mashup/presentation/navigation/KeyLinkNavHost.kt new file mode 100644 index 000000000..574650111 --- /dev/null +++ b/presentation/src/main/java/com/mashup/presentation/navigation/KeyLinkNavHost.kt @@ -0,0 +1,29 @@ +package com.mashup.presentation.navigation + +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.navigation.compose.NavHost +import com.mashup.presentation.KeyLinkAppState +import com.mashup.presentation.feature.home.navigation.homeGraph + +/** + * Ssam_D_Android + * @author jaesung + * @created 2023/07/04 + */ +@Composable +fun KeyLinkNavHost( + appState: KeyLinkAppState, + onShowSnackbar: suspend (String, String?) -> Boolean, + startDestination: String, + modifier: Modifier = Modifier +) { + val navController = appState.navController + NavHost( + navController = navController, + startDestination = startDestination, + modifier = modifier + ) { + homeGraph() + } +} \ No newline at end of file diff --git a/presentation/src/main/java/com/mashup/presentation/navigation/KeyLinkNavigationRoute.kt b/presentation/src/main/java/com/mashup/presentation/navigation/KeyLinkNavigationRoute.kt new file mode 100644 index 000000000..b9ae651cd --- /dev/null +++ b/presentation/src/main/java/com/mashup/presentation/navigation/KeyLinkNavigationRoute.kt @@ -0,0 +1,15 @@ +package com.mashup.presentation.navigation + +/** + * Ssam_D_Android + * @author jaesung + * @created 2023/07/04 + */ +sealed class KeyLinkNavigationRoute(val route: String) { + object HomeGraph : KeyLinkNavigationRoute(homeGraphPattern) { + object HomeRoute : KeyLinkNavigationRoute(homeRoute) + object EditKeywordRoute : KeyLinkNavigationRoute(editKeywordRoute) + object GuideRoute : KeyLinkNavigationRoute(guideRoute) + object ProfileRoute : KeyLinkNavigationRoute(profileRoute) + } +} diff --git a/presentation/src/main/java/com/mashup/presentation/navigation/RouteConst.kt b/presentation/src/main/java/com/mashup/presentation/navigation/RouteConst.kt new file mode 100644 index 000000000..717c6181c --- /dev/null +++ b/presentation/src/main/java/com/mashup/presentation/navigation/RouteConst.kt @@ -0,0 +1,13 @@ +package com.mashup.presentation.navigation + +/** + * Ssam_D_Android + * @author jaesung + * @created 2023/07/04 + */ + +const val homeGraphPattern = "home_graph" +const val homeRoute = "home_graph/home" +const val guideRoute = "home_graph/guide" +const val profileRoute = "home_graph/profile" +const val editKeywordRoute = "home_graph/edit_keyword" \ No newline at end of file