← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~vthompson/ubuntu-weather-app/reboot-default-OWM-blank-key into lp:ubuntu-weather-app/reboot

 

Victor Thompson has proposed merging lp:~vthompson/ubuntu-weather-app/reboot-default-OWM-blank-key into lp:ubuntu-weather-app/reboot.

Commit message:
* Default to OWM if the key file for TWC is blank.

Requested reviews:
  Ubuntu Weather Developers (ubuntu-weather-dev)
Related bugs:
  Bug #1471329 in Ubuntu Weather App: "Include the key.js file in the source tree"
  https://bugs.launchpad.net/ubuntu-weather-app/+bug/1471329

For more details, see:
https://code.launchpad.net/~vthompson/ubuntu-weather-app/reboot-default-OWM-blank-key/+merge/265879

* Default to OWM if the key file for TWC is blank.

This MP defaults the app to OWM when the key is blank. I think this is the best solution for the app not working when the key isn't in the source tree. 
-- 
Your team Ubuntu Weather Developers is requested to review the proposed merge of lp:~vthompson/ubuntu-weather-app/reboot-default-OWM-blank-key into lp:ubuntu-weather-app/reboot.
=== modified file 'app/ubuntu-weather-app.qml'
--- app/ubuntu-weather-app.qml	2015-06-28 19:04:43 +0000
+++ app/ubuntu-weather-app.qml	2015-07-24 21:29:50 +0000
@@ -153,6 +153,10 @@
                 units = metric ? "metric" : "imperial"
                 windUnits = metric ? "kph" : "mph"
             }
+
+            if (Key.twcKey === "") {  // No API key for TWC, so use OWM
+                service = "openweathermap"
+            }
         }
     }
 

=== modified file 'app/ui/settings/DataProviderPage.qml'
--- app/ui/settings/DataProviderPage.qml	2015-06-21 14:54:05 +0000
+++ app/ui/settings/DataProviderPage.qml	2015-07-24 21:29:50 +0000
@@ -19,6 +19,7 @@
 import QtQuick 2.4
 import Ubuntu.Components 1.2
 import "../../components"
+import "../../data/key.js" as Key
 
 Page {
     title: i18n.tr("Data Provider")
@@ -26,7 +27,6 @@
     ListModel {
         id: dataProviderModel
         ListElement { text: "OpenWeatherMap" }
-        ListElement { text: "The Weather Channel" }
     }
 
     ExpandableListItem {
@@ -51,4 +51,11 @@
             }
         }
     }
+
+    Component.onCompleted: {
+        // If the key file for TWC is not blank, add the service to the model
+        if (Key.twcKey !== "") {
+            dataProviderModel.append({ text: "The Weather Channel" })
+        }
+    }
 }

=== modified file 'debian/changelog'
--- debian/changelog	2015-06-02 01:15:28 +0000
+++ debian/changelog	2015-07-24 21:29:50 +0000
@@ -1,6 +1,8 @@
 ubuntu-weather-app (3.0) UNRELEASED; urgency=medium
 
+  [Victor Thompson]
   * Sync debian version with click version.
+  * Default to OWM if the key file for TWC is blank.
 
  -- Victor Thompson <victor.thompson@xxxxxxxxx>  Mon, 01 Jun 2015 20:11:23 -0500
 


Follow ups