Fix read receipts using wrong peer ID

- Read receipts were being sent to the current ephemeral peer ID instead of the message's senderPeerID
- This caused read receipts to be lost when peer IDs changed between sessions
- Now using message.senderPeerID consistently for all read receipt sending
- Added detailed logging to track which peer ID receives the read receipt
This commit is contained in:
jack
2025-07-06 22:30:33 +02:00
parent ab5af1546d
commit 1fec1ee315
2 changed files with 37 additions and 20 deletions
@@ -708,6 +708,7 @@ class BluetoothMeshService: NSObject {
}
func sendReadReceipt(_ receipt: ReadReceipt, to recipientID: String) {
print("[DeliveryTracker] Sending read receipt for message \(receipt.originalMessageID) to \(recipientID)")
messageQueue.async { [weak self] in
guard let self = self else { return }
@@ -737,6 +738,7 @@ class BluetoothMeshService: NSObject {
ttl: 3 // Limited TTL for receipts
)
print("[DeliveryTracker] Broadcasting read receipt packet to \(recipientID)")
// Send immediately without delay
self.broadcastPacket(packet)
}