airbnb / DeepLinkDispatch

A simple, annotation-based library for making deep link handling better on Android
http://nerds.airbnb.com/deeplinkdispatch/
4.38k stars 406 forks source link

Support for AndroidX Navigation #327

Open RavioliWonton opened 3 years ago

RavioliWonton commented 3 years ago

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?

hashlin commented 3 years ago

@RavioliWonton I run into the same situation a few months ago. Here is the workaround i made.

It's a bit hacky way but works as expected.

rossbacher commented 3 years ago

@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.