Skip to content

Commit

Permalink
[FEATURE] #85 : 설문 확인 모듈 네비게이션 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongjaino committed Jan 13, 2024
1 parent c9834e9 commit aeb5698
Showing 1 changed file with 27 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,47 @@ import androidx.navigation.NavType
import androidx.navigation.compose.composable
import androidx.navigation.navArgument
import androidx.navigation.navOptions
import com.wap.wapp.feature.survey.check.SurveyCheckRoute
import com.wap.wapp.feature.survey.check.SurveyCheckScreen
import com.wap.wapp.feature.survey.check.detail.SurveyDetailRoute

const val SURVEY_CHECK_ROUTE = "survey/check/{surveyId}"

fun NavController.navigateToSurveyCheck(
fun NavController.navigateToSurveyDetail(
surveyId: String,
navOptions: NavOptions? = navOptions {},
) {
this.navigate("survey/check/$surveyId", navOptions)
this.navigate(SurveyCheckRoute.surveyDetailRoute(surveyId), navOptions)
}

fun NavController.navigateToSurveyCheck(navOptions: NavOptions? = navOptions {}) {
this.navigate(SurveyCheckRoute.surveyCheckRoute, navOptions)
}

fun NavGraphBuilder.surveyCheckScreen(
navigateToManagement: () -> Unit,
fun NavGraphBuilder.surveyCheckNavGraph(
navigateToSurveyDetail: (String) -> Unit,
navigateToSurveyCheck: () -> Unit,
) {
composable(route = SurveyCheckRoute.surveyCheckRoute) {
SurveyCheckScreen(
navigateToSurveyDetail = navigateToSurveyDetail,
)
}

composable(
route = SURVEY_CHECK_ROUTE,
route = SurveyCheckRoute.surveyDetailRoute("{id}"),
arguments = listOf(
navArgument("surveyId") {
navArgument("id") {
type = NavType.StringType
},
),
) { navBackStackEntry ->
val surveyId = navBackStackEntry.arguments?.getString("surveyId") ?: ""
SurveyCheckRoute(
navigateToManagement = navigateToManagement,
val surveyId = navBackStackEntry.arguments?.getString("id") ?: ""
SurveyDetailRoute(
navigateToSurveyCheck = navigateToSurveyCheck,
surveyId = surveyId,
)
}
}

object SurveyCheckRoute {
const val surveyCheckRoute = "survey/check"
fun surveyDetailRoute(surveyId: String) = "survey/detail/$surveyId"
}

0 comments on commit aeb5698

Please sign in to comment.