Improve private message notification behavior

- Don't show PM notifications when the private chat is already open
- Store peer ID in notification userInfo for reliable chat opening
- Tap notification to open the correct private chat using peer ID
- Check both in ChatViewModel (when receiving) and NotificationDelegate (when presenting)
This commit is contained in:
jack
2025-07-24 12:00:01 +02:00
parent b0204afa75
commit c4ca38654d
3 changed files with 32 additions and 13 deletions
+4 -1
View File
@@ -1968,7 +1968,10 @@ extension ChatViewModel: BitchatDelegate {
if isMentioned && message.sender != nickname {
NotificationService.shared.sendMentionNotification(from: message.sender, message: message.content)
} else if message.isPrivate && message.sender != nickname {
NotificationService.shared.sendPrivateMessageNotification(from: message.sender, message: message.content)
// Only send notification if the private chat is not currently open
if selectedPrivateChatPeer != message.senderPeerID {
NotificationService.shared.sendPrivateMessageNotification(from: message.sender, message: message.content, peerID: message.senderPeerID ?? "")
}
}
#if os(iOS)