Fix notification service

This commit is contained in:
Ali
2021-10-26 14:18:27 +04:00
parent 8fdc7a8e1e
commit a7e59cecf4
4 changed files with 115 additions and 36 deletions

View File

@@ -2277,6 +2277,8 @@ private func notificationPayloadKey(data: Data) -> Data? {
private func accountIdFromNotification(_ notification: UNNotification, sharedContext: Signal<SharedApplicationContext, NoError>) -> Signal<AccountRecordId?, NoError> {
if let id = notification.request.content.userInfo["accountId"] as? Int64 {
return .single(AccountRecordId(rawValue: id))
} else if let idString = notification.request.content.userInfo["accountId"] as? String, let id = Int64(idString) {
return .single(AccountRecordId(rawValue: id))
} else {
var encryptedData: Data?
if var encryptedPayload = notification.request.content.userInfo["p"] as? String {
@@ -2336,6 +2338,8 @@ private func accountIdFromNotification(_ notification: UNNotification, sharedCon
private func peerIdFromNotification(_ notification: UNNotification) -> PeerId? {
if let peerId = notification.request.content.userInfo["peerId"] as? Int64 {
return PeerId(peerId)
} else if let peerIdString = notification.request.content.userInfo["peerId"] as? String, let peerId = Int64(peerIdString) {
return PeerId(peerId)
} else {
let payload = notification.request.content.userInfo
var peerId: PeerId?