feat: Enhance message display with rich sender names and replace SnackBars with ToastLogger for notifications

This commit is contained in:
Janez T
2025-10-15 20:15:13 +02:00
parent f5a6e1f9ab
commit 2849ab92aa
4 changed files with 63 additions and 61 deletions

View File

@@ -116,7 +116,7 @@ class Message {
return '${diff.inDays}d ago';
}
/// Get display name for sender
/// Get display name for sender (basic fallback without contact info)
String get displaySender {
if (senderName != null && senderName!.isNotEmpty) {
return senderName!;
@@ -130,6 +130,21 @@ class Message {
return 'Unknown';
}
/// Get rich display name for sender using contact information
/// Returns emoji + display name if available, otherwise falls back to displaySender
String getRichDisplayName(dynamic contact) {
if (contact == null) return displaySender;
// If contact has roleEmoji, use it with displayName
final roleEmoji = contact.roleEmoji;
if (roleEmoji != null && roleEmoji.isNotEmpty) {
return '$roleEmoji ${contact.displayName}';
}
// Otherwise just use advName or displayName
return contact.displayName ?? contact.advName ?? displaySender;
}
/// Convert to SAR marker if applicable
SarMarker? toSarMarker() {
if (!isSarMarker || sarMarkerType == null || sarGpsCoordinates == null) {