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

Adding more hosts to MultipleRedirect #34

Open nicolassmith opened 10 years ago

nicolassmith commented 10 years ago

Now that the multiple redirect class is fairly robust I was thinking of making t.co use it due to the fact that those are often multiple redirects.

Alternatively we could make the multiple redirect class be the default one. Thoughts?

duetosymmetry commented 10 years ago

Absolutely agree about t.co.

More generally, is there any harm in using the multiple redirect as default?

nicolassmith commented 10 years ago

A potential problem I could think of is imagine you have the following redirect chain:

LinkA -> LinkB -> LinkC

and imagine that the intent filter for urlevaluator allows LinkA and LinkB. And a filter for app B allows linkB, and another app C for linkC.

In some potential case, user wants app B to handle links like link B. But urlevaluator will swallow the chain until it gets to LinkC.

It's pretty out there but potentially not what we want. I wonder if we can check if urlevaluator is the default app chosen by the user for a given intent filter. But this makes the user do a lot more clicking if defaults aren't chosen yet.

duetosymmetry commented 10 years ago

There is a way in PackageManager to determine if a default app has been chosen. You can determine from [GetPreferredActivities](http://developer.android.com/reference/android/content/pm/PackageManager.html#getPreferredActivities%28java.util.List, java.util.List, java.lang.String%29) if any given activity is the default for some intent. Here's an example on stackoverflow.

duetosymmetry commented 10 years ago

Re: Making the user click a lot more, this can be a flag in the settings. Then urlevaluator would need another activity for the settings!

nicolassmith commented 10 years ago

It is not exactly clear how getPreferredActivities is supposed to work. The documentation suggests that the first argument should be an empty list that is populated by the method, but in the Stack Overflow example, it has been populated before being sent to the method. I can make a guess about what the behavior is, based on the SO example, but it certainly isn't reflected in the documentation!

Another possibility is using resolveActivity which will return the default activity if there is one, if a default is not set, it returns the "activity resolver," which I think refers to the actual activity that makes the activity chooser menu.

nicolassmith commented 10 years ago

Looking at the android source code. It looks like there is no benefit to populating the filter list when using this method, it is not used other than a container for returning things from the method.