Page MenuHomePhabricator

Open Wikipedia url in the app
Closed, ResolvedPublic

Description

Patch on Github

It may be useful to open web links to Wikipedia form other apps (mail, facebook, twitter) in Wikipedia application rather than in a web browser. We can implement it with an android intent. I began to write a patch. What do you think about it ?


Version: 1.0.0 (Android)
Severity: enhancement

attachment url.txt ignored as obsolete

Details

Reference
bz32667

Related Objects

StatusSubtypeAssignedTask
ResolvedNone
Resolvedyuvipanda

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:01 AM
bzimport set Reference to bz32667.

If it works, please just put a pull request on Github

Appears to work, though there's a couple things I'd recommend tweaking.

Probably need to escape that URL before passing it into the query string; otherwise we might lose some chars. http://en.wikipedia.org/wiki/AT&T and http://en.wikipedia.org/wiki/%3F both pass through correctly, but I'm just suspicious. :)

Some oddities:

  • Open Wikipedia app
  • switch to another app (say Gmail)
  • follow a Wikipedia link in this app to another page and open it in Wikipedia app

A Wikipedia app screen pops up, loading the article. Neat!

  • now hold down 'home' button and switch to some other randon app
  • hold down 'home' and switch back to Wikipedia

You're seeing the original page you had open before, not the one you followed a link to.

  • hold down 'home' and switch back to that other app (Gmail)

Now we see the Wikipedia view again, in the context of this other app, instead of the rest of the app.

  • hitting 'back' from there can get us back to Gmail/etc

While this feels natural for a single view/back cycle, going to other apps back back it looks very wrong.

I'm also a little unsure about the input processing; if we somehow manage to get a bogus URL in there, does it load inline or does it pop back over to regular browser?

Escape URL : it's done by Android framework when it send it to the app.

The app open only links to Wikipedia (wikipedia.org). If you can't open an other url like google.com in the app (it is android:host="*.wikipedia.org" in the manifest)

For this problem of come back : it's because the link is open in an other instance of the main activity, I don't know how solve it.

sanderd17 wrote:

The problem of come back is intended behaviour of Android. You get the same kind of things with thd default android browser or other apps.

So that doesn't need to be solved.

So is there no way to actually go back to the launched app if we hit home?

The solution is to use the option android:launchMode="singleTask" of the android manifest. Here is a pull request that implement this way : https://github.com/wikimedia/WikipediaMobile/pull/114

There is an implementation here (https://github.com/wikimedia/WikipediaMobile/tree/open-intent) based on work/idaes from Tpt. It follows the Android guidelines and uses standard launch modes. Should be merged in after a bit of discussion