mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
feat: Enhance message display with rich sender names and replace SnackBars with ToastLogger for notifications
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user