DeepLinkDispatch
DeepLinkDispatch copied to clipboard
Support for AndroidX Navigation
This library is a marvelous solution for avoiding writing boilerplate code to handle DeepLink (and also thanks you great work), but I wonder do you have plan to support AndroidX Navigation library to directly support deeplinking into a Fragment or a Dialog? Nowadays DeepLinkDispatch only support navigate to Activity or launch destination defined by Intent, which is not compatible with the way Navigation library used to process DeepLink.
More specifically, AndroidX Navigation support deeplink navigation by two methods: explicitly create an PendingIntent and call send() method, or implicitly generate support code from navigation xml file. Since this library could only directly routing to Activity by annotation or indirectly launching a user-defined Intent, these two methods cannot work with DeepLinkDispatch, therefore we could only handle links in Activity holding NavHost, and manually send arguments to navController to the final destination Fragment or Dialog.
Could it be some way to deal with this situation?
@RavioliWonton I run into the same situation a few months ago. Here is the workaround i made.
- Add a custom wrapper over
DeepLinkDelegate
class - Return an
Intent()
without target component at deeplink function - Attach Navigation action together with
Intent
as extra - Check and route to Navigation action inside custom wrapper
It's a bit hacky way but works as expected.
@RavioliWonton did you take a look at the work we are currently doing with adding the concept of DeepLinkHandlers? I think this could work if you just write an AndroidX Navigation DeepLinkHandler. Take a look and I'm open for submissions.