From 5ff47189d472a88e0fbbc271f6d3d179b0a0342d Mon Sep 17 00:00:00 2001 From: jeongjaino Date: Tue, 9 Jan 2024 15:14:32 +0900 Subject: [PATCH] =?UTF-8?q?[FEATURE]=20#93=20:=20Management=20-=20Survey?= =?UTF-8?q?=20Navigation=20=EA=B5=AC=ED=98=84=20SurveyForm=20(Registration?= =?UTF-8?q?,=20Edit=20Route)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../navigation/ManagementSurveyNavigation.kt | 53 +++++++++++++++++++ .../navigation/ManagementSurveyNavigation.kt | 24 --------- 2 files changed, 53 insertions(+), 24 deletions(-) create mode 100644 feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/navigation/ManagementSurveyNavigation.kt delete mode 100644 feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/registration/navigation/ManagementSurveyNavigation.kt diff --git a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/navigation/ManagementSurveyNavigation.kt b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/navigation/ManagementSurveyNavigation.kt new file mode 100644 index 00000000..a599e6f4 --- /dev/null +++ b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/navigation/ManagementSurveyNavigation.kt @@ -0,0 +1,53 @@ +package com.wap.wapp.feature.management.survey.navigation + +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavOptions +import androidx.navigation.NavType +import androidx.navigation.compose.composable +import androidx.navigation.navArgument +import androidx.navigation.navOptions +import com.wap.wapp.feature.management.survey.edit.SurveyFormEditScreen +import com.wap.wapp.feature.management.survey.registration.SurveyRegistrationScreen + +fun NavController.navigateToSurveyFormRegistration(navOptions: NavOptions? = navOptions {}) { + this.navigate(ManagementSurveyRoute.surveyFormRegistrationRoute, navOptions) +} + +fun NavController.navigateToSurveyFormEdit( + surveyFormId: String, + navOptions: NavOptions? = navOptions {}, +) { + this.navigate(ManagementSurveyRoute.surveyFormEditRoute(surveyFormId), navOptions) +} + +fun NavGraphBuilder.managementSurveyNavGraph( + navigateToManagement: () -> Unit, +) { + composable(route = ManagementSurveyRoute.surveyFormRegistrationRoute) { + SurveyRegistrationScreen( + navigateToManagement = navigateToManagement, + ) + } + + composable( + route = ManagementSurveyRoute.surveyFormEditRoute("{id}"), + arguments = listOf( + navArgument("id") { + type = NavType.StringType + }, + ), + ) { navBackStackEntry -> + val surveyFormId = navBackStackEntry.arguments?.getString("id") ?: "" + SurveyFormEditScreen( + surveyFormId = surveyFormId, + navigateToManagement = navigateToManagement, + ) + } +} + +object ManagementSurveyRoute { + const val surveyFormRegistrationRoute = "surveyForm/registration" + + fun surveyFormEditRoute(surveyFormId: String) = "surveyForm/edit/$surveyFormId" +} diff --git a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/registration/navigation/ManagementSurveyNavigation.kt b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/registration/navigation/ManagementSurveyNavigation.kt deleted file mode 100644 index af3a193b..00000000 --- a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/registration/navigation/ManagementSurveyNavigation.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.wap.wapp.feature.management.survey.registration.navigation - -import androidx.navigation.NavController -import androidx.navigation.NavGraphBuilder -import androidx.navigation.NavOptions -import androidx.navigation.compose.composable -import androidx.navigation.navOptions -import com.wap.wapp.feature.management.survey.registration.SurveyRegistrationRoute - -const val surveyRegistrationNavigationRoute = "survey_registration_route" - -fun NavController.navigateToSurveyRegistration(navOptions: NavOptions? = navOptions {}) { - this.navigate(surveyRegistrationNavigationRoute, navOptions) -} - -fun NavGraphBuilder.surveyRegistrationScreen( - navigateToManagement: () -> Unit, -) { - composable(route = surveyRegistrationNavigationRoute) { - SurveyRegistrationRoute( - navigateToManagement = navigateToManagement, - ) - } -}