Remove different deeplink destination, add route for nested nav host

Change-Id: Idb9586752d815449243d6d529e9b655c45e395ad
pull/1837/head
Don Turner 1 year ago
parent 299a352aa4
commit cc50d7420a

@ -134,7 +134,8 @@ internal fun InterestsListDetailScreen(
key(nestedNavKey) { key(nestedNavKey) {
NavHost( NavHost(
navController = nestedNavController, navController = nestedNavController,
startDestination = nestedNavHostStartDestination startDestination = nestedNavHostStartDestination,
route = DetailPaneNavHostDestination::class
) { ) {
topicScreen( topicScreen(
showBackButton = !listDetailNavigator.isListPaneVisible(), showBackButton = !listDetailNavigator.isListPaneVisible(),

@ -31,16 +31,13 @@ const val LINKED_NEWS_RESOURCE_ID = "linkedNewsResourceId"
private const val DEEP_LINK_BASE_PATH = "$DEEP_LINK_SCHEME_AND_HOST/$FOR_YOU_PATH" private const val DEEP_LINK_BASE_PATH = "$DEEP_LINK_SCHEME_AND_HOST/$FOR_YOU_PATH"
@Serializable data class ForYouDestination(val linkedNewsResourceId: String? = null) @Serializable data class ForYouDestination(val linkedNewsResourceId: String? = null)
// For deeplinks the news resource ID cannot be null so we use a different type with the same
// argument name to enforce this requirement.
@Serializable data class ForYouDeeplink(val linkedNewsResourceId: String)
fun NavController.navigateToForYou(navOptions: NavOptions) = navigate(route = ForYouDestination(), navOptions) fun NavController.navigateToForYou(navOptions: NavOptions) = navigate(route = ForYouDestination(), navOptions)
fun NavGraphBuilder.forYouScreen(onTopicClick: (String) -> Unit) { fun NavGraphBuilder.forYouScreen(onTopicClick: (String) -> Unit) {
composable<ForYouDestination>( composable<ForYouDestination>(
deepLinks = listOf( deepLinks = listOf(
navDeepLink<ForYouDeeplink>(basePath = DEEP_LINK_BASE_PATH), navDeepLink<ForYouDestination>(basePath = DEEP_LINK_BASE_PATH),
), ),
) { ) {
ForYouRoute(onTopicClick) ForYouRoute(onTopicClick)

Loading…
Cancel
Save