feat: Enhance contact telemetry updates with last seen timestamp and improve message bubble UI for SAR and drawing indicators

This commit is contained in:
Janez T
2025-10-26 17:04:25 +01:00
parent b8147e904c
commit a6fbc10221
3 changed files with 158 additions and 130 deletions

View File

@@ -304,10 +304,19 @@ class ContactsProvider with ChangeNotifier {
debugPrint(' ✅ Parsed new telemetry');
debugPrint(' New telemetry timestamp: ${telemetry.timestamp}');
// Update contact with new telemetry
final updatedContact = contact.copyWith(telemetry: telemetry);
// Update contact with new telemetry AND last seen time
// lastAdvert is Unix timestamp in seconds
final currentTimestamp =
(DateTime.now().millisecondsSinceEpoch / 1000).round();
debugPrint(' Old lastAdvert: ${contact.lastAdvert}');
debugPrint(' New lastAdvert: $currentTimestamp');
final updatedContact = contact.copyWith(
telemetry: telemetry,
lastAdvert: currentTimestamp, // Update last seen time
);
_contacts[contact.publicKeyHex] = updatedContact;
debugPrint(' ✅ Updated contact in map');
debugPrint(' ✅ Updated contact in map (with new lastAdvert)');
_persistContacts();
debugPrint(' ✅ Persisted contacts to storage');