Merge lp:~vthompson/ubuntu-weather-app/reboot-get-initial-data-from-storage into lp:ubuntu-weather-app

Proposed by Victor Thompson
Status: Merged
Merge reported by: Victor Thompson
Merged at revision: not available
Proposed branch: lp:~vthompson/ubuntu-weather-app/reboot-get-initial-data-from-storage
Merge into: lp:ubuntu-weather-app
Diff against target: 19 lines (+7/-1)
1 file modified
app/ubuntu-weather-app.qml (+7/-1)
To merge this branch: bzr merge lp:~vthompson/ubuntu-weather-app/reboot-get-initial-data-from-storage
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Ubuntu Weather Developers Pending
Review via email: mp+252962@code.launchpad.net

Commit message

Get initial data from storage to not block the UI thread.

Description of the change

Nik had noticed that the app is blank when it is started. I'm 99% sure that is due to the initial refresh blocking the UI. I had the same issue with both OWM and TWC today. Ideally this should be done in a workerscript, but the solution here is a good temporary workaround.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Martin Borho (martin-borho) wrote :

The requests to the API where originally in a WorkerScript, but a former Qt upgrade (5.2?!) broke it terribly. So I've removed it. Don't know if would work again now in a WorkerScript, some time gone by since then. Should be easy to reimplement again, the revision it was changed: http://bazaar.launchpad.net/~ubuntu-weather-dev/ubuntu-weather-app/trunk/revision/219

For me the problem is, that JSON in Qt was always riddled with nasty bugs...

Revision history for this message
Martin Borho (martin-borho) wrote :

I've readded the worker, seems to work again

https://code.launchpad.net/~martin-borho/ubuntu-weather-app/reboot-worker

Try out, if this would work out for us?

Revision history for this message
Victor Thompson (vthompson) wrote :

It doesn't seem to unblock the UI. I still get a blank screen with no settings icon. OWM still seems to be down, so you can test against that if you want. Here's an example URL:

http://api.openweathermap.org/data/2.5/forecast/daily?id=5037649&cnt=10&units=metric

I wonder if in the future we should try to use a different data provider if one is down?

21. By Victor Thompson

revamp solution

Revision history for this message
Victor Thompson (vthompson) wrote :

I've got a better idea for this MP. How about we initialize with stored data, and then do a force refresh? I made an update to do this.

22. By Victor Thompson

update

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Victor Thompson (vthompson) wrote :

Ok, one last thought on this. I tried your MP with the solution below and it works well. Could you propose your reboot-worker mp with the following change?

12 - Component.onCompleted: refreshData();
13 + Component.onCompleted: {
14 + storage.getLocations(fillPages);
15 + refreshData();
16 + }

I think always starting with stored data and then spinning off the request in a worker is probably the best solution for now. What do you think?

Revision history for this message
Martin Borho (martin-borho) wrote :

Perfect! :)

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/ubuntu-weather-app.qml'
2--- app/ubuntu-weather-app.qml 2015-03-08 17:23:58 +0000
3+++ app/ubuntu-weather-app.qml 2015-03-14 15:01:50 +0000
4@@ -56,8 +56,14 @@
5
6 /*
7 (re)load the pages on completion
8+ TODO: Currently this is done from storage because the request blocks the
9+ UI. Ideally the request to the APIs should be done via a
10+ WorkerScript
11 */
12- Component.onCompleted: refreshData();
13+ Component.onCompleted: {
14+ storage.getLocations(fillPages);
15+ refreshData();
16+ }
17
18 /*
19 Handle response data from data backend. Checks if a location

Subscribers

People subscribed via source and target branches

to all changes: