Merge lp:~vthompson/ubuntu-weather-app/reboot-migrate-locations into lp:ubuntu-weather-app

Proposed by Victor Thompson
Status: Merged
Approved by: Andrew Hayzen
Approved revision: 55
Merged at revision: 57
Proposed branch: lp:~vthompson/ubuntu-weather-app/reboot-migrate-locations
Merge into: lp:ubuntu-weather-app
Diff against target: 62 lines (+12/-4)
3 files modified
app/data/Storage.qml (+6/-0)
app/ubuntu-weather-app.qml (+4/-2)
app/ui/LocationsPage.qml (+2/-2)
To merge this branch: bzr merge lp:~vthompson/ubuntu-weather-app/reboot-migrate-locations
Reviewer Review Type Date Requested Status
Andrew Hayzen Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+262292@code.launchpad.net

Commit message

Properly migrate Locations.

Description of the change

Properly migrate Locations.

To test without downgrading to the old app and upgrading to the new app, simply remove addedCurrentLocation from your ~/.config/com.ubuntu.weather/com.ubuntu.weather.conf file.

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
Andrew Hayzen (ahayzen) wrote :

LGTM :-)

I tested importing from the old app normally, with no location detection/data, with no location detection. And a few other combos, everything works as expected :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'app/data/Storage.qml'
--- app/data/Storage.qml 2015-05-09 00:47:22 +0000
+++ app/data/Storage.qml 2015-06-18 03:58:46 +0000
@@ -121,6 +121,12 @@
121 return res;121 return res;
122 }122 }
123123
124 function insertLocationAtStart(data) {
125 var res = insertLocation(data);
126 reorder(res, 0);
127 return 0;
128 }
129
124 function updateLocation(dbId, data) {130 function updateLocation(dbId, data) {
125 openDB();131 openDB();
126 db.transaction( function(tx){132 db.transaction( function(tx){
127133
=== modified file 'app/ubuntu-weather-app.qml'
--- app/ubuntu-weather-app.qml 2015-06-10 01:47:37 +0000
+++ app/ubuntu-weather-app.qml 2015-06-18 03:58:46 +0000
@@ -148,6 +148,7 @@
148 property string units148 property string units
149 property string windUnits149 property string windUnits
150150
151 property bool addedCurrentLocation: false
151 property bool migrated: false152 property bool migrated: false
152153
153 Component.onCompleted: {154 Component.onCompleted: {
@@ -170,8 +171,9 @@
170 // Add or replace the current locaiton to the storage and refresh the171 // Add or replace the current locaiton to the storage and refresh the
171 // locationList172 // locationList
172 function updateCurrentLocation(location) {173 function updateCurrentLocation(location) {
173 if (locationsList == null || locationsList.length == 0) {174 if (!settings.addedCurrentLocation || locationsList == null || locationsList.length == 0) {
174 storage.insertLocation({location: location});175 storage.insertLocationAtStart({location: location});
176 settings.addedCurrentLocation = true;
175 } else {177 } else {
176 storage.updateLocation(locationsList[0].db.id, {location: location});178 storage.updateLocation(locationsList[0].db.id, {location: location});
177 }179 }
178180
=== modified file 'app/ui/LocationsPage.qml'
--- app/ui/LocationsPage.qml 2015-06-14 21:17:22 +0000
+++ app/ui/LocationsPage.qml 2015-06-18 03:58:46 +0000
@@ -72,7 +72,7 @@
72 left: parent.left72 left: parent.left
73 right: parent.right73 right: parent.right
74 }74 }
75 height: units.gu(8)75 height: settings.addedCurrentLocation ? units.gu(8) : units.gu(0)
76 interactive: false76 interactive: false
77 model: currentLocationModel77 model: currentLocationModel
78 delegate: WeatherListItem {78 delegate: WeatherListItem {
@@ -262,7 +262,7 @@
262 "icon": iconMap[data.data[0].current.icon]262 "icon": iconMap[data.data[0].current.icon]
263 }263 }
264264
265 if (i > 0) {265 if (!settings.addedCurrentLocation || i > 0) {
266 locationsModel.append(loc)266 locationsModel.append(loc)
267 } else {267 } else {
268 currentLocationModel.append(loc)268 currentLocationModel.append(loc)

Subscribers

People subscribed via source and target branches

to all changes: