Merge lp:~ahayzen/ubuntu-weather-app/fix-1583169-add-updated-at-text into lp:ubuntu-weather-app

Proposed by Andrew Hayzen on 2016-08-17
Status: Merged
Approved by: Andrew Hayzen on 2017-04-12
Approved revision: 253
Merged at revision: 266
Proposed branch: lp:~ahayzen/ubuntu-weather-app/fix-1583169-add-updated-at-text
Merge into: lp:ubuntu-weather-app
Diff against target: 172 lines (+78/-6)
5 files modified
app/components/HomeTempInfo.qml (+34/-1)
app/ui/LocationPane.qml (+6/-0)
debian/changelog (+9/-1)
manifest.json.in (+1/-1)
po/com.ubuntu.weather.pot (+28/-3)
To merge this branch: bzr merge lp:~ahayzen/ubuntu-weather-app/fix-1583169-add-updated-at-text
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Approve on 2017-04-12
Michael Sheldon (community) Approve on 2017-04-12
Andrew Hayzen Abstain on 2017-04-12
Review via email: mp+303188@code.launchpad.net

Commit message

* Add support for showing updated X minutes ago

Description of the change

* Add support for showing updated X minutes ago

To post a comment you must log in.
Andrew Hayzen (ahayzen) wrote :

We are going to get design to review this first.

review: Needs Information
review: Approve (continuous-integration)
251. By Andrew Hayzen on 2017-04-12

* Pull of trunk

review: Approve (continuous-integration)
Andrew Hayzen (ahayzen) wrote :

Testing:
- Open the weather for a location
- Wait for a long period of time check that the "updated recently" changes to "updated N minutes ago"
- Refresh (pull from top) the location to refresh
- It should now change back to "updated recently"

review: Abstain
252. By Andrew Hayzen on 2017-04-12

* Update changelog date/times

253. By Andrew Hayzen on 2017-04-12

* Add space

Michael Sheldon (michael-sheldon) wrote :

Looks good!

review: Approve
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/components/HomeTempInfo.qml'
2--- app/components/HomeTempInfo.qml 2015-11-02 21:28:34 +0000
3+++ app/components/HomeTempInfo.qml 2017-04-12 10:28:17 +0000
4@@ -89,6 +89,11 @@
5
6 property alias now: nowLabel.text
7
8+ // Don't store as int as reaches max int
9+ property var updatedAt
10+
11+ onUpdatedAtChanged: diffTimer.restart()
12+
13 Column {
14 id: labelColumn
15 anchors {
16@@ -100,7 +105,35 @@
17 Label {
18 font.weight: Font.Light
19 fontSize: "small"
20- text: i18n.tr("Today")
21+ text: i18n.tr("Today") + " - " + updatedAtText + " "
22+
23+ readonly property string updatedAtText: {
24+ if (diffDays > 0) {
25+ i18n.tr("updated %1 day ago", "updated %1 days ago", diffDays).arg(diffDays)
26+ } else if (diffHours > 0) {
27+ i18n.tr("updated %1 hour ago", "updated %1 hours ago", diffHours).arg(diffHours)
28+ } else if (diffMinutes > 0) {
29+ i18n.tr("updated %1 minute ago", "updated %1 minutes ago", diffMinutes).arg(diffMinutes)
30+ } else {
31+ i18n.tr("updated recently")
32+ }
33+ }
34+
35+ property var diff
36+ property int diffMinutes: Math.floor(diff / 60)
37+ property int diffHours: Math.floor(diffMinutes / 60)
38+ property int diffDays: Math.floor(diffHours / 24)
39+
40+ // Check the time every 15 seconds
41+ Timer {
42+ id: diffTimer
43+ interval: 15000
44+ repeat: true
45+ running: parent.visible
46+ triggeredOnStart: true
47+
48+ onTriggered: parent.diff = ((new Date().getTime() - updatedAt) / 1000)
49+ }
50 }
51
52 Label {
53
54=== modified file 'app/ui/LocationPane.qml'
55--- app/ui/LocationPane.qml 2016-08-25 07:47:46 +0000
56+++ app/ui/LocationPane.qml 2017-04-12 10:28:17 +0000
57@@ -45,6 +45,8 @@
58 property var todayData
59 property bool graphicVisible : false
60
61+ property var lastFetch // don't store as int as reaches max int
62+
63 delegate: DayDelegate {
64 day: model.day
65 high: model.high
66@@ -99,6 +101,7 @@
67 id: homeTempInfo
68 modelData: todayData
69 now: mainPageWeekdayListView.currentTemp
70+ updatedAt: mainPageWeekdayListView.lastFetch
71 }
72
73 // TODO: Migrate this to using the new SDK list item when possible.
74@@ -231,6 +234,9 @@
75 hourlyForecastsData = hourlyForecasts;
76 hourlyTempUnits = tempUnits;
77 }
78+
79+ // Set last updated time
80+ mainPageWeekdayListView.lastFetch = data.updated;
81 }
82
83 Component.onCompleted: renderData(index)
84
85=== modified file 'debian/changelog'
86--- debian/changelog 2016-08-25 07:47:46 +0000
87+++ debian/changelog 2017-04-12 10:28:17 +0000
88@@ -1,4 +1,12 @@
89-ubuntu-weather-app (3.4ubuntu1) UNRELEASED; urgency=medium
90+ubuntu-weather-app (3.5ubuntu1) UNRELEASED; urgency=medium
91+
92+ [ Andrew Hayzen ]
93+ * Release 3.4 and bump version to 3.5
94+ * Add support for showing updated X minutes ago (LP: #1583169)
95+
96+ -- Andrew Hayzen <ahayzen@gmail.com> Wed, 17 Aug 2016 21:10:10 +0100
97+
98+ubuntu-weather-app (3.4ubuntu1) xenial; urgency=medium
99
100 [ Andrew Hayzen ]
101 * Set useragent in geocode so that osm can uniquely identify our requests
102
103=== modified file 'manifest.json.in'
104--- manifest.json.in 2016-08-25 07:47:46 +0000
105+++ manifest.json.in 2017-04-12 10:28:17 +0000
106@@ -13,7 +13,7 @@
107 "maintainer": "Ubuntu App Cats <ubuntu-touch-coreapps@lists.launchpad.net>",
108 "name": "@PROJECT_NAME@",
109 "title": "Weather",
110- "version": "3.4.@BZR_REVNO@",
111+ "version": "3.5.@BZR_REVNO@",
112 "x-source": {
113 "vcs-bzr": "@BZR_SOURCE@",
114 "vcs-bzr-revno": "@BZR_REVNO@"
115
116=== modified file 'po/com.ubuntu.weather.pot'
117--- po/com.ubuntu.weather.pot 2016-10-08 08:44:17 +0000
118+++ po/com.ubuntu.weather.pot 2017-04-12 10:28:17 +0000
119@@ -1,6 +1,6 @@
120 # SOME DESCRIPTIVE TITLE.
121 # Copyright (C) YEAR Canonical Ltd.
122-# This file is distributed under the same license as the PACKAGE package.
123+# This file is distributed under the same license as the ubuntu-weather-app package.
124 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
125 #
126 #, fuzzy
127@@ -8,7 +8,7 @@
128 msgstr ""
129 "Project-Id-Version: ubuntu-weather-app\n"
130 "Report-Msgid-Bugs-To: \n"
131-"POT-Creation-Date: 2016-10-08 01:18-0700\n"
132+"POT-Creation-Date: 2017-04-12 10:54+0100\n"
133 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
134 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
135 "Language-Team: LANGUAGE <LL@li.org>\n"
136@@ -58,10 +58,35 @@
137 msgid "Manually add a location by swiping up from the bottom of the display"
138 msgstr ""
139
140-#: ../app/components/HomeTempInfo.qml:103
141+#: ../app/components/HomeTempInfo.qml:108
142 msgid "Today"
143 msgstr ""
144
145+#: ../app/components/HomeTempInfo.qml:112
146+#, qt-format
147+msgid "updated %1 day ago"
148+msgid_plural "updated %1 days ago"
149+msgstr[0] ""
150+msgstr[1] ""
151+
152+#: ../app/components/HomeTempInfo.qml:114
153+#, qt-format
154+msgid "updated %1 hour ago"
155+msgid_plural "updated %1 hours ago"
156+msgstr[0] ""
157+msgstr[1] ""
158+
159+#: ../app/components/HomeTempInfo.qml:116
160+#, qt-format
161+msgid "updated %1 minute ago"
162+msgid_plural "updated %1 minutes ago"
163+msgstr[0] ""
164+msgstr[1] ""
165+
166+#: ../app/components/HomeTempInfo.qml:118
167+msgid "updated recently"
168+msgstr ""
169+
170 #: ../app/components/ListItemActions/Remove.qml:26
171 msgid "Remove"
172 msgstr ""

Subscribers

People subscribed via source and target branches

to all changes: