mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 09:25:19 +00:00
Fix READ receipt status not updating to blue checks
- Add findMessageIndex helper to handle peer ID format mismatch (short 16-hex vs long 64-hex noise key) - Prevent DELIVERED acks from downgrading .read status back to .delivered (fixes race condition where late-arriving delivery acks overwrote read status) - Use incoming peerID for READ receipts instead of creating new ID from noise key - Explicitly re-assign messages array to trigger @Published setter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -740,15 +740,11 @@ extension ChatViewModel {
|
||||
|
||||
if isViewing {
|
||||
// Mark read immediately if viewing
|
||||
// Use router to send read receipt
|
||||
// Use the incoming peerID directly - it has the established Noise session.
|
||||
// Don't use PeerID(hexData: noiseKey) as that creates a 64-hex ID without a session.
|
||||
// Use meshService directly (not messageRouter) so it queues if peer disconnects.
|
||||
let receipt = ReadReceipt(originalMessageID: message.id, readerID: meshService.myPeerID, readerNickname: nickname)
|
||||
if let key = noiseKey {
|
||||
// Send via router to stable key if available (preferred for persistence/Nostr fallback)
|
||||
messageRouter.sendReadReceipt(receipt, to: PeerID(hexData: key))
|
||||
} else {
|
||||
// Fallback to mesh direct
|
||||
meshService.sendReadReceipt(receipt, to: peerID)
|
||||
}
|
||||
meshService.sendReadReceipt(receipt, to: peerID)
|
||||
sentReadReceipts.insert(message.id)
|
||||
} else {
|
||||
// Notify
|
||||
|
||||
Reference in New Issue
Block a user