diff --git a/iOS_SDK/OneSignalSDK/OneSignalExtension/OneSignalExtension.h b/iOS_SDK/OneSignalSDK/OneSignalExtension/OneSignalExtension.h index 4deaeda8d..743c9947d 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalExtension/OneSignalExtension.h +++ b/iOS_SDK/OneSignalSDK/OneSignalExtension/OneSignalExtension.h @@ -37,6 +37,7 @@ #pragma clang diagnostic ignored "-Wnullability-completeness" // Call from a UNNotificationServiceExtension on iOS 10 and later. // Processes media attachments and action buttons. ++ (UNMutableNotificationContent*)didReceiveNotificationExtensionRequest:(UNNotificationRequest* _Nonnull)request withMutableNotificationContent:(UNMutableNotificationContent* _Nullable)replacementContent __deprecated_msg("Please use didReceiveNotificationExtensionRequest:withMutableNotificationContent:withContentHandler: instead."); + (UNMutableNotificationContent*)didReceiveNotificationExtensionRequest:(UNNotificationRequest* _Nonnull)request withMutableNotificationContent:(UNMutableNotificationContent* _Nullable)replacementContent withContentHandler:(void (^)(UNNotificationContent *_Nonnull))contentHandler; + (UNMutableNotificationContent*)serviceExtensionTimeWillExpireRequest:(UNNotificationRequest* _Nonnull)request withMutableNotificationContent:(UNMutableNotificationContent* _Nullable)replacementContent; @end diff --git a/iOS_SDK/OneSignalSDK/OneSignalExtension/OneSignalExtension.m b/iOS_SDK/OneSignalSDK/OneSignalExtension/OneSignalExtension.m index b60b15475..a0cb3f64b 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalExtension/OneSignalExtension.m +++ b/iOS_SDK/OneSignalSDK/OneSignalExtension/OneSignalExtension.m @@ -30,6 +30,13 @@ of this software and associated documentation files (the "Software"), to deal @implementation OneSignalExtension +// Called from the app's Notification Service Extension ++ (UNMutableNotificationContent*)didReceiveNotificationExtensionRequest:(UNNotificationRequest*)request withMutableNotificationContent:(UNMutableNotificationContent*)replacementContent { + return [OneSignalNotificationServiceExtensionHandler + didReceiveNotificationExtensionRequest:request + withMutableNotificationContent:replacementContent]; +} + // Called from the app's Notification Service Extension. Calls contentHandler() to display the notification + (UNMutableNotificationContent*)didReceiveNotificationExtensionRequest:(UNNotificationRequest*)request withMutableNotificationContent:(UNMutableNotificationContent*)replacementContent withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler { diff --git a/iOS_SDK/OneSignalSDK/Source/OneSignal.m b/iOS_SDK/OneSignalSDK/Source/OneSignal.m index bfdcfbfb8..1ce666fd0 100755 --- a/iOS_SDK/OneSignalSDK/Source/OneSignal.m +++ b/iOS_SDK/OneSignalSDK/Source/OneSignal.m @@ -835,6 +835,13 @@ + (void)launchWebURL:(NSString*)openUrl { } +// Called from the app's Notification Service Extension ++ (UNMutableNotificationContent*)didReceiveNotificationExtensionRequest:(UNNotificationRequest*)request withMutableNotificationContent:(UNMutableNotificationContent*)replacementContent { + return [OneSignalNotificationServiceExtensionHandler + didReceiveNotificationExtensionRequest:request + withMutableNotificationContent:replacementContent]; +} + // Called from the app's Notification Service Extension. Calls contentHandler() to display the notification + (UNMutableNotificationContent*)didReceiveNotificationExtensionRequest:(UNNotificationRequest*)request withMutableNotificationContent:(UNMutableNotificationContent*)replacementContent withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler { diff --git a/iOS_SDK/OneSignalSDK/Source/OneSignalFramework.h b/iOS_SDK/OneSignalSDK/Source/OneSignalFramework.h index b5722d12b..4fc3ce899 100755 --- a/iOS_SDK/OneSignalSDK/Source/OneSignalFramework.h +++ b/iOS_SDK/OneSignalSDK/Source/OneSignalFramework.h @@ -106,6 +106,7 @@ NS_SWIFT_NAME(login(externalId:token:)); #pragma mark Extension // Call from a UNNotificationServiceExtension on iOS 10 and later. // Processes media attachments and action buttons. ++ (UNMutableNotificationContent*)didReceiveNotificationExtensionRequest:(UNNotificationRequest* _Nonnull)request withMutableNotificationContent:(UNMutableNotificationContent* _Nullable)replacementContent __deprecated_msg("Please use didReceiveNotificationExtensionRequest:withMutableNotificationContent:withContentHandler: instead."); + (UNMutableNotificationContent*)didReceiveNotificationExtensionRequest:(UNNotificationRequest* _Nonnull)request withMutableNotificationContent:(UNMutableNotificationContent* _Nullable)replacementContent withContentHandler:(void (^)(UNNotificationContent *_Nonnull))contentHandler; + (UNMutableNotificationContent*)serviceExtensionTimeWillExpireRequest:(UNNotificationRequest* _Nonnull)request withMutableNotificationContent:(UNMutableNotificationContent* _Nullable)replacementContent; @end