Merge lp:~gary-wzl77/ubuntu-weather-app/fix_1518888 into lp:ubuntu-weather-app

Proposed by Gary.Wang
Status: Merged
Approved by: Andrew Hayzen
Approved revision: 222
Merged at revision: 251
Proposed branch: lp:~gary-wzl77/ubuntu-weather-app/fix_1518888
Merge into: lp:ubuntu-weather-app
Diff against target: 470 lines (+210/-34)
13 files modified
AUTHORS (+2/-0)
CMakeLists.txt (+5/-1)
app/components/CurrentLocation.qml (+5/-22)
app/components/HomeHourly.qml (+1/-1)
app/data/WeatherApi.js (+2/-1)
app/data/keys.js (+1/-1)
app/ubuntu-weather-app.qml (+170/-4)
app/ui/HomePage.qml (+3/-0)
app/ui/LocationPane.qml (+3/-1)
debian/changelog (+3/-0)
manifest.json.in (+2/-1)
po/com.ubuntu.weather.pot (+8/-2)
ubuntu-weather-app.url-dispatcher (+5/-0)
To merge this branch: bzr merge lp:~gary-wzl77/ubuntu-weather-app/fix_1518888
Reviewer Review Type Date Requested Status
Andrew Hayzen Approve
Jenkins Bot continuous-integration Approve
Victor Thompson Pending
Review via email: mp+281719@code.launchpad.net

Commit message

1.Add url-dispatcher to enable user to navigate weather app from weather scope
2.Add argument(display) to show hourly view when its value is "hourly" on startup

Description of the change

1.Add url-dispatcher to enable user to navigate weather app from weather scope.
2.Add argument(display) to show hourly view when its value is "hourly" on startup.

To post a comment you must log in.
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
194. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

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

Thanks for starting this :-)

I've found a few issues while looking at the code:
1) You are using Arguments not Connections { target: UriHandler; onOpened: { ... } } which means that the UrlHandler only works when the app is first started, not if the application was already running. Please refer to the docs [0] or music app [1] for how this works.
2) The idea is that this will be run from the scope, however you can search for any location in the scope and you can have any set of locations loaded in the weather app. So I could be on London in the scope, then click to open the weather-app and the weather-app could be at Berlin, this would not be very useful.

I suggest that you provide the latitude and longitude into the UriHandler so use something such as weather://latitiude/longitude/days for example for London hourly this could be weather://51.50853/0.12574/1 or for a 5 day forecast you could then use weather://51.50853/0.12574/5

The weather could the detect if the location exists and switch to the relevant page, or if it doesn't show a temporary view that allows them to view the info, but also save that as a location in their list.

It's probably best that a mail thread is started between the weather app devs, if we want to discuss the protocol design further.

Furthermore could you add yourself to the AUTHORS file and add an entry into the debian/changelog (use the tool $ dch ).

0 - https://developer.ubuntu.com/api/apps/qml/sdk-15.04.1/Ubuntu.Components.UriHandler/
1 - http://bazaar.launchpad.net/~music-app-dev/music-app/trunk/view/head:/app/components/Helpers/UriHandlerHelper.qml#L29

review: Needs Fixing
Revision history for this message
Gary.Wang (gary-wzl77) wrote :
Download full text (3.6 KiB)

Thanks for your reply.

1) You are using Arguments not Connections { target: UriHandler; onOpened:
{ ... } } which means that the UrlHandler only works when the app is first
started, not if the application was already running. Please refer to the
docs [0] or music app [1] for how this works.
A: Good suggestion, will fix in next MR update.

2) The idea is that this will be run from the scope, however you can search
for any location in the scope and you can have any set of locations loaded
in the weather app. So I could be on London in the scope, then click to
open the weather-app and the weather-app could be at Berlin, this would not
be very useful.
A: That's also an idea from David who reviews weather scope. will fix in
weather scope at first.

I suggest that you provide the latitude and longitude into the UriHandler
so use something such as weather://latitude/longitude/days for example for
London hourly this could be weather://51.50853/0.12574/1 or for a 5 day
forecast you could then use weather://51.50853/0.12574/5
A: weather://51.50853/0.12574/5 format is not that reasonable. I prefer
to keep current implementation(url parameters) by appending geo
information. E.g.
weather://?display=hourly&city=London&lat=51.50853&lng=-0.12574
weather://?display=default&city=London&lat=51.50853&lng=-0.12574

The weather could the detect if the location exists and switch to the
relevant page, or if it doesn't show a temporary view that allows them to
view the info, but also save that as a location in their list.
A: That's my general idea for this as well. if location exists, switch to
the relevant page. if not, searching location info based on lat&lng at
firstly, and switch to the regarding page then.

Thanks. Will update the MR later on.

On Wed, Jan 6, 2016 at 8:40 PM, Andrew Hayzen <email address hidden> wrote:

> Review: Needs Fixing
>
> Thanks for starting this :-)
>
> I've found a few issues while looking at the code:
> 1) You are using Arguments not Connections { target: UriHandler; onOpened:
> { ... } } which means that the UrlHandler only works when the app is first
> started, not if the application was already running. Please refer to the
> docs [0] or music app [1] for how this works.
> 2) The idea is that this will be run from the scope, however you can
> search for any location in the scope and you can have any set of locations
> loaded in the weather app. So I could be on London in the scope, then click
> to open the weather-app and the weather-app could be at Berlin, this would
> not be very useful.
>
> I suggest that you provide the latitude and longitude into the UriHandler
> so use something such as weather://latitiude/longitude/days for example for
> London hourly this could be weather://51.50853/0.12574/1 or for a 5 day
> forecast you could then use weather://51.50853/0.12574/5
>
> The weather could the detect if the location exists and switch to the
> relevant page, or if it doesn't show a temporary view that allows them to
> view the info, but also save that as a location in their list.
>
> It's probably best that a mail thread is started between the weather app
> devs, if we want to discuss the protocol design further.
>
>
> Furtherm...

Read more...

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Gary.Wang (gary-wzl77) wrote :

Hi Andrew
1. Does the missing API key cause test run failed?
2. Is there any access limits for following API, at times I didn't get respond from it for a long time
http://api.geonames.org/findNearbyPlaceNameJSON?style=full&username=uweatherdev&lat=51.5047&lng=-0.1283&maxRows=25&featureClass=P

Thanks.

195. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

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

1) Yup, you will require the API keys to OWM/TWC to run the tests, please message me privately if you require them
2) geonames does have a limit and there is a bug 1326918 to migrate to the ubuntu one.

196. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

197. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

198. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

199. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

200. By Andrew Hayzen

* Use sidestage so that tablets don't go into portrait mode.

Approved by Jenkins Bot, Alan Pope .

201. By Victor Thompson

* Change translatable string from "rain" to "precipitation". Fixes: https://bugs.launchpad.net/bugs/1521701.

Approved by Jenkins Bot, Bartosz Kosiorek.

202. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

203. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

204. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

205. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

206. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

207. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

208. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

209. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

210. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

211. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

212. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

213. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

214. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

215. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

216. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

217. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

218. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

219. By Launchpad Translations on behalf of ubuntu-weather-dev

Launchpad automatic translations update.

220. By Gary.Wang

Add url-dispatcher to support for app launching from weather scope

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Andrew Hayzen (ahayzen) wrote :

This looks to be progressing well, is there a silo or debs for the scope so that we can test this? Or are you manually running a the URI-handler from a command? If so do you mind sharing to assist in the testing of the branch?

review: Needs Information
221. By Gary.Wang

merge from trunk.

Revision history for this message
Gary.Wang (gary-wzl77) wrote :

Hi Andrew
   Sorry for the late response,
   I've been cleaning up the bugs on my hand, The following link you can find a armhf-based test scope, which allows you to open weather app from the scope and check the current temperature for three different locations.
   London(belvedere)
   Berlin(mitte)
   Roma(trevi)

   https://drive.google.com/open?id=0B2H9ECPSSfqIc2xybjlxc0F4SGc
   Please playing around it and verify it on the device.

   Thanks.
   Sorry again for the delay.

P.S due to the API count limitation, sometimes main view didn't navigate to specific location page as we didn't get current temperature information.

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrew Hayzen (ahayzen) wrote :

I've installed the scope and this branch on my device.

I've noticed a few functional issues to discuss first:
1) When I open via the scope, it causes all of the views (swiping across) to change to have the hourly view already shown, is this a design decision or an issue? (I wasn't expecting *all* the locations to change to hourly view, maybe only the location I had clicked in the scope)
2) I know you said there were API limitations, but I have not yet been able to select one of the locations in the scopes and then receive the respective location in the app. It always jumps to my 2nd non-location detected location.

Could you describe the expected scenarios here? For example
- if you click on a location and you already have the location, I assume it would jump to it?
- if you click on a location and you don't already have the location, I assume it will add a section - but will this be temporary? or remain in the saved list?

Also are you expecting this to work with both OpenWeatherMap and TheWeatherChannel.

If you want to discuss any of these issues with me, feel free to ping me (ahayzen) on IRC. I'm around in London daytime.

review: Needs Fixing
222. By Gary.Wang

refresh data even if location exists, which allows to show respective location's weather info if it can be found in db.

Revision history for this message
Gary.Wang (gary-wzl77) wrote :

Sorry for the late reply(Just got back from vacation).

Basically, regarding the issue you have that
" It always jumps to my 2nd non-location detected location."
I guess you got the problem by checking the location from scope that app has recorded in db.
Indeed, i can reproduce it and fixed it in the latest commit.

Could you describe the expected scenarios here? For example
- if you click on a location and you already have the location, I assume it would jump to it?
A: Yes
- if you click on a location and you don't already have the location, I assume it will add a section - but will this be temporary? or remain in the saved list?
A:It will add a new location and save it in the location list and navigate to hourlyView to show the location's weather info.

I record a video to show how it works under the scenarios you mentioned above.
https://drive.google.com/open?id=0B2H9ECPSSfqIak42YmU4MGducGs

Pre-condition:
    App only records my current location(Chengdu)

1. Click 'London' in scope to add a new location(Belvedere) in weather app(scenario 2)
2. Click 'Berlin' in scope to add a new location(Mitte) in weather app(scenario 2)
3. Click 'London' again from scope to jump to respective location(Belvedere) in weather app (scenario 1)
4. Click 'Roma' from scope to add a new location(Trevi) in weather app (scenario 2)

P.S:
1.if weather information is not able to be fetched via lat&lng due to api limits, the expected result is "Just open the app and stays at hourly view"
2.During my testing, new feature works fine with two providers(open weather map/the weather channel). In general, as long as backend APIs support to retrieve weather info via latitude and longitude, there would be no problem to add new provider in the future.

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

As discussed, it seems my issues occur when a manual location (London) has been added via the search functionality in the app.

Otherwise, when I don't have and manual search locations added, this functions as expected :-)

Revision history for this message
Gary.Wang (gary-wzl77) wrote :

OKay, after taking a closer look, basically it's a bug of the scope, not weather app. I hardcoded the location name("London") for each item in scope. That's why it always jumps to the detected location(London) during your testing.

After the following change was made in scope, it should be working well.
- std::string openUri = "weather://?display=hourly&city=London&lat=" + lat + "&lng=" + lng;
+std::string openUri = "weather://?display=hourly&city=" + loc + "&lat=" + lat + "&lng=" + lng;

I attached the latest scope. Could you please have a check again?
https://drive.google.com/open?id=0B2H9ECPSSfqIZkY4UzhnWGJydzA

Sorry for the noise.
Thanks. :)

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

OK this is looking better, the only thing i've noticed is that if I have London as a location, when I click London it still jumps to London rather than Belvedere. But I'm thinking that is expected as it is coming from the &city=" + loc + " part of the uri.

So functionally I think this is pretty much there, I'll work on doing a code review next :-)

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

So testing this I’ve found that the restoration of which index you had previously selected is broken (but it also appears to be in trunk as well?)

Also in the code you have stated "NOTE: potential minor issue: cities with the same name in different countries", I think the best thing todo is report a bug with low priority stating the scenario in which this could happen.

Therefore I'm going to approve this branch, and we can fix the other issues separately.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'AUTHORS'
2--- AUTHORS 2016-01-18 22:47:05 +0000
3+++ AUTHORS 2016-10-08 08:45:35 +0000
4@@ -9,3 +9,5 @@
5 Nekhelesh Ramananthan <krnekhelesh@gmail.com>
6 Vamshi Balanaga <vamrocks602@gmail.com>
7 Victor Thompson <victor.thompson@gmail.com>
8+Carla Sella <carla.sella@gmail.com>
9+Gary Wang <Gary.Wang@canonical.com>
10
11=== modified file 'CMakeLists.txt'
12--- CMakeLists.txt 2015-11-01 18:35:08 +0000
13+++ CMakeLists.txt 2016-10-08 08:45:35 +0000
14@@ -32,6 +32,7 @@
15 set(APP_HARDCODE ubuntu-weather-app)
16 set(MAIN_QML app/${APP_HARDCODE}.qml)
17 set(DESKTOP_FILE "${APP_HARDCODE}.desktop")
18+set(URLS_FILE "${APP_HARDCODE}.url-dispatcher")
19 set(ICON app/weather-app@30.png)
20 set(AUTOPILOT_DIR ubuntu_weather_app)
21
22@@ -41,8 +42,9 @@
23 set(UBUNTU-WEATHER_APP_DIR "${CMAKE_INSTALL_DATADIR}/qml")
24
25 set(QT_IMPORTS_DIR "${CMAKE_INSTALL_LIBDIR}")
26- set(EXEC "qmlscene $@ ${MAIN_QML}")
27+ set(EXEC "qmlscene %u ${MAIN_QML}")
28 set(DATA_DIR /)
29+ set(URLS_DIR ${DATA_DIR})
30
31 set(MODULE_PATH ${QT_IMPORTS_DIR})
32 if(NOT BZR_REVNO)
33@@ -97,6 +99,8 @@
34 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE}
35 DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
36
37+install(FILES ${URLS_FILE} DESTINATION ${URLS_DIR})
38+
39 add_subdirectory(app)
40 add_subdirectory(po)
41 add_subdirectory(tests)
42
43=== modified file 'app/components/CurrentLocation.qml'
44--- app/components/CurrentLocation.qml 2016-07-19 11:24:58 +0000
45+++ app/components/CurrentLocation.qml 2016-10-08 08:45:35 +0000
46@@ -28,26 +28,6 @@
47
48 property string string: "Undefined"
49
50- function searchForLocation(lat, lon) {
51- WeatherApi.sendRequest({
52- action: "searchByPoint",
53- params: {
54- coords: {
55- lat: lat,
56- lon: lon
57- }
58- }
59- }, searchResponseHandler)
60- }
61-
62- function searchResponseHandler(msgObject) {
63- if (!msgObject.error && settings.detectCurrentLocation) {
64- console.log("Loc to add:", JSON.stringify(msgObject.result.locations[0]))
65- storage.updateCurrentLocation(msgObject.result.locations[0])
66- }
67- }
68-
69-
70 PositionSource {
71 id: currentPosition
72 updateInterval: 1000
73@@ -80,7 +60,10 @@
74
75 onCountChanged: {
76 // Update the currentLocation if one is found and it does not match the stored location
77- if (count > 0 && currentLocation.string !== geocodeModel.get(0).address.city) {
78+ // if there is a location request from url on startup, we ignore this first a few times when signal is triggerd
79+ // to avoid view position to current location. It works after requestLocationByUrl was set to undefined
80+ if (weatherApp.requestLocationByUrl === undefined
81+ && count > 0 && currentLocation.string !== geocodeModel.get(0).address.city) {
82 search();
83 }
84 }
85@@ -88,7 +71,7 @@
86 function search() {
87 var loc = geocodeModel.get(0)
88 currentLocation.string = loc.address.city
89- searchForLocation(loc.coordinate.latitude, loc.coordinate.longitude)
90+ searchForLocation("searchByPoint", loc.coordinate.latitude, loc.coordinate.longitude)
91 }
92 }
93
94
95=== modified file 'app/components/HomeHourly.qml'
96--- app/components/HomeHourly.qml 2015-11-02 21:28:34 +0000
97+++ app/components/HomeHourly.qml 2016-10-08 08:45:35 +0000
98@@ -39,7 +39,7 @@
99 MouseArea {
100 anchors.fill: parent
101 onClicked: {
102- homeGraphic.visible = true
103+ graphicVisible = true
104 }
105 }
106
107
108=== modified file 'app/data/WeatherApi.js'
109--- app/data/WeatherApi.js 2016-06-04 21:02:30 +0000
110+++ app/data/WeatherApi.js 2016-10-08 08:45:35 +0000
111@@ -797,7 +797,8 @@
112 // perform the api calls
113 if(message.action === "searchByName") {
114 WeatherApi.search("name", message.params, finished, onError);
115- } else if(message.action === "searchByPoint") {
116+ } else if(message.action === "searchByPoint"
117+ || message.action === "searchByUrl") {
118 WeatherApi.search("point", message.params, finished, onError);
119 } else if(message.action === "getGeoIp") {
120 WeatherApi.geoLookup(message.params, finished, onError);
121
122=== modified file 'app/data/keys.js'
123--- app/data/keys.js 2015-11-09 10:37:47 +0000
124+++ app/data/keys.js 2016-10-08 08:45:35 +0000
125@@ -1,2 +1,2 @@
126 var twcKey = "";
127-var owmKey = ""; // See README for details on how to obtain a personal API key
128+var owmKey = ""; // goto http://openweathermap.org/appid to get a personal API key
129
130=== modified file 'app/ubuntu-weather-app.qml'
131--- app/ubuntu-weather-app.qml 2015-11-02 21:28:34 +0000
132+++ app/ubuntu-weather-app.qml 2016-10-08 08:45:35 +0000
133@@ -64,11 +64,27 @@
134 property bool networkError: false
135
136 /*
137+ Indicates of the location info requested from Url
138+ */
139+ property var requestLocationByUrl;
140+
141+ /*
142 (re)load the pages on completion
143 */
144 Component.onCompleted: {
145+ var url = args.defaultArgument.at(0)
146+ var argus = parseArguments(url);
147+
148+ mainPageStack.push(Qt.resolvedUrl("ui/HomePage.qml"), {"hourlyVisible": argus.hourlyVisible})
149+
150 storage.getLocations(fillPages);
151- refreshData();
152+ if (argus.city && argus.lat && argus.lng) {
153+ if (positionViewAtCity(argus.city) === -1) {
154+ searchForLocation("searchByUrl", argus.lat, argus.lng)
155+ }
156+ } else {
157+ refreshData();
158+ }
159 }
160
161 /*
162@@ -86,6 +102,20 @@
163 });
164 //print(JSON.stringify(messageObject.result));
165 fillPages(messageObject.result);
166+
167+ //1.Re-position current display index at requested location index
168+ //2.Prevent index changed after reorder when geoChanged is triggered on startup
169+ if (requestLocationByUrl) {
170+ for (var i = 0; i < locationsList.length; i++) {
171+ var loc = locationsList[i].location;
172+ if (requestLocationByUrl !== undefined && loc.services.geonames !== undefined &&
173+ requestLocationByUrl.services.geonames === loc.services.geonames) {
174+ settings.current = i;
175+ requestLocationByUrl = undefined
176+ break;
177+ }
178+ }
179+ }
180 }
181 } else {
182 console.log(messageObject.error.msg+" / "+messageObject.error.request.url)
183@@ -113,7 +143,7 @@
184 } else {
185 storage.getLocations(function(locations) {
186 WeatherApi.sendRequest({
187- action: "updateData",
188+ action: "updateData",
189 params: {
190 locations: locations,
191 force: force_refresh,
192@@ -127,6 +157,143 @@
193 }
194 }
195
196+ /*
197+ parse arguments retrieved from url. The url format can be as following:
198+ weather://?display=hourly&city=London&lat=51.50853&lng=-0.12574
199+ */
200+ function parseArguments(url) {
201+ var arguments = url.substring(url.lastIndexOf('?') + 1).split('&');
202+
203+ var hourlyVisible = false;
204+ var city, lat, lng;
205+ var index = 0;
206+ while(index < arguments.length) {
207+ var params = arguments[index].split('=');
208+ if (params[0] === "display")
209+ hourlyVisible = params[1] === "hourly" ? true: false;
210+ if (params[0] === "lng")
211+ lng = params[1];
212+ if (params[0] === "lat")
213+ lat = params[1];
214+ if (params[0] === "city")
215+ city = params[1];
216+
217+ index++;
218+ }
219+
220+ return {"hourlyVisible": hourlyVisible, "city": city, "lat": lat, "lng" : lng}
221+ }
222+
223+ /*
224+ Positions the view that with the specified cityName,
225+ return pos index of the city if it can be found in locationlist
226+ and return -1 if city is not found in locationlist.
227+ NOTE: potential minor issue: cities with the same name in different countries
228+ */
229+ function positionViewAtCity(cityName) {
230+ var index = -1;
231+
232+ for (var i = 0; i < locationsList.length; i++) {
233+ var loc = locationsList[i].location;
234+ if (cityName === loc.name) {
235+ settings.current = i;
236+ index = i;
237+ break;
238+ }
239+ }
240+
241+ return index;
242+ }
243+
244+ function searchForLocation(action, lat, lon) {
245+ WeatherApi.sendRequest({
246+ action: action,
247+ params: {
248+ coords: {
249+ lat: lat,
250+ lon: lon
251+ }
252+ }
253+ }, searchResponseHandler)
254+ }
255+
256+ function searchResponseHandler(msgObject) {
257+ if (!msgObject.error ) {
258+ console.log("Loc to add:", JSON.stringify(msgObject.result.locations[0]))
259+ if (msgObject.action === "searchByUrl") {
260+ requestLocationByUrl = msgObject.result.locations[0];
261+ storage.addLocation(requestLocationByUrl)
262+ } else if (settings.detectCurrentLocation) {
263+ storage.updateCurrentLocation(msgObject.result.locations[0])
264+ }
265+ }
266+ }
267+
268+ Arguments {
269+ id: args;
270+
271+ defaultArgument.help: i18n.tr("One arguments for weather app: --display, --city, --lat, --lng They will be managed by system. See the source for a full comment about them");
272+ defaultArgument.valueNames: ["URL"]
273+
274+ /* ARGUMENTS on startup
275+ *
276+ * Display hourly view when startup. This enable us to navigate weather app from weather scope
277+ * Keyword: display
278+ * Value: hourly or default
279+ *
280+ * Location information. This enable us to navigate relevant city weather view with geo information specified
281+ * please pass all three basic geo parameters together when requesting specific city weather
282+ * Keyword: city
283+ * Value: city name
284+ *
285+ * Keyword: lat
286+ * Value: latitude of city
287+ *
288+ * Keyword: lng
289+ * Value: longitude of city
290+ */
291+
292+ Argument {
293+ name: "display"
294+ required: false
295+ valueNames: ["DISPLAY"]
296+ }
297+
298+ Argument {
299+ name: "city"
300+ required: false
301+ valueNames: ["CITY"]
302+ }
303+
304+ Argument {
305+ name: "lat"
306+ required: false
307+ valueNames: ["LATITUDE"]
308+ }
309+
310+ Argument {
311+ name: "lng"
312+ required: false
313+ valueNames: ["LONGITUDE"]
314+ }
315+ }
316+
317+ Connections {
318+ target: UriHandler
319+ onOpened: {
320+ var argus = parseArguments(uris[0]);
321+ if (argus.city && argus.lat && argus.lng) {
322+ while (mainPageStack.depth > 1) {
323+ mainPageStack.pop()
324+ }
325+
326+ if (positionViewAtCity(argus.city) === -1) {
327+ searchForLocation("searchByUrl", argus.lat, argus.lng)
328+ }
329+ }
330+ }
331+ }
332+
333 CurrentLocation {
334 id: currentLocation
335 }
336@@ -204,8 +371,8 @@
337 if(location.dbId === undefined || location.dbId === 0) {
338 storage.insertLocation({location: location});
339 }
340- refreshData();
341 }
342+ refreshData();
343
344 return !exists;
345 }
346@@ -294,6 +461,5 @@
347
348 PageStack {
349 id: mainPageStack
350- Component.onCompleted: mainPageStack.push(Qt.resolvedUrl("ui/HomePage.qml"))
351 }
352 }
353
354=== modified file 'app/ui/HomePage.qml'
355--- app/ui/HomePage.qml 2016-02-28 22:53:13 +0000
356+++ app/ui/HomePage.qml 2016-10-08 08:45:35 +0000
357@@ -33,6 +33,8 @@
358 tipColor: UbuntuColors.orange
359 tipLabelColor: "#FFF"
360
361+ property bool hourlyVisible : false
362+
363 property var iconMap: {
364 "sun": "weather-clear-symbolic",
365 "moon": "weather-clear-night-symbolic",
366@@ -109,6 +111,7 @@
367 currentIndex: settings.current
368 delegate: LocationPane {
369 objectName: "locationPane" + index
370+ graphicVisible: !hourlyVisible
371 }
372 highlightRangeMode: ListView.StrictlyEnforceRange
373 model: weatherApp.locationsList.length
374
375=== modified file 'app/ui/LocationPane.qml'
376--- app/ui/LocationPane.qml 2016-06-04 21:12:07 +0000
377+++ app/ui/LocationPane.qml 2016-10-08 08:45:35 +0000
378@@ -43,6 +43,7 @@
379 property string hourlyTempUnits
380
381 property var todayData
382+ property bool graphicVisible : false
383
384 delegate: DayDelegate {
385 day: model.day
386@@ -75,10 +76,11 @@
387 HomeGraphic {
388 id: homeGraphic
389 icon: mainPageWeekdayListView.icon
390+ visible: graphicVisible;
391 MouseArea {
392 anchors.fill: parent
393 onClicked: {
394- homeGraphic.visible = false;
395+ graphicVisible = false;
396 }
397 }
398 }
399
400=== modified file 'debian/changelog'
401--- debian/changelog 2016-07-19 11:24:58 +0000
402+++ debian/changelog 2016-10-08 08:45:35 +0000
403@@ -4,6 +4,9 @@
404 * Set useragent in geocode so that osm can uniquely identify our requests
405 * Release 3.3 and bump version to 3.4
406
407+ [ Gary Wang ]
408+ * Add url-dispatcher to support for app launching from weather scope (LP: #1518888)
409+
410 -- Andrew Hayzen <ahayzen@gmail.com> Tue, 19 Jul 2016 12:22:57 +0100
411
412 ubuntu-weather-app (3.3ubuntu1) xenial; urgency=medium
413
414=== modified file 'manifest.json.in'
415--- manifest.json.in 2016-07-19 11:24:58 +0000
416+++ manifest.json.in 2016-10-08 08:45:35 +0000
417@@ -5,7 +5,8 @@
418 "hooks": {
419 "weather": {
420 "apparmor": "ubuntu-weather-app.apparmor",
421- "desktop": "@CMAKE_INSTALL_DATADIR@/applications/ubuntu-weather-app.desktop"
422+ "desktop": "@CMAKE_INSTALL_DATADIR@/applications/ubuntu-weather-app.desktop",
423+ "urls": "@URLS_FILE@"
424 }
425 },
426 "icon": "@ICON@",
427
428=== modified file 'po/com.ubuntu.weather.pot'
429--- po/com.ubuntu.weather.pot 2016-03-26 16:48:16 +0000
430+++ po/com.ubuntu.weather.pot 2016-10-08 08:45:35 +0000
431@@ -1,6 +1,6 @@
432 # SOME DESCRIPTIVE TITLE.
433 # Copyright (C) YEAR Canonical Ltd.
434-# This file is distributed under the same license as the ubuntu-weather-app package.
435+# This file is distributed under the same license as the PACKAGE package.
436 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
437 #
438 #, fuzzy
439@@ -8,7 +8,7 @@
440 msgstr ""
441 "Project-Id-Version: ubuntu-weather-app\n"
442 "Report-Msgid-Bugs-To: \n"
443-"POT-Creation-Date: 2016-03-26 11:43-0500\n"
444+"POT-Creation-Date: 2016-10-08 01:18-0700\n"
445 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
446 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
447 "Language-Team: LANGUAGE <LL@li.org>\n"
448@@ -104,6 +104,12 @@
449 "to obtain your own Open Weather Map API key."
450 msgstr ""
451
452+#: ../app/ubuntu-weather-app.qml:235
453+msgid ""
454+"One arguments for weather app: --display, --city, --lat, --lng They will be "
455+"managed by system. See the source for a full comment about them"
456+msgstr ""
457+
458 #: ../app/ui/AddLocationPage.qml:38
459 msgid "Select a city"
460 msgstr ""
461
462=== added file 'ubuntu-weather-app.url-dispatcher'
463--- ubuntu-weather-app.url-dispatcher 1970-01-01 00:00:00 +0000
464+++ ubuntu-weather-app.url-dispatcher 2016-10-08 08:45:35 +0000
465@@ -0,0 +1,5 @@
466+[
467+ {
468+ "protocol": "weather"
469+ }
470+]

Subscribers

People subscribed via source and target branches

to all changes: