Will be super to extract "match" logic into own re-usable method/class
I found that it will be very useful to have some simple matches in code, like:
public static final String PATTERN = "example://data/{param}/something";
/* pseudo code */
public static boolean isMatch(final String uri){
final DpMatch m = DeepLink.match(PATTERN, uri);
if( m.isSuccess() ){
final String value = m.getValue( "{param}" );
return "expected".equals(value);
}
return false;
}
use case: declare several deeplink PATTERNs and activity and in code do some easy switch/case/if/else by matching the pattern to deeplink. needed something that can do a simple routing, deeplink lib contains all needed classes and parsing code, but its not ready for re-use inside the app.
pull request #68 is mostly proposing the same how i see
I'm not sure we want to expose this API since it's not really part of the goal of this library to expose the URI matching API. I'll keep this open and think about it, but in the meantime you could just copy the relevant classes into your project.
ok, another case to think of:
- my activity contains multiple fragment, and some of the fragments are responsible for processing of the specific deeplinks. How to deliver intent/data/extras to fragments?
Will be great to have code/approach that allows without any custom code forward deeplink to fragments of the activity.