airbnb / DeepLinkDispatch

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

Get the parsed intent from DeeplinkDelegate #217

Open notsatyarth opened 6 years ago

notsatyarth commented 6 years ago

Hi,

Is there a way to get the parsed intent from DeeplinkDelegate? I am interested in getting the intent for a deeplink and then performing different functions. The current deeplink delegate does not seem to be supporting that. I presume this is by design to keep the API simple. But is this a valid usecase?

I guess I could replicate the feature by pulling out the code from DeeplinkDelegate. But I wanted to if this situation was avoided due to some forethought.

ShikherVerma commented 6 years ago

Would make espresso testing simpler.

ShikherVerma commented 6 years ago

It should be an easy addition. Just abstract away the intent creation logic of public DeepLinkResult dispatchFrom(Activity activity, Intent sourceIntent) function in DeepLinkDelegate.

Maybe we could have a public Intent intentFrom(Activity activity, Intent sourceIntent). That returns an intent if uri was successfully parsed or null if some error occured.

The dispatchFrom would then just be a wrapper which launches the return value from intentFrom

Maybe an intentFrom(Activity activity, Uri uri) would look nicer.

notsatyarth commented 6 years ago

Yes. I currently have an implementation which implements the functionality of a DeeplinkDelegate that the library generates to cater to the requirements I have. If the library owners feel it appropriate I'd love to formalize the API a bit more and contribute for the same.

okasurya commented 6 years ago

I think this is a great idea. Also, this could be an alternative for android navigation, especially when you have multiple modules on your project. I have created a simple implementation for this, you can check it here: https://github.com/okasurya/DeepLinkDispatch/commit/f95d0d3c3667510b0ea57c2b97ad83a8e653700e

Gnzlt commented 5 years ago

This would be really useful

ivorsmorenburg commented 4 years ago

Hello guys I been having this issue for the past year hopping it will get into the code, how is this going? how can I help/contribute to make this change happens?