mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-25 17:51:01 +00:00
Debug code for push
This commit is contained in:
parent
1d8fa7902e
commit
f1219d319b
1 changed files with 4 additions and 0 deletions
|
@ -21,6 +21,7 @@ class NotificationService: UNNotificationServiceExtension {
|
|||
|
||||
guard let encodedPayload = bestAttemptContent.userInfo["m"] as? String,
|
||||
let payload = Data(base64Encoded: encodedPayload.URLSafeBase64ToBase64()) else {
|
||||
bestAttemptContent.title = "Failied to decode payload as base 64"
|
||||
contentHandler(bestAttemptContent)
|
||||
return
|
||||
}
|
||||
|
@ -28,12 +29,14 @@ class NotificationService: UNNotificationServiceExtension {
|
|||
guard let encodedPublicKey = bestAttemptContent.userInfo["k"] as? String,
|
||||
let publicKeyData = Data(base64Encoded: encodedPublicKey.URLSafeBase64ToBase64()),
|
||||
let publicKey = try? P256.KeyAgreement.PublicKey(x963Representation: publicKeyData) else {
|
||||
bestAttemptContent.title = "Failied to inflate public key"
|
||||
contentHandler(bestAttemptContent)
|
||||
return
|
||||
}
|
||||
|
||||
guard let encodedSalt = bestAttemptContent.userInfo["s"] as? String,
|
||||
let salt = Data(base64Encoded: encodedSalt.URLSafeBase64ToBase64()) else {
|
||||
bestAttemptContent.title = "Failied to inflate salt"
|
||||
contentHandler(bestAttemptContent)
|
||||
return
|
||||
}
|
||||
|
@ -44,6 +47,7 @@ class NotificationService: UNNotificationServiceExtension {
|
|||
privateKey: privateKey,
|
||||
publicKey: publicKey),
|
||||
let notification = try? JSONDecoder().decode(MastodonPushNotification.self, from: plaintextData) else {
|
||||
bestAttemptContent.title = "Failied to JSON decode the Notification"
|
||||
contentHandler(bestAttemptContent)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue