nemomobile/libcommhistory — pull request #61 by special (2013-11-22 05:18:45+00:00)
Title: [libcommhistory] Always sort events by endTime instead of startTime

This is submitted on top of https://github.com/nemomobile/libcommhistory/pull/60 - review commit 7b6ed5d specifically.

Previously, calls were always sorted by startTime, as were groups and
the last message shown for groups. Conversations, however, were sorted
by endTime. Unify everything to always sort by endTime, and change the
database index accordingly.

There are two existing cases where start and end times may differ for
events: calls (obviously) and incoming SMS. For incoming SMS, the
startTime is the sender's timestamp reporting when the message was sent,
and the endTime is the local timestamp when it was received. Because it
can take hours or days for messages to deliver, we need to sort by the
endTime for SMS messages, so that unseen messages are always at the
bottom as expected. We currently display the startTime in UI, which
seems appropriate even if it may not be the same as sort order in some
corner cases. For calls, the distinction should only come up for cases
like call waiting, but either order seems acceptable.