Andrew Hayzen has proposed merging lp:~ahayzen/ubuntu-weather-app/fix-1583169-add-updated-at-text into lp:ubuntu-weather-app.
Commit message: * Add support for showing updated X minutes ago Requested reviews: Ubuntu Weather Developers (ubuntu-weather-dev) Related bugs: Bug #1583169 in Ubuntu Weather App: "weather app does not show last update date" https://bugs.launchpad.net/ubuntu-weather-app/+bug/1583169 For more details, see: https://code.launchpad.net/~ahayzen/ubuntu-weather-app/fix-1583169-add-updated-at-text/+merge/303188 * Add support for showing updated X minutes ago -- Your team Ubuntu Weather Developers is requested to review the proposed merge of lp:~ahayzen/ubuntu-weather-app/fix-1583169-add-updated-at-text into lp:ubuntu-weather-app.
=== modified file 'app/components/HomeTempInfo.qml' --- app/components/HomeTempInfo.qml 2015-11-02 21:28:34 +0000 +++ app/components/HomeTempInfo.qml 2016-08-17 20:13:45 +0000 @@ -89,6 +89,11 @@ property alias now: nowLabel.text + // Don't store as int as reaches max int + property var updatedAt + + onUpdatedAtChanged: diffTimer.restart() + Column { id: labelColumn anchors { @@ -100,7 +105,35 @@ Label { font.weight: Font.Light fontSize: "small" - text: i18n.tr("Today") + text: i18n.tr("Today") + " - " + updatedAtText + " " + + readonly property string updatedAtText: { + if (diffDays > 0) { + i18n.tr("updated %1 day ago", "updated %1 days ago", diffDays).arg(diffDays) + } else if (diffHours > 0) { + i18n.tr("updated %1 hour ago", "updated %1 hours ago", diffHours).arg(diffHours) + } else if (diffMinutes > 0) { + i18n.tr("updated %1 minute ago", "updated %1 minutes ago", diffMinutes).arg(diffMinutes) + } else { + i18n.tr("updated recently") + } + } + + property var diff + property int diffMinutes: Math.floor(diff / 60) + property int diffHours: Math.floor(diffMinutes / 60) + property int diffDays: Math.floor(diffHours / 24) + + // Check the time every 15 seconds + Timer { + id: diffTimer + interval: 15000 + repeat: true + running: parent.visible + triggeredOnStart: true + + onTriggered: parent.diff = ((new Date().getTime() - updatedAt) / 1000) + } } Label { === modified file 'app/ui/LocationPane.qml' --- app/ui/LocationPane.qml 2016-06-04 21:12:07 +0000 +++ app/ui/LocationPane.qml 2016-08-17 20:13:45 +0000 @@ -44,6 +44,8 @@ property var todayData + property var lastFetch // don't store as int as reaches max int + delegate: DayDelegate { day: model.day high: model.high @@ -97,6 +99,7 @@ id: homeTempInfo modelData: todayData now: mainPageWeekdayListView.currentTemp + updatedAt: mainPageWeekdayListView.lastFetch } // TODO: Migrate this to using the new SDK list item when possible. @@ -229,6 +232,9 @@ hourlyForecastsData = hourlyForecasts; hourlyTempUnits = tempUnits; } + + // Set last updated time + mainPageWeekdayListView.lastFetch = data.updated; } Component.onCompleted: renderData(index) === modified file 'debian/changelog' --- debian/changelog 2016-07-19 11:24:58 +0000 +++ debian/changelog 2016-08-17 20:13:45 +0000 @@ -1,10 +1,18 @@ -ubuntu-weather-app (3.4ubuntu1) UNRELEASED; urgency=medium +ubuntu-weather-app (3.5ubuntu1) UNRELEASED; urgency=medium + + [ Andrew Hayzen ] + * Release 3.4 and bump version to 3.5 + * Add support for showing updated X minutes ago (LP: #1583169) + + -- Andrew Hayzen <ahay...@gmail.com> Wed, 17 Aug 2016 21:10:10 +0100 + +ubuntu-weather-app (3.4ubuntu1) xenial; urgency=medium [ Andrew Hayzen ] * Set useragent in geocode so that osm can uniquely identify our requests * Release 3.3 and bump version to 3.4 - -- Andrew Hayzen <ahay...@gmail.com> Tue, 19 Jul 2016 12:22:57 +0100 + -- Andrew Hayzen <ahay...@gmail.com> Wed, 17 Aug 2016 21:09:46 +0100 ubuntu-weather-app (3.3ubuntu1) xenial; urgency=medium === modified file 'manifest.json.in' --- manifest.json.in 2016-07-19 11:24:58 +0000 +++ manifest.json.in 2016-08-17 20:13:45 +0000 @@ -12,7 +12,7 @@ "maintainer": "Ubuntu App Cats <ubuntu-touch-corea...@lists.launchpad.net>", "name": "@PROJECT_NAME@", "title": "Weather", - "version": "3.4.@BZR_REVNO@", + "version": "3.5.@BZR_REVNO@", "x-source": { "vcs-bzr": "@BZR_SOURCE@", "vcs-bzr-revno": "@BZR_REVNO@" === modified file 'po/com.ubuntu.weather.pot' --- po/com.ubuntu.weather.pot 2016-03-26 16:48:16 +0000 +++ po/com.ubuntu.weather.pot 2016-08-17 20:13:45 +0000 @@ -1,6 +1,6 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR Canonical Ltd. -# This file is distributed under the same license as the ubuntu-weather-app package. +# This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # #, fuzzy @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: ubuntu-weather-app\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-03-26 11:43-0500\n" +"POT-Creation-Date: 2016-08-17 20:49+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <l...@li.org>\n" @@ -58,10 +58,35 @@ msgid "Manually add a location by swiping up from the bottom of the display" msgstr "" -#: ../app/components/HomeTempInfo.qml:103 +#: ../app/components/HomeTempInfo.qml:108 msgid "Today" msgstr "" +#: ../app/components/HomeTempInfo.qml:112 +#, qt-format +msgid "updated %1 day ago" +msgid_plural "updated %1 days ago" +msgstr[0] "" +msgstr[1] "" + +#: ../app/components/HomeTempInfo.qml:114 +#, qt-format +msgid "updated %1 hour ago" +msgid_plural "updated %1 hours ago" +msgstr[0] "" +msgstr[1] "" + +#: ../app/components/HomeTempInfo.qml:116 +#, qt-format +msgid "updated %1 minute ago" +msgid_plural "updated %1 minutes ago" +msgstr[0] "" +msgstr[1] "" + +#: ../app/components/HomeTempInfo.qml:118 +msgid "updated recently" +msgstr "" + #: ../app/components/ListItemActions/Remove.qml:26 msgid "Remove" msgstr ""
-- Mailing list: https://launchpad.net/~ubuntu-touch-coreapps-reviewers Post to : ubuntu-touch-coreapps-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~ubuntu-touch-coreapps-reviewers More help : https://help.launchpad.net/ListHelp