fix ios notifications

This commit is contained in:
Salvatore Giordano
2020-03-31 13:03:53 +02:00
parent 8cbf0b2f27
commit f25d1cba3d
3 changed files with 304 additions and 6 deletions
@@ -23,17 +23,17 @@ class NotificationService: UNNotificationServiceExtension {
contentHandler(bestAttemptContent ?? request.content)
}
let apiKey = "s2dxdhpxd94g";
let apiKey = "s2dxdhpxd94g";
let userId = "user1"
let token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidXNlcjEifQ.NGZPyPMx7KSVisJmh4tJhOIv7ZjCaMQpOh4gTINvCaU"
let messageId = bestAttemptContent?.userInfo["message_id"] as! String
print("REQUEST CONTENT \(messageId)")
Client.config = .init(apiKey: apiKey, logOptions: .info)
Client.shared.set(user: User(id: userId, name: ""), token: token)
Client.shared.message(with: messageId).subscribe {res in
Client.shared.message(with: messageId).subscribe { res in
print(res)
Client.shared.disconnect()
}
@@ -43,6 +43,7 @@ class NotificationService: UNNotificationServiceExtension {
}
override func serviceExtensionTimeWillExpire() {
print("serviceExtensionTimeWillExpire")
// Called just before the extension will be terminated by the system.
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {