From 58876704c33d4e139f06571db9c2baee849a56ac Mon Sep 17 00:00:00 2001 From: jack Date: Thu, 24 Jul 2025 13:18:12 +0200 Subject: [PATCH] Bold user's own nickname in chat messages - Added font weight logic to formatMessageAsText and formatMessage - User's own @nickname appears bold (weight: .bold) - Other nicknames remain medium weight - Helps visually distinguish own messages from others --- bitchat/ViewModels/ChatViewModel.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bitchat/ViewModels/ChatViewModel.swift b/bitchat/ViewModels/ChatViewModel.swift index aa1e6611..68f5ab0c 100644 --- a/bitchat/ViewModels/ChatViewModel.swift +++ b/bitchat/ViewModels/ChatViewModel.swift @@ -983,7 +983,9 @@ class ChatViewModel: ObservableObject { // Use consistent color for all senders senderStyle.foregroundColor = primaryColor - senderStyle.font = .system(size: 14, weight: .medium, design: .monospaced) + // Bold the user's own nickname + let fontWeight: Font.Weight = message.sender == nickname ? .bold : .medium + senderStyle.font = .system(size: 14, weight: fontWeight, design: .monospaced) result.append(sender.mergingAttributes(senderStyle)) // Process content with hashtags and mentions @@ -1104,7 +1106,9 @@ class ChatViewModel: ObservableObject { // Use consistent color for all senders senderStyle.foregroundColor = primaryColor - senderStyle.font = .system(size: 12, weight: .medium, design: .monospaced) + // Bold the user's own nickname + let fontWeight: Font.Weight = message.sender == nickname ? .bold : .medium + senderStyle.font = .system(size: 12, weight: fontWeight, design: .monospaced) result.append(sender.mergingAttributes(senderStyle))