diff --git a/bitchat/Services/NotificationService.swift b/bitchat/Services/NotificationService.swift index 595c85db..ad827d72 100644 --- a/bitchat/Services/NotificationService.swift +++ b/bitchat/Services/NotificationService.swift @@ -61,11 +61,11 @@ final class NotificationService { sendLocalNotification(title: title, body: body, identifier: identifier) } - func sendPrivateMessageNotification(from sender: String, message: String, peerID: String) { + func sendPrivateMessageNotification(from sender: String, message: String, peer: Peer) { let title = "🔒 DM from \(sender)" let body = message let identifier = "private-\(UUID().uuidString)" - let userInfo = ["peerID": peerID, "senderName": sender] + let userInfo = ["peerID": peer.id, "senderName": sender] sendLocalNotification(title: title, body: body, identifier: identifier, userInfo: userInfo) } diff --git a/bitchat/Services/PrivateChatManager.swift b/bitchat/Services/PrivateChatManager.swift index 278f851d..7ed12bd4 100644 --- a/bitchat/Services/PrivateChatManager.swift +++ b/bitchat/Services/PrivateChatManager.swift @@ -126,7 +126,7 @@ final class PrivateChatManager: ObservableObject { NotificationService.shared.sendPrivateMessageNotification( from: message.sender, message: message.content, - peerID: senderPeerID + peer: Peer(str: senderPeerID) ) } } else { diff --git a/bitchat/ViewModels/ChatViewModel.swift b/bitchat/ViewModels/ChatViewModel.swift index 48d91f87..90169b0d 100644 --- a/bitchat/ViewModels/ChatViewModel.swift +++ b/bitchat/ViewModels/ChatViewModel.swift @@ -1096,7 +1096,7 @@ final class ChatViewModel: ObservableObject, BitchatDelegate { NotificationService.shared.sendPrivateMessageNotification( from: senderName, message: pm.content, - peerID: convKey + peer: Peer(str: convKey) ) } } @@ -1850,7 +1850,7 @@ final class ChatViewModel: ObservableObject, BitchatDelegate { NotificationService.shared.sendPrivateMessageNotification( from: senderName, message: pm.content, - peerID: convKey + peer: Peer(str: convKey) ) } @@ -5366,7 +5366,7 @@ final class ChatViewModel: ObservableObject, BitchatDelegate { NotificationService.shared.sendPrivateMessageNotification( from: senderNickname, message: messageContent, - peerID: targetPeerID + peer: Peer(str: targetPeerID) ) } } @@ -5598,7 +5598,7 @@ final class ChatViewModel: ObservableObject, BitchatDelegate { NotificationService.shared.sendPrivateMessageNotification( from: finalSenderNickname, message: content, - peerID: tempPeerID + peer: Peer(str: tempPeerID) ) } else { // Not notifying for old message @@ -5932,7 +5932,7 @@ final class ChatViewModel: ObservableObject, BitchatDelegate { NotificationService.shared.sendPrivateMessageNotification( from: message.sender, message: message.content, - peerID: peerID + peer: Peer(str: peerID) ) } } else {