airbnb / DeepLinkDispatch

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

Added support for allowed placeholder values #328

Closed rossbacher closed 2 years ago

rossbacher commented 2 years ago

Added support for allowed placeholder values by adding them viai {placeholder(allowed|value)} into the placeholder.

An URI that would otherwise match, but has a value for the placeholder that is not supported will not match.

This is mainly useful for scheme/host placeholders.

rossbacher commented 2 years ago

Thanks @rossbacher - lgtm.

My only food for thought is if it would be better injected at runtime via DeepLinkDelegate initialization, the same way configurablePathSegments are (the concept is actually pretty similar, right?).

The benefit I see is in an app where the domains are declared in some other location, or dynamically, it may be easier to wire that up from with runtime code vs. needing some system to generate/update the DLD spec.

@BenSchwab I like that with this inline definition they are in the same place. Let me see if it is easy to add that injections via the delegate in addition so one can choose which way of doing it.

For merge sanity reasons I will do that in a different PR though.