add ios notification example

This commit is contained in:
Salvatore Giordano
2020-03-27 11:07:32 +01:00
parent 1de4fa37a8
commit 24e32f891e
6 changed files with 46 additions and 40 deletions
@@ -19,16 +19,14 @@ class NotificationService: UNNotificationServiceExtension {
defer {
contentHandler(bestAttemptContent ?? request.content)
}
print("DID RECEIVE NOTIFICATION")
// Modify the notification content here...
bestAttemptContent?.title = "\(bestAttemptContent?.title ?? "<NoContent>") [modified]"
// Modify the notification content here...
bestAttemptContent?.title = "[modified] \(bestAttemptContent?.title ?? "<NoContent>")"
}
override func 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 {
bestAttemptContent.title = "\(bestAttemptContent.title) [modified]"
contentHandler(bestAttemptContent)
}
}
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
</dict>
<dict/>
</plist>