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:
zjs81 committed 2026-10-25 11:17:44 -07:00
1 parent 979e1a7d2a
commit dfc4cd54d8
7 files changed
+105 -52

No files matched your search

+3 -4
View File
@@ -92,8 +92,7 @@ class ContactStore {
'rawPacket': contact.rawPacket != null
? base64Encode(contact.rawPacket!)
: null,
'telemetryFixAdvertSeen':
contact.telemetryFixAdvertSeen?.millisecondsSinceEpoch,
'telemetryFixAt': contact.telemetryFixAt?.millisecondsSinceEpoch,
};
}
@@ -101,7 +100,7 @@ class ContactStore {
final lastSeenMs = json['lastSeen'] as int? ?? 0;
final lastMessageMs = json['lastMessageAt'] as int?;
final lastModifiedMs = json['lastModified'] as int?;
final telemetryFixMs = json['telemetryFixAdvertSeen'] as int?;
final telemetryFixMs = json['telemetryFixAt'] as int?;
final rawPathLength = json['pathLength'] as int? ?? -1;
final rawPath = json['path'] != null
@@ -160,7 +159,7 @@ class ContactStore {
rawPacket: json['rawPacket'] != null
? Uint8List.fromList(base64Decode(json['rawPacket'] as String))
: null,
telemetryFixAdvertSeen: telemetryFixMs == null
telemetryFixAt: telemetryFixMs == null
? null
: DateTime.fromMillisecondsSinceEpoch(telemetryFixMs),
);