diff --git a/ios/App/App/App.entitlements b/ios/App/App/App.entitlements index 989031d..5cf2ff0 100644 --- a/ios/App/App/App.entitlements +++ b/ios/App/App/App.entitlements @@ -2,6 +2,8 @@ + aps-environment + development com.apple.security.application-groups group.com.wrenchboard.users.onesignal diff --git a/ios/App/App/AppDelegate.swift b/ios/App/App/AppDelegate.swift index c3cd83b..5cf254c 100644 --- a/ios/App/App/AppDelegate.swift +++ b/ios/App/App/AppDelegate.swift @@ -1,5 +1,6 @@ import UIKit import Capacitor +import OneSignalFramework @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { @@ -7,8 +8,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - // Override point for customization after application launch. - return true + + return true } func applicationWillResignActive(_ application: UIApplication) { diff --git a/ios/App/OneSignalNotificationServiceExtension/NotificationService.swift b/ios/App/OneSignalNotificationServiceExtension/NotificationService.swift index a493754..9d61183 100644 --- a/ios/App/OneSignalNotificationServiceExtension/NotificationService.swift +++ b/ios/App/OneSignalNotificationServiceExtension/NotificationService.swift @@ -17,8 +17,8 @@ class NotificationService: UNNotificationServiceExtension { /* DEBUGGING: Uncomment the 2 lines below to check this extension is executing Note, this extension only runs when mutable-content is set Setting an attachment or action buttons automatically adds this */ - // print("Running NotificationServiceExtension") - // bestAttemptContent.body = "[Modified] " + bestAttemptContent.body + print("Running NotificationServiceExtension") + bestAttemptContent.body = "[Modified] " + bestAttemptContent.body OneSignalExtension.didReceiveNotificationExtensionRequest(self.receivedRequest, with: bestAttemptContent, withContentHandler: self.contentHandler) } diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 9dddaba..8eb80e4 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -22,12 +22,18 @@ export class AppComponent { // NOTE: Update the init value below with your OneSignal AppId. OneSignal.init("13755f98-ec69-45fd-a2f1-d2166afcaa51"); - let myClickListener = async function(event) { - let notificationData = JSON.stringify(event); - }; + let notificationData = JSON.stringify(event); + alert(notificationData); + console.log('notificationOpenedCallback: ' + JSON.stringify(notificationData)); + + }; OneSignal.Notifications.addEventListener("click", myClickListener); + /* OneSignal.Notifications.setNotificationOpenedHandler(function(opened) { + let notificationData = JSON.stringify(opened); + console.log('notificationOpenedCallback: ' + notificationData); + }); //*/ // Prompts the user for notification permissions. // * Since this shows a generic native prompt, we recommend instead using an In-App Message to prompt for notification permission (See step 7) to better communicate to your users what notifications they will get.