Tomáš Procházka
05/01/2025, 8:13 PMandroidx.navigation.compose.NavHost . There is also no way how to directly open target destination from deeplink without opening startDestination . So it is basically the same problem. Why there is no way to put deepLinkUri as initial destination for NavHost 😞. Even navController.findDestination() can't accept deep link 😞Ian Lake
05/01/2025, 9:21 PMTomáš Procházka
05/01/2025, 9:41 PMTomáš Procházka
05/01/2025, 10:29 PMIan Lake
05/01/2025, 11:55 PMonGraphCreated is what is called once the graph is set (via the NavHost) and any state is restored. If there wasn't any state to restore, it checks whether it needs to handle a deep link and otherwise goes to the start destination: https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:navigati[…]otlin/androidx/navigation/internal/NavControllerImpl.kt;l=971Ian Lake
05/01/2025, 11:55 PMcheckDeepLinkHandled on Android calls handleDeepLink with the Activity's intent: https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:navigati[…]ain/kotlin/androidx/navigation/NavController.android.kt;l=481Ian Lake
05/01/2025, 11:58 PMTomáš Procházka
05/02/2025, 10:23 AMTomáš Procházka
05/02/2025, 1:00 PMval deepLinkIntent = requireArguments().getParcelable(
NavController.KEY_DEEP_LINK_INTENT,
Intent::class.java
)
inside of the fragment.
So I can do two thing
1. quite and dirty, just call this before NavHost and restore it after
(LocalContext.current as Activity).intent = deepLinkUri
2) override NavController and override handleDeepLink() and use own intent instead of the actiity one.Tomáš Procházka
05/19/2025, 10:20 PMNavController is open and handleDeepLink() also, so it looks that create a custom controller is easy, but oficial rememberNavController using also
navigatorProvider.addNavigator(ComposeNavGraphNavigator(navigatorProvider))
where ComposeNavGraphNavigator is for some reason internal, which block any possible custom NavController