Fix read receipts and improve UI

- Changed back to bold blue double checkmarks for read status
- Send read receipts for both 'sent' and 'delivered' status messages
- Added onChange handler to send read receipts whenever switching to a private chat
- Made markPrivateMessagesAsRead public so it can be called from views
- This ensures read receipts are sent when opening a chat from notifications or any other way
This commit is contained in:
jack
2025-07-06 22:37:59 +02:00
parent c72c4949ff
commit fbe779e684
2 changed files with 14 additions and 6 deletions
+11 -3
View File
@@ -528,6 +528,12 @@ struct ContentView: View {
}
}
}
.onChange(of: viewModel.selectedPrivateChatPeer) { newPeerID in
// When switching to a private chat, send read receipts
if let peerID = newPeerID {
viewModel.markPrivateMessagesAsRead(from: peerID)
}
}
}
}
@@ -1111,10 +1117,12 @@ struct DeliveryStatusView: View {
case .read(let nickname, _):
HStack(spacing: -2) {
Image(systemName: "checkmark.circle.fill")
.font(.system(size: 12, weight: .bold))
.foregroundColor(Color(red: 0.0, green: 0.478, blue: 1.0)) // Bright blue
Image(systemName: "checkmark")
.font(.system(size: 10, weight: .bold))
Image(systemName: "checkmark")
.font(.system(size: 10, weight: .bold))
}
.foregroundColor(Color(red: 0.0, green: 0.478, blue: 1.0)) // Bright blue
.help("Read by \(nickname)")
.onAppear {
print("[UI] Showing BLUE checkmarks for read status by \(nickname)")