architecture-components-samples
architecture-components-samples copied to clipboard
Navigate in all nav graphs when received deep link via intent in NavigationExtensions
When we have multiple graphs in navHostFragment
and we also have opened app with deep link
intent,
there is a bug which is navigating to received deep link in all of our graphs (we want to navigate with deep link in a single graph)
example app:
an activity with bottom navigation view with navigation graph's for each menu item
Here, when we obtain navHostFragment, deep link is being handled in internal code of NavController https://github.com/android/architecture-components-samples/blob/7466ae2015bb9bd9cf2c435a350070b29d71fd2b/NavigationAdvancedSample/app/src/main/java/com/example/android/navigationadvancedsample/NavigationExtensions.kt#L54
So at this point, our deep link caused all our nav graphs to navigate https://github.com/android/architecture-components-samples/blob/7466ae2015bb9bd9cf2c435a350070b29d71fd2b/NavigationAdvancedSample/app/src/main/java/com/example/android/navigationadvancedsample/NavigationExtensions.kt#L138