Skip to content

Commit

Permalink
Merge pull request #924 from OneSignal/fix/pre-existing_notification_…
Browse files Browse the repository at this point in the history
…delegate

Fixed Pre-existing Notification Delegate
  • Loading branch information
jkasten2 committed May 14, 2021
2 parents df4aab8 + d6bc8ce commit 1bf1d7b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions iOS_SDK/OneSignalSDK/Source/OneSignalHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,14 @@ + (void)registerAsUNNotificationCenterDelegate {

if (!curNotifCenter.delegate)
curNotifCenter.delegate = (id)[self sharedInstance];
else {
/*
This handles the existing delegate that exist before the OneSignal delegate is loaded.
This line ends up calling the UNUserNotificationCenter+OneSignal.m file method setOneSignalUNDelegate.
This swizzles in the OneSignal methods into the existing non-OneSignal delegate.
*/
curNotifCenter.delegate = curNotifCenter.delegate;
}
}

+(UNNotificationRequest*)prepareUNNotificationRequest:(OSNotificationPayload*)payload {
Expand Down

0 comments on commit 1bf1d7b

Please sign in to comment.