feat: Add new contact and message tracking features, including unread status and removal functionality

This commit is contained in:
Janez T
2025-10-15 21:49:33 +02:00
parent 2849ab92aa
commit 6be182e20a
13 changed files with 463 additions and 48 deletions

View File

@@ -53,6 +53,9 @@ class Contact {
// Telemetry data (updated separately)
ContactTelemetry? telemetry;
// UI state tracking
final bool isNew; // Whether contact is newly added and not yet viewed
Contact({
required this.publicKey,
required this.type,
@@ -65,6 +68,7 @@ class Contact {
required this.advLon,
required this.lastMod,
this.telemetry,
this.isNew = false,
});
/// Get public key as hex string (first 8 bytes)
@@ -250,6 +254,7 @@ class Contact {
int? advLon,
int? lastMod,
ContactTelemetry? telemetry,
bool? isNew,
}) {
return Contact(
publicKey: publicKey ?? this.publicKey,
@@ -263,6 +268,7 @@ class Contact {
advLon: advLon ?? this.advLon,
lastMod: lastMod ?? this.lastMod,
telemetry: telemetry ?? this.telemetry,
isNew: isNew ?? this.isNew,
);
}

View File

@@ -63,6 +63,9 @@ class Message {
final DateTime? deliveredAt; // When delivery was confirmed
final Uint8List? recipientPublicKey; // Full 32-byte public key of recipient (for retry)
// Read status tracking
final bool isRead; // Whether message has been read by user
Message({
required this.id,
required this.messageType,
@@ -83,6 +86,7 @@ class Message {
this.roundTripTimeMs,
this.deliveredAt,
this.recipientPublicKey,
this.isRead = false,
});
/// Get sender public key as hex string
@@ -222,6 +226,7 @@ class Message {
int? roundTripTimeMs,
DateTime? deliveredAt,
Uint8List? recipientPublicKey,
bool? isRead,
}) {
return Message(
id: id ?? this.id,
@@ -243,6 +248,7 @@ class Message {
roundTripTimeMs: roundTripTimeMs ?? this.roundTripTimeMs,
deliveredAt: deliveredAt ?? this.deliveredAt,
recipientPublicKey: recipientPublicKey ?? this.recipientPublicKey,
isRead: isRead ?? this.isRead,
);
}