@@ -308,37 +308,13 @@ void finishProcessingNotification(UNNotification *notification,
308
308
completionHandler (completionHandlerOptions);
309
309
}
310
310
311
- // Apple's docs - Called to let your app know which action was selected by the user for a given notification.
312
- - (void )onesignalUserNotificationCenter : (UNUserNotificationCenter *)center
313
- didReceiveNotificationResponse : (UNNotificationResponse *)response
314
- withCompletionHandler : (void (^)(void ))completionHandler {
315
- [OneSignalNotificationsUNUserNotificationCenter traceCall: @" onesignalUserNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:" ];
316
- // return if the user has not granted privacy permissions or if not a OneSignal payload
317
- if ([OSPrivacyConsentController shouldLogMissingPrivacyConsentErrorWithMethodName: nil ] || ![OneSignalCoreHelper isOneSignalPayload: response.notification.request.content.userInfo]) {
318
- SwizzlingForwarder *forwarder = [[SwizzlingForwarder alloc ]
319
- initWithTarget: self
320
- withYourSelector: @selector (
321
- onesignalUserNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:
322
- )
323
- withOriginalSelector: @selector (
324
- userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:
325
- )
326
- ];
327
- if (forwarder.hasReceiver ) {
328
- [forwarder invokeWithArgs: @[center, response, completionHandler]];
329
- } else {
330
- completionHandler ();
331
- }
332
- return ;
333
- }
334
-
335
- [OneSignalLog onesignalLog: ONE_S_LL_VERBOSE message: @" onesignalUserNotificationCenter:didReceiveNotificationResponse:withCompletionHandler: Fired!" ];
336
-
337
- [OneSignalNotificationsUNUserNotificationCenter processiOS10Open: response];
338
-
339
- // Call orginal selector if one was set.
311
+ + (void )forwardReceivedNotificationResponseWithCenter : (UNUserNotificationCenter *)center
312
+ didReceiveNotificationResponse : (UNNotificationResponse *)response
313
+ OneSignalCenter : (id )instance
314
+ withCompletionHandler : (void (^)(void ))completionHandler {
315
+ // Call original selector if one was set.
340
316
SwizzlingForwarder *forwarder = [[SwizzlingForwarder alloc ]
341
- initWithTarget: self
317
+ initWithTarget: instance
342
318
withYourSelector: @selector (
343
319
onesignalUserNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:
344
320
)
@@ -365,6 +341,21 @@ - (void)onesignalUserNotificationCenter:(UNUserNotificationCenter *)center
365
341
completionHandler ();
366
342
}
367
343
344
+ // Apple's docs - Called to let your app know which action was selected by the user for a given notification.
345
+ - (void )onesignalUserNotificationCenter : (UNUserNotificationCenter *)center
346
+ didReceiveNotificationResponse : (UNNotificationResponse *)response
347
+ withCompletionHandler : (void (^)(void ))completionHandler {
348
+ [OneSignalNotificationsUNUserNotificationCenter traceCall: @" onesignalUserNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:" ];
349
+
350
+ if (![OSPrivacyConsentController shouldLogMissingPrivacyConsentErrorWithMethodName: nil ] && [OneSignalCoreHelper isOneSignalPayload: response.notification.request.content.userInfo]) {
351
+ [OneSignalLog onesignalLog: ONE_S_LL_VERBOSE message: @" onesignalUserNotificationCenter:didReceiveNotificationResponse:withCompletionHandler: Fired!" ];
352
+
353
+ [OneSignalNotificationsUNUserNotificationCenter processiOS10Open: response];
354
+ }
355
+
356
+ [OneSignalNotificationsUNUserNotificationCenter forwardReceivedNotificationResponseWithCenter: center didReceiveNotificationResponse: response OneSignalCenter: self withCompletionHandler: completionHandler];
357
+ }
358
+
368
359
+ (BOOL )isDismissEvent : (UNNotificationResponse *)response {
369
360
return [@" com.apple.UNNotificationDismissActionIdentifier" isEqual: response.actionIdentifier];
370
361
}
0 commit comments