Fallback for listing sender names.
Sender names now show up if they are in your contacts, even if they do not have List Number enabled. If their name can not be obtained then it will show "Unknown#0000" rather than just the nanochat number. (cherry picked from commit 90775680d8b7b2d95636dd1027e56d48118e55e1)
This commit is contained in:
parent
fc558e41ea
commit
19722eeec7
|
|
@ -563,24 +563,24 @@ public sealed partial class NanoChatUiFragment : BoxContainer
|
|||
string? senderName = null;
|
||||
if (isGroupChat && !isOwnMessage)
|
||||
{
|
||||
// Try to get sender name from contacts first, then recipients
|
||||
if (_contacts != null)
|
||||
// Funky Station - Try to get sender name from contacts first, then recipients
|
||||
if (_recipients.TryGetValue(message.SenderId, out var senderRecipient))
|
||||
{
|
||||
senderName = senderRecipient.Name;
|
||||
}
|
||||
|
||||
// If not in recipients, try contacts list (station-wide directory)
|
||||
if (senderName == null && _contacts != null)
|
||||
{
|
||||
var contact = _contacts.FirstOrDefault(c => c.Number == message.SenderId);
|
||||
if (contact.Number != 0)
|
||||
senderName = contact.Name;
|
||||
}
|
||||
|
||||
// If not found in contacts, try recipients
|
||||
if (senderName == null && _recipients.TryGetValue(message.SenderId, out var senderRecipient))
|
||||
{
|
||||
senderName = senderRecipient.Name;
|
||||
}
|
||||
|
||||
// Fallback to number if name not found
|
||||
// Fallback to "Unknown" with number if name not found
|
||||
if (senderName == null)
|
||||
{
|
||||
senderName = $"#{message.SenderId:D4}";
|
||||
senderName = $"{Loc.GetString("nano-chat-unknown-sender")}#{message.SenderId:D4}"; // Funky Station
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,3 +36,4 @@ nano-chat-emoji-search = Search emojis...
|
|||
|
||||
# Department sorting
|
||||
nano-chat-other-department = Other
|
||||
nano-chat-unknown-sender = Unknown
|
||||
|
|
|
|||
Loading…
Reference in New Issue