Keep telemetry fixes off the advert timestamp and across full syncs
Writing the telemetry time into lastSeen sent the phone's clock back to the radio as the node's advert timestamp on the next path or flag write, which could later make the radio's record look newer and drop the fix. The fix now records its own telemetryFixAt and leaves lastSeen as the advert time; the map and lists show the later of the two as last heard. A full contact sync (pull to refresh, reconnect) cleared the list before the radio resent it, so fixes were lost even for an unchanged advert. They are now held for the sync and restored onto matching records.
This commit is contained in:
1 parent
979e1a7d2a
commit
dfc4cd54d8
7 files changed
+105
-52
No files matched your search
@@ -41,12 +41,11 @@ IconData? contactTypeIcon(int type) {
|
||||
}
|
||||
|
||||
/// The most recent activity for [contact]: for chat nodes this includes the
|
||||
/// last message, for other node types only the last advert.
|
||||
/// last message, for other node types only the last advert or telemetry fix.
|
||||
DateTime resolveContactLastSeen(Contact contact) {
|
||||
if (contact.type != advTypeChat) return contact.lastSeen;
|
||||
return contact.lastMessageAt.isAfter(contact.lastSeen)
|
||||
? contact.lastMessageAt
|
||||
: contact.lastSeen;
|
||||
final heard = 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").
|
||||
|
||||
@@ -262,7 +262,7 @@ void showNodeInfoSheet(
|
||||
),
|
||||
NodeInfoRow(
|
||||
label: l10n.map_lastSeen,
|
||||
value: formatNodeLastSeen(l10n, contact.lastSeen),
|
||||
value: formatNodeLastSeen(l10n, contact.lastHeard),
|
||||
),
|
||||
NodeInfoRow(
|
||||
label: l10n.map_publicKey,
|
||||
|
||||
Reference in new issue
Block a user