Merge lp://qastaging/~dgadomski/ubuntu-rssreader-app/relative-time-formatting into lp://qastaging/~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk

Proposed by Dariusz Gadomski
Status: Merged
Approved by: Joey Chan
Approved revision: 22
Merged at revision: 25
Proposed branch: lp://qastaging/~dgadomski/ubuntu-rssreader-app/relative-time-formatting
Merge into: lp://qastaging/~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk
Diff against target: 520 lines (+116/-74)
10 files modified
ArticleFullImg.qml (+4/-3)
ArticleOneImgA.qml (+4/-3)
ArticleOneImgB.qml (+4/-3)
ArticleTextA.qml (+4/-3)
ArticleTextB.qml (+4/-3)
ArticleTwoImgA.qml (+4/-3)
ListColumnDelegate.qml (+2/-2)
ListColumnView.qml (+1/-1)
addDelegate.js (+19/-19)
dateutils.js (+70/-34)
To merge this branch: bzr merge lp://qastaging/~dgadomski/ubuntu-rssreader-app/relative-time-formatting
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Ubuntu Shorts Developers Pending
Joey Chan Pending
David Planella Pending
Review via email: mp+176435@code.qastaging.launchpad.net

Commit message

Improved relative time formatting utility.

Description of the change

This is my second approach to provide a more generic and flexible relative time formatting utility. This one incorporates an array of formatters which may be adjusted when needed.
There are 2 new formats added 'borrowed' from the calculator app: displaying that something happened yesterday ("Yesterday at %1") or within a week from now (by using the weekday name).

I have tested this version and it works just fine with gettext (all strings are extracted correctly for translations).

Unfortunately, since i18n is a QML context property (confirmed in Ubuntu UI toolkit source code: http://bazaar.launchpad.net/~ubuntu-sdk-team/ubuntu-ui-toolkit/trunk/view/head:/modules/Ubuntu/Components/plugin/plugin.cpp#L133) and not a function/component it cannot be simple ".import"-ed in JS. It needs to be passed there e.g. as an argument of the function.

I believe in this form it can be easily reused in ubuntu-calculator-app (it has all the features required there).

To post a comment you must log in.
Revision history for this message
Roman Shchekin (mrqtros) wrote :

Looks like all is ok, w8 while guys will review your code too :)

22. By Dariusz Gadomski

Merge with trunk.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (continuous-integration)
Revision history for this message
Joey Chan (qqworini) wrote :

Hi Dariusz,

We gonna make some changes to the database, one of the major change is, store time value in Integer, not text like before, in order to "order" articles by time value.

So, I want to ask u to separate the "formatRelativeTime" function into two parts:

1. one is convert the original time value to an Integer which is seconds from 1970-01-01 00:00
2. convert the "seconds" Integer to current output

Hope u have time to help :)
Thanks

Joey

Revision history for this message
Dariusz Gadomski (dgadomski) wrote :

Hi Joey,

I have changed the implementation to suit your needs:
https://code.launchpad.net/~dgadomski/ubuntu-rssreader-app/formatRelativeTime-uses-seconds/+merge/183714

I hope this is what you expected.

Regards,
Dariusz

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches