Merge lp:~vthompson/ubuntu-weather-app/reboot-location-qml into lp:ubuntu-weather-app

Proposed by Victor Thompson
Status: Merged
Approved by: Victor Thompson
Approved revision: 46
Merged at revision: 44
Proposed branch: lp:~vthompson/ubuntu-weather-app/reboot-location-qml
Merge into: lp:ubuntu-weather-app
Diff against target: 110 lines (+73/-1)
4 files modified
app/components/CurrentLocation.qml (+62/-0)
app/ubuntu-weather-app.qml (+4/-0)
app/ui/LocationsPage.qml (+4/-0)
ubuntu-weather-app.apparmor (+3/-1)
To merge this branch: bzr merge lp:~vthompson/ubuntu-weather-app/reboot-location-qml
Reviewer Review Type Date Requested Status
Martin Borho Approve
Andrew Hayzen Approve
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+259462@code.launchpad.net

Commit message

* Implement QtLocation reverse geocoding
* Use Open Street Map plugin
* Update apparmor

Description of the change

* Implement QtLocation reverse geocoding
* Use Open Street Map plugin
* Update apparmor

This simply displays the reverse geocoded city name in the LocationsPage at the first item. This uses the QtLocations QML API for Location models and utilizes the OSM plugin for reverse geocoding. The Nokia HERE plugin did not appear to support reverse geocoding and also required an API key. It may take a bit for the "Undefined" text to change to your current GPS location.

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
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Can you explain what I should see with this branch?
Is it supposed to show when Locations page is empty?
http://people.canonical.com/~alan/screenshots/device-2015-05-19-101516.png

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

It should always add an item in that view. Are you on RTM? If so, maybe
there's something missing in that image. You should get prompted to share
your location. Could you attach your weather app log?
On May 19, 2015 4:15 AM, "Alan Pope ξƒΏ" <email address hidden> wrote:

> Can you explain what I should see with this branch?
> Is it supposed to show when Locations page is empty?
> http://people.canonical.com/~alan/screenshots/device-2015-05-19-101516.png
>
> --
>
> https://code.launchpad.net/~vthompson/ubuntu-weather-app/reboot-location-qml/+merge/259462
> You are the owner of lp:~vthompson/ubuntu-weather-app/reboot-location-qml.
>

Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Just tested on my devel proposed phone which appears to be wily now..

phablet@ubuntu-phablet:~$ system-image-cli --info
current build number: 218
device name: krillin
channel: ubuntu-touch/devel-proposed/ubuntu
last update: 2015-05-19 08:35:36
version version: 218
version ubuntu: 20150519
version device: 20150511-3912934
version custom: 20150519
phablet@ubuntu-phablet:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu Wily Werewolf (development branch)
Release: 15.10
Codename: wily

I get a blank screen if I remove the last city, and the main screen shows a bouncer at the bottom with nothing else going on.
http://paste.ubuntu.com/11224712/ is the log

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

@popey, this is similar to what you should see initially [1], then once you get a lock on your location you should see something like this [2].

If you remove the only real city in the list, then yes, right now you get the bouncer on the main screen--we still need empty states for this condition.

1 - http://i.imgur.com/zX4vZBs.png
2 - http://i.imgur.com/Sw9OZ8s.png

45. By Victor Thompson

Minimize update of current location.

46. By Victor Thompson

Add TODO note

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
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Ok, that makes more sense, and works as expected.

review: Approve
Revision history for this message
Andrew Hayzen (ahayzen) wrote :

After ensuring that the location service is actually working by using google/here maps. I was able to start weather, accept the location detection and it instantly added it to the top of the list :-)

However it always displays 0Β°C for the location and it hasn't actually added the location to the home page so this causes issues such as trying to remove the last location as the indexes are out of sync. Or is this what your TODO message is saying will be in a future mp?

Also maybe "undefined" is not the best word to use that could appear in the UI and this string should be translatable.

review: Needs Information
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Agreed on the name. "Detecting location" (or something shorter / snappier) might be more prudent. Perhaps just "Current location" which then switches to the real location name when discovered?

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

The intent of this MP is just to add location detection. We'll need more work for managing the current location. I also don't think we'll want to show "Undefined", but this MP does so because without explicitly managing the location that is being detected _something_ needs to be in the model. We could hide it in the future if it's invalid/undefined or add some different text. Right now this just displays the discovered location. This MP doesn't add enough of the discovered data to allow for the Weather API calls to work. So you'll always see 0 degrees. We'll need to determine the minimal set of data (and where it exists) in the GeocodeModel to add it to the weather locations model properly.

Revision history for this message
Andrew Hayzen (ahayzen) wrote :

OK well, I think this is clear to land then and the issues stated will be fixed in upcoming mps :-)

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

Adding Martin as a reviewer. I'd like to make sure he agrees with proceeding using the existing APIs for reverse geocoding, before we go to far into making additional changes.

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

lgtm!

To get it work with the data backend, the current-location-object should follow the format like "location" in http://bazaar.launchpad.net/~ubuntu-weather-dev/ubuntu-weather-app/trunk/view/head:/tests/autopilot/ubuntu_weather_app/files/1.json#L2

Important is here "location.coord" and "location.timezone". I don't know if the timezone is available by reverse geocoding. If not, a "searchByPoint" with lat/long is needed beforehand. (Timezone is needed to calculate the proper local time of the location)

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

It doesn't look like Timezone is available from the data available by reverse geocoding. I think we'll still need to use GeoNames (as we do for the other locations) to get this info.

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

Top approving so work on Location management can proceed.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'app/components/CurrentLocation.qml'
2--- app/components/CurrentLocation.qml 1970-01-01 00:00:00 +0000
3+++ app/components/CurrentLocation.qml 2015-05-20 00:09:00 +0000
4@@ -0,0 +1,62 @@
5+/*
6+ * Copyright (C) 2015 Canonical Ltd
7+ *
8+ * This file is part of Ubuntu Weather App
9+ *
10+ * Ubuntu Weather App is free software: you can redistribute it and/or modify
11+ * it under the terms of the GNU General Public License version 3 as
12+ * published by the Free Software Foundation.
13+ *
14+ * Ubuntu Weather App is distributed in the hope that it will be useful,
15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+ * GNU General Public License for more details.
18+ *
19+ * You should have received a copy of the GNU General Public License
20+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21+ */
22+
23+import QtLocation 5.3
24+import QtPositioning 5.2
25+import QtQuick 2.3
26+import Ubuntu.Components 1.1
27+
28+
29+Item {
30+ id: currentLocation
31+
32+ property string string: "Undefined"
33+
34+ PositionSource {
35+ id: currentPosition
36+ updateInterval: 1000
37+ active: true
38+
39+ onPositionChanged: {
40+ var coord = currentPosition.position.coordinate
41+ if (coord.isValid) {
42+ geocodeModel.query = coord
43+ geocodeModel.update()
44+ }
45+ }
46+ }
47+
48+ Plugin {
49+ id: osmPlugin
50+ name: "osm"
51+ }
52+
53+ GeocodeModel {
54+ id: geocodeModel
55+ autoUpdate: false
56+ plugin: osmPlugin
57+
58+ onCountChanged: {
59+ // Update the currentLocation if one is found and it does not match the stored location
60+ if (count > 0 && currentLocation.string !== geocodeModel.get(0).address.city) {
61+ currentLocation.string = geocodeModel.get(0).address.city
62+ refreshData(false, true)
63+ }
64+ }
65+ }
66+}
67
68=== modified file 'app/ubuntu-weather-app.qml'
69--- app/ubuntu-weather-app.qml 2015-05-08 19:44:49 +0000
70+++ app/ubuntu-weather-app.qml 2015-05-20 00:09:00 +0000
71@@ -129,6 +129,10 @@
72 }
73 }
74
75+ CurrentLocation {
76+ id: currentLocation
77+ }
78+
79 Settings {
80 id: settings
81 category: "weatherSettings"
82
83=== modified file 'app/ui/LocationsPage.qml'
84--- app/ui/LocationsPage.qml 2015-04-09 22:22:55 +0000
85+++ app/ui/LocationsPage.qml 2015-05-20 00:09:00 +0000
86@@ -138,6 +138,10 @@
87 locationsModel.clear()
88 var loc = {}, data = {},
89 tempUnits = settings.tempScale === "Β°C" ? "metric" : "imperial";
90+
91+ // TODO: Manage the current location as an entry in the locationsList.
92+ locationsModel.append({ "name": currentLocation.string, "temp": "0", "icon": "weather-clear-symbolic" })
93+
94 for (var i=0; i < weatherApp.locationsList.length; i++) {
95 data = weatherApp.locationsList[i];
96 loc = {
97
98=== modified file 'ubuntu-weather-app.apparmor'
99--- ubuntu-weather-app.apparmor 2015-01-23 23:26:58 +0000
100+++ ubuntu-weather-app.apparmor 2015-05-20 00:09:00 +0000
101@@ -1,6 +1,8 @@
102 {
103 "policy_groups": [
104- "networking"
105+ "location",
106+ "networking",
107+ "sensors"
108 ],
109 "policy_version": 1.2
110 }

Subscribers

People subscribed via source and target branches

to all changes: