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,
|
guard let encodedPayload = bestAttemptContent.userInfo["m"] as? String,
|
||||||
let payload = Data(base64Encoded: encodedPayload.URLSafeBase64ToBase64()) else {
|
let payload = Data(base64Encoded: encodedPayload.URLSafeBase64ToBase64()) else {
|
||||||
|
bestAttemptContent.title = "Failied to decode payload as base 64"
|
||||||
contentHandler(bestAttemptContent)
|
contentHandler(bestAttemptContent)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -28,12 +29,14 @@ class NotificationService: UNNotificationServiceExtension {
|
||||||
guard let encodedPublicKey = bestAttemptContent.userInfo["k"] as? String,
|
guard let encodedPublicKey = bestAttemptContent.userInfo["k"] as? String,
|
||||||
let publicKeyData = Data(base64Encoded: encodedPublicKey.URLSafeBase64ToBase64()),
|
let publicKeyData = Data(base64Encoded: encodedPublicKey.URLSafeBase64ToBase64()),
|
||||||
let publicKey = try? P256.KeyAgreement.PublicKey(x963Representation: publicKeyData) else {
|
let publicKey = try? P256.KeyAgreement.PublicKey(x963Representation: publicKeyData) else {
|
||||||
|
bestAttemptContent.title = "Failied to inflate public key"
|
||||||
contentHandler(bestAttemptContent)
|
contentHandler(bestAttemptContent)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let encodedSalt = bestAttemptContent.userInfo["s"] as? String,
|
guard let encodedSalt = bestAttemptContent.userInfo["s"] as? String,
|
||||||
let salt = Data(base64Encoded: encodedSalt.URLSafeBase64ToBase64()) else {
|
let salt = Data(base64Encoded: encodedSalt.URLSafeBase64ToBase64()) else {
|
||||||
|
bestAttemptContent.title = "Failied to inflate salt"
|
||||||
contentHandler(bestAttemptContent)
|
contentHandler(bestAttemptContent)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -44,6 +47,7 @@ class NotificationService: UNNotificationServiceExtension {
|
||||||
privateKey: privateKey,
|
privateKey: privateKey,
|
||||||
publicKey: publicKey),
|
publicKey: publicKey),
|
||||||
let notification = try? JSONDecoder().decode(MastodonPushNotification.self, from: plaintextData) else {
|
let notification = try? JSONDecoder().decode(MastodonPushNotification.self, from: plaintextData) else {
|
||||||
|
bestAttemptContent.title = "Failied to JSON decode the Notification"
|
||||||
contentHandler(bestAttemptContent)
|
contentHandler(bestAttemptContent)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue