Fix list ordering and long-list scrolling
- Sort channels by latest message and contacts by recent message using local arrival time instead of the sender's clock. - Contacts added from a card sort by when they were added until the radio hears an advert (app-side only; lastAdvert stays 0). - Stop entrance animations on rows scrolled into view and reuse unchanged contact rows across connector updates.
This commit is contained in:
1 parent
34ea0cb7ca
commit
316088dfd6
35 files changed
+1357
-43
No files matched your search
@@ -43,14 +43,22 @@ ThemeIconSlot? contactTypeIconSlot(int type) {
|
||||
|
||||
/// The most recent activity for [contact]: for chat nodes this includes the
|
||||
/// last message, for other node types only the last advert or telemetry fix.
|
||||
DateTime resolveContactLastSeen(Contact contact) {
|
||||
final heard = contact.lastHeard;
|
||||
/// [addedAt] (the phone time the contact was added from a card) stands in
|
||||
/// while the radio has no advert time for it.
|
||||
DateTime resolveContactLastSeen(Contact contact, {DateTime? addedAt}) {
|
||||
final heard =
|
||||
addedAt != null &&
|
||||
contact.lastSeen.millisecondsSinceEpoch == 0 &&
|
||||
addedAt.isAfter(contact.lastHeard)
|
||||
? addedAt
|
||||
: contact.lastHeard;
|
||||
if (contact.type != advTypeChat) return heard;
|
||||
return contact.lastMessageAt.isAfter(heard) ? contact.lastMessageAt : heard;
|
||||
}
|
||||
|
||||
/// Short relative "last seen" label ("now", "5 mins ago", "2 days ago").
|
||||
String formatContactLastSeen(AppLocalizations l10n, DateTime lastSeen) {
|
||||
if (lastSeen.millisecondsSinceEpoch == 0) return l10n.contacts_lastSeenNever;
|
||||
final diff = DateTime.now().difference(lastSeen);
|
||||
|
||||
if (diff.isNegative || diff.inMinutes < 5) {
|
||||
|
||||
Reference in new issue
Block a user