nicolassmith / urlevaluator

URL evaluator for android - lengthens shortened URLs for correct handling in android
https://play.google.com/store/apps/details?id=com.github.nicolassmith.urlevaluator
Other
17 stars 3 forks source link

android:pathPattern for intent filters where url is in the query #33

Open nicolassmith opened 10 years ago

nicolassmith commented 10 years ago

http://developer.android.com/guide/topics/manifest/data-element.html

Some Evaluator classes just grab the url from the query string. It is possible to make the intent filter only match when such a query string exists, instead of just relying on the URL host.

nicolassmith commented 10 years ago

Related, an email from a user about links from the Google Play app:

Hello!

Why do short URLs from Google Play don't work? They always open in browser even if the long link behind a short is a link to Google Play itself. :/

Kind regards


A--- S---

The problem is that every intent to a url from the Google Play app is actually: https://www.google.com/url?q=[url-here]

Which could be handled with the correct pathPattern (or pathPrefix) without trying to handle every link to google.com!

duetosymmetry commented 10 years ago

Yes, this should be possible. Strangely I found that if I did this, I had to make sure that all <data> elements had a path/pathPrefix/pathPattern. Right now we leave off the path element so that all paths match, but I found that when any one element had a path/pathPrefix/pathPattern, then the ones lacking would simply not match.

nicolassmith commented 10 years ago

This is madness!

nicolassmith commented 10 years ago

I can confirm what you found, if one tag has some kind of pathSomething, then they all need one.

Something also weird though, even when using pathPrefix for e.g. www.google.com, it still tries to handle all links to www.google.com.

Started working on it here: 4d6f36fcecdef0de2c318bf9c9eab3f1c4d82f76

duetosymmetry commented 10 years ago

I feel like the "correct" behavior is still to ask the short url service to resolve the url. My argument is that the service may check for spammy sites and refuse to forward to them, something the app can't do on its own.

nicolassmith commented 10 years ago

Right, I guess it wasn't necessary to make a host specific evaluator class.

In any case I couldn't get the intent filter to only catch URLs with the url?q= path prefix. It wants to handle all www.google.com URLs. Something I would like to avoid.