DeepLinkDispatch icon indicating copy to clipboard operation
DeepLinkDispatch copied to clipboard

Will be super to extract "match" logic into own re-usable method/class

Open OleksandrKucherenko opened this issue 9 years ago • 4 comments

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;
}

OleksandrKucherenko avatar Jan 21 '17 15:01 OleksandrKucherenko

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.

OleksandrKucherenko avatar Jan 21 '17 15:01 OleksandrKucherenko

pull request #68 is mostly proposing the same how i see

OleksandrKucherenko avatar Jan 21 '17 15:01 OleksandrKucherenko

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.

felipecsl avatar Jan 21 '17 19:01 felipecsl

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.

OleksandrKucherenko avatar Feb 09 '17 12:02 OleksandrKucherenko