ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #04666
[Merge] lp:~vthompson/ubuntu-weather-app/reboot-network-error-state into lp:ubuntu-weather-app/reboot
Victor Thompson has proposed merging lp:~vthompson/ubuntu-weather-app/reboot-network-error-state into lp:ubuntu-weather-app/reboot.
Commit message:
* Add a Network Error State Component for when a connection error takes place.
Requested reviews:
Ubuntu Weather Developers (ubuntu-weather-dev)
For more details, see:
https://code.launchpad.net/~vthompson/ubuntu-weather-app/reboot-network-error-state/+merge/269558
* Add a Network Error State Component for when a connection error takes place.
--
Your team Ubuntu Weather Developers is requested to review the proposed merge of lp:~vthompson/ubuntu-weather-app/reboot-network-error-state into lp:ubuntu-weather-app/reboot.
=== added file 'app/components/NetworkErrorStateComponent.qml'
--- app/components/NetworkErrorStateComponent.qml 1970-01-01 00:00:00 +0000
+++ app/components/NetworkErrorStateComponent.qml 2015-08-28 21:55:48 +0000
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2015 Canonical Ltd
+ *
+ * This file is part of Ubuntu Weather App
+ *
+ * Ubuntu Weather App is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Ubuntu Weather App is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import QtQuick 2.4
+import Ubuntu.Components 1.2
+import "../components"
+
+
+Rectangle {
+ color: "white"
+ anchors.fill: parent
+
+ SettingsButton {
+ anchors {
+ right: parent.right
+ top: parent.top
+ }
+ }
+
+ Column {
+ anchors {
+ centerIn: parent
+ }
+ spacing: units.gu(4)
+ width: parent.width - units.gu(4)
+
+ Label {
+ id: networkErrorStateLabel
+ anchors {
+ horizontalCenter: parent.horizontalCenter
+ }
+ fontSize: "x-large"
+ text: i18n.tr("Network Error")
+ width: parent.width
+ wrapMode: Text.WordWrap
+ }
+
+ Label {
+ anchors {
+ horizontalCenter: parent.horizontalCenter
+ }
+ text: i18n.tr("Ubuntu suggests you check your network settings and try again.")
+ width: parent.width
+ wrapMode: Text.WordWrap
+ }
+
+ Button {
+ text: i18n.tr("Retry")
+ onClicked: refreshData(false, true)
+ }
+ }
+}
=== modified file 'app/ubuntu-weather-app.qml'
--- app/ubuntu-weather-app.qml 2015-07-27 21:41:09 +0000
+++ app/ubuntu-weather-app.qml 2015-08-28 21:55:48 +0000
@@ -59,6 +59,11 @@
property bool loading: false
/*
+ Indicates of the last API call resulted in a network error
+ */
+ property bool networkError: false
+
+ /*
(re)load the pages on completion
*/
Component.onCompleted: {
@@ -82,10 +87,12 @@
//print(JSON.stringify(messageObject.result));
fillPages(messageObject.result);
}
+ networkError = false
} else {
console.log(messageObject.error.msg+" / "+messageObject.error.request.url)
- // TODO error handling
}
+
+ networkError = messageObject.error
}
/* Fill the location pages with their data. */
=== modified file 'app/ui/HomePage.qml'
--- app/ui/HomePage.qml 2015-08-20 19:47:45 +0000
+++ app/ui/HomePage.qml 2015-08-28 21:55:48 +0000
@@ -162,4 +162,14 @@
source: "../components/HomePageEmptyStateComponent.qml"
visible: status === Loader.Ready && active
}
+
+ Loader {
+ active: networkError && mainPageStack.depth === 1
+ anchors {
+ fill: parent
+ }
+ asynchronous: true
+ source: "../components/NetworkErrorStateComponent.qml"
+ visible: status === Loader.Ready && active
+ }
}
=== modified file 'debian/changelog'
--- debian/changelog 2015-08-27 13:47:07 +0000
+++ debian/changelog 2015-08-28 21:55:48 +0000
@@ -23,6 +23,7 @@
selected (LP: #1482936)
* Lock app in portrait mode
* Get the condition text to be translated from the OWM API. (LP: #1487793)
+ * Add a Network Error State Component for when a connection error takes place.
[ Andrew Hayzen ]
* Add mocked locations for autopilot and add a test using the data
=== modified file 'po/com.ubuntu.weather.pot'
--- po/com.ubuntu.weather.pot 2015-08-27 13:47:07 +0000
+++ po/com.ubuntu.weather.pot 2015-08-28 21:55:48 +0000
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: ubuntu-weather-app\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-08-27 14:46+0100\n"
+"POT-Creation-Date: 2015-08-28 16:51-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@xxxxxx>\n"
@@ -82,6 +82,18 @@
msgid "Cancel selection"
msgstr ""
+#: ../app/components/NetworkErrorStateComponent.qml:48
+msgid "Network Error"
+msgstr ""
+
+#: ../app/components/NetworkErrorStateComponent.qml:57
+msgid "Ubuntu suggests you check your network settings and try again."
+msgstr ""
+
+#: ../app/components/NetworkErrorStateComponent.qml:63
+msgid "Retry"
+msgstr ""
+
#: ../app/ui/AddLocationPage.qml:29
msgid "Select a city"
msgstr ""
Follow ups