Merge lp:~vthompson/ubuntu-weather-app/reboot-network-error-state into lp:ubuntu-weather-app

Proposed by Victor Thompson on 2015-08-28
Status: Merged
Approved by: Andrew Hayzen on 2015-09-04
Approved revision: 113
Merged at revision: 113
Proposed branch: lp:~vthompson/ubuntu-weather-app/reboot-network-error-state
Merge into: lp:ubuntu-weather-app
Diff against target: 161 lines (+98/-2)
5 files modified
app/components/NetworkErrorStateComponent.qml (+67/-0)
app/ubuntu-weather-app.qml (+7/-1)
app/ui/HomePage.qml (+10/-0)
debian/changelog (+1/-0)
po/com.ubuntu.weather.pot (+13/-1)
To merge this branch: bzr merge lp:~vthompson/ubuntu-weather-app/reboot-network-error-state
Reviewer Review Type Date Requested Status
Andrew Hayzen 2015-08-28 Approve on 2015-09-04
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2015-09-03
Review via email: mp+269558@code.launchpad.net

Commit message

* Add a Network Error State Component for when a connection error takes place.

Description of the change

* Add a Network Error State Component for when a connection error takes place.

To post a comment you must log in.
112. By Victor Thompson on 2015-08-28

Update

Andrew Hayzen (ahayzen) wrote :

1 inline comment so far...

review: Needs Fixing
113. By Victor Thompson on 2015-09-03

Check against error being undefined

Victor Thompson (vthompson) wrote :

I've updated this to account for error not existing.

Andrew Hayzen (ahayzen) wrote :

LGTM, that one inline comment will be fixed in a separate MP as I've stated, one other thought do we need a AP test for this?

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'app/components/NetworkErrorStateComponent.qml'
2--- app/components/NetworkErrorStateComponent.qml 1970-01-01 00:00:00 +0000
3+++ app/components/NetworkErrorStateComponent.qml 2015-09-03 22:55:29 +0000
4@@ -0,0 +1,67 @@
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 QtQuick 2.4
24+import Ubuntu.Components 1.2
25+import "../components"
26+
27+
28+Rectangle {
29+ color: "white"
30+ anchors.fill: parent
31+
32+ SettingsButton {
33+ anchors {
34+ right: parent.right
35+ top: parent.top
36+ }
37+ }
38+
39+ Column {
40+ anchors {
41+ centerIn: parent
42+ }
43+ spacing: units.gu(4)
44+ width: parent.width - units.gu(4)
45+
46+ Label {
47+ id: networkErrorStateLabel
48+ anchors {
49+ horizontalCenter: parent.horizontalCenter
50+ }
51+ fontSize: "x-large"
52+ text: i18n.tr("Network Error")
53+ width: parent.width
54+ wrapMode: Text.WordWrap
55+ }
56+
57+ Label {
58+ anchors {
59+ horizontalCenter: parent.horizontalCenter
60+ }
61+ text: i18n.tr("Ubuntu suggests you check your network settings and try again.")
62+ width: parent.width
63+ wrapMode: Text.WordWrap
64+ }
65+
66+ Button {
67+ text: i18n.tr("Retry")
68+ onClicked: refreshData(false, true)
69+ }
70+ }
71+}
72
73=== modified file 'app/ubuntu-weather-app.qml'
74--- app/ubuntu-weather-app.qml 2015-07-27 21:41:09 +0000
75+++ app/ubuntu-weather-app.qml 2015-09-03 22:55:29 +0000
76@@ -59,6 +59,11 @@
77 property bool loading: false
78
79 /*
80+ Indicates of the last API call resulted in a network error
81+ */
82+ property bool networkError: false
83+
84+ /*
85 (re)load the pages on completion
86 */
87 Component.onCompleted: {
88@@ -84,8 +89,9 @@
89 }
90 } else {
91 console.log(messageObject.error.msg+" / "+messageObject.error.request.url)
92- // TODO error handling
93 }
94+
95+ networkError = messageObject.error !== undefined
96 }
97
98 /* Fill the location pages with their data. */
99
100=== modified file 'app/ui/HomePage.qml'
101--- app/ui/HomePage.qml 2015-08-20 19:47:45 +0000
102+++ app/ui/HomePage.qml 2015-09-03 22:55:29 +0000
103@@ -162,4 +162,14 @@
104 source: "../components/HomePageEmptyStateComponent.qml"
105 visible: status === Loader.Ready && active
106 }
107+
108+ Loader {
109+ active: networkError && mainPageStack.depth === 1
110+ anchors {
111+ fill: parent
112+ }
113+ asynchronous: true
114+ source: "../components/NetworkErrorStateComponent.qml"
115+ visible: status === Loader.Ready && active
116+ }
117 }
118
119=== modified file 'debian/changelog'
120--- debian/changelog 2015-08-27 13:47:07 +0000
121+++ debian/changelog 2015-09-03 22:55:29 +0000
122@@ -23,6 +23,7 @@
123 selected (LP: #1482936)
124 * Lock app in portrait mode
125 * Get the condition text to be translated from the OWM API. (LP: #1487793)
126+ * Add a Network Error State Component for when a connection error takes place.
127
128 [ Andrew Hayzen ]
129 * Add mocked locations for autopilot and add a test using the data
130
131=== modified file 'po/com.ubuntu.weather.pot'
132--- po/com.ubuntu.weather.pot 2015-08-27 13:47:07 +0000
133+++ po/com.ubuntu.weather.pot 2015-09-03 22:55:29 +0000
134@@ -8,7 +8,7 @@
135 msgstr ""
136 "Project-Id-Version: ubuntu-weather-app\n"
137 "Report-Msgid-Bugs-To: \n"
138-"POT-Creation-Date: 2015-08-27 14:46+0100\n"
139+"POT-Creation-Date: 2015-08-28 16:51-0500\n"
140 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
141 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
142 "Language-Team: LANGUAGE <LL@li.org>\n"
143@@ -82,6 +82,18 @@
144 msgid "Cancel selection"
145 msgstr ""
146
147+#: ../app/components/NetworkErrorStateComponent.qml:48
148+msgid "Network Error"
149+msgstr ""
150+
151+#: ../app/components/NetworkErrorStateComponent.qml:57
152+msgid "Ubuntu suggests you check your network settings and try again."
153+msgstr ""
154+
155+#: ../app/components/NetworkErrorStateComponent.qml:63
156+msgid "Retry"
157+msgstr ""
158+
159 #: ../app/ui/AddLocationPage.qml:29
160 msgid "Select a city"
161 msgstr ""

Subscribers

People subscribed via source and target branches

to all changes: