mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 10:25:18 +00:00
Update NotificationService to use Peer
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ final class PrivateChatManager: ObservableObject {
|
||||
NotificationService.shared.sendPrivateMessageNotification(
|
||||
from: message.sender,
|
||||
message: message.content,
|
||||
peerID: senderPeerID
|
||||
peer: Peer(str: senderPeerID)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user