← Back to team overview

ubuntu-phone team mailing list archive

Re: Fwd: Wikipedia App

 

Hi Matti, I had this same problem with my Arstechnica webapp - Oliver Grawert pointed me to some code to fix this, which I believe is now integrated with the latest revision (15) of his webapp container. Have you tried this revision? Otherwise, let me know and I'll see what I can find. (you can also look at the main.qml file in my Arstechnica webapp - it's working now as you described.)

Mitchell

On 02/05/15 02:37, matti rinta-nikkola wrote:
Hello Oliver, thanks for the wonderful alternate-webapp-container! I think I have found a bug in its argument handling. With a following config.js:
    var webappName = "wikipedia.mattirn"
    var webappUrl = "http://wikipedia.org/";
var webappUrlPattern = "https?://*.wikipedia.org/* <http://wikipedia.org/*>"

URL arguments with wikipedia language part like http://_en_.wikipedia.org/ <http://wikipedia.org/> were ignored. I have fixed this in my app by changing the test (in Component.onCompleted) from

    if (Qt.application.arguments[1].toString().indexOf(myUrl) > -1) {

to
     if (Qt.application.arguments[2] != undefined) {


Mitchell, now url-dispatcher works... more or less. Now the problem I found is the following. If wikipedia app is already launched when you click wikipedia link in the scope the new page will not be loaded only the focus will be changed to the wikipedia app. I have not yet investigated further... maybe you already know the solution ;).

Matti



---------- Forwarded message ----------
From: *matti rinta-nikkola* <matti.rintanikkola@xxxxxxxxx <mailto:matti.rintanikkola@xxxxxxxxx>>
Date: 2015-05-01 17:30 GMT+02:00
Subject: Re: Wikipedia App
To: Mitchell Reese <dev@xxxxxxxxxxxxxxxxxxxxx <mailto:dev@xxxxxxxxxxxxxxxxxxxxx>>


Hi Mitchell, I have not succeed in setting up url-dispacher to wikipedia app. I think there is a bug somewhere in parameter parsing procedures in Ogra's container. Anyway I have added to my manifest.json a url-dispatcher hook:

"hooks": {
        "wikipedia": {
        "apparmor": "app.json",
        "desktop": "app.desktop",
*"urls": "app.url-dispatcher"*
    }

and my app.url-dispatcher file look like:

[
    {
        "protocol": "http",
        "domain-suffix": "wikipedia.org <http://wikipedia.org>"
    }
]

When I click a wikipedia link in the NearBy scope the wikipedia app is launched but it opens its home page instead of the link clicked. Its like the app is launched without parameter. I have copied some logs from my phone as well as from my PC when launching wikipedia app with qmlscene. My conclusion is that when there is a language part (en, it , fi, ... ) in wikipedia URL app will ignore parameter completely :(. I will try to figure out if I can resolve the problem by myself...

Regards,

Matti


*Logs from phone:*
phablet@ubuntu-phablet:~/.cache/upstart$ *cat unity8-dash.log*
Trying to open "_http://it.wikipedia.org/wiki/Serie_A1_FIAF_1988_";
UbuntuWindow::handleSurfaceFocusChange(focused=false)

----------------------------
n_wikipedia_0.2.loglet:~/.cache/upstart$ *more application-click-wikipedia.mattir * libust[20412/20415]: Error: Error opening shm /lttng-ust-wait-5-32011 (in get_wa
it_shm() at lttng-ust-comm.c:886)
libust[20412/20415]: Error: Error opening shm /lttng-ust-wait-5-32011 (in get_wa
it_shm() at lttng-ust-comm.c:886)
libust[20412/20414]: Error: Error opening shm /lttng-ust-wait-5 (in get_wait_shm
() at lttng-ust-comm.c:886)
libust[20412/20433]: Error: Error opening shm /lttng-ust-wait-5 (in get_wait_shm
() at lttng-ust-comm.c:886)
libust[20412/20433]: Error: Error opening shm /lttng-ust-wait-5 (in get_wait_shm
() at lttng-ust-comm.c:886)
libust[20412/20434]: Error: Error opening shm /lttng-ust-wait-5-32011 (in get_wa
it_shm() at lttng-ust-comm.c:886)
libust[20412/20434]: Error: Error opening shm /lttng-ust-wait-5-32011 (in get_wa
it_shm() at lttng-ust-comm.c:886)
shm_open() failed: Permission denied
url is: https://en.m.wikipedia.org/wiki/Main_Page
Loaded 5 UA override(s) from file:///usr/lib/arm-linux-gnueabihf/qt5/qml/Ubuntu/
Web/ua-overrides-mobile.js
UbuntuWindow - regular geometry
Cannot set WebContext.hostMapRules once the context is in use
UserScript url is a construct-only parameter
UserScript url is a construct-only parameter
UserScript url is a construct-only parameter

=====================================
*
Logs from PC:*
-PC:~/wrk/ubuntu-sdk/wikipedia$ *qmlscene http://wikipedia.org/ ./qml/Main.qml *
qml: got argument: http://wikipedia.org/
qml: url is: http://wikipedia.org/
qml: Loaded 2 UA override(s) from file:///usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/Web/ua-overrides-desktop.js
UserScript url is a construct-only parameter
UserScript url is a construct-only parameter

-PC:~/wrk/ubuntu-sdk/wikipedia$ *qmlscene http://wikipedia.org/wiki/The_Tower_House ./qml/Main.qml *
qml: got argument: http://wikipedia.org/wiki/The_Tower_House
qml: url is: http://wikipedia.org/wiki/The_Tower_House
qml: Loaded 2 UA override(s) from file:///usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/Web/ua-overrides-desktop.js
UserScript url is a construct-only parameter

-PC:~/wrk/ubuntu-sdk/wikipedia$ *qmlscene http://en.wikipedia.org/wiki/The_Tower_House ./qml/Main.qml *
qml: url is: http://en.m.wikipedia.org/wiki/Main_Page
qml: Loaded 2 UA override(s) from file:///usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/Web/ua-overrides-desktop.js
UserScript url is a construct-only parameter
UserScript url is a construct-only parameter
**
PC:~/wrk/ubuntu-sdk/wikipedia$ *qmlscene http://it.wikipedia.org/wiki/Serie_A1_FIAF_1988 ./qml/Main.qml *
qml: url is: http://en.m.wikipedia.org/wiki/Main_Page
qml: Loaded 2 UA override(s) from file:///usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/Web/ua-overrides-desktop.js
UserScript url is a construct-only parameter
UserScript url is a construct-only parameter


2015-05-01 14:13 GMT+02:00 Mitchell Reese <dev@xxxxxxxxxxxxxxxxxxxxx <mailto:dev@xxxxxxxxxxxxxxxxxxxxx>>:

    Hey Matti, just installed your wikipedia app - thanks for making
    it! Was about to make one myself using Ogra's container when I saw
    yours - thanks for saving me the trouble! Are you able to update
    it to use the url-dispatcher? That means links in the wikipedia
    scope (and elsewhere in the system) will open your webapp. Happy
    to send you the code if you like - its really easy. You need to
    edit your apparmour file, and point it to a specific json file
    with the right info.

    Thanks again, and keep up the great work!

    Mitchell

-- Sent using Dekko from my Ubuntu device