Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions ios/NotifeeCore/NotifeeCore+NSNotificationCenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,18 @@ + (void)load {
#pragma mark Application Notifications

- (void)application_onDidFinishLaunchingNotification:(nonnull NSNotification *)notification {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
UILocalNotification *launchNotification =
(UILocalNotification *)notification.userInfo[UIApplicationLaunchOptionsLocalNotificationKey];
[[NotifeeCoreUNUserNotificationCenter instance]
onDidFinishLaunchingNotification:launchNotification.userInfo];
[[NotifeeCoreUNUserNotificationCenter instance] getInitialNotification];
NSDictionary *notifUserInfo =
notification.userInfo[UIApplicationLaunchOptionsLocalNotificationKey];

if (!notifUserInfo) {
// Fallback to remote notification key if local notification key is not available
notifUserInfo = notification.userInfo[UIApplicationLaunchOptionsRemoteNotificationKey];
}

if (notifUserInfo) {
[[NotifeeCoreUNUserNotificationCenter instance] onDidFinishLaunchingNotification:notifUserInfo];
[[NotifeeCoreUNUserNotificationCenter instance] getInitialNotification];
}

[[NotifeeCoreUNUserNotificationCenter instance] observe];
}
Expand Down
15 changes: 3 additions & 12 deletions ios/NotifeeCore/NotifeeCore+UNUserNotificationCenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#import "NotifeeCoreUtil.h"

@implementation NotifeeCoreUNUserNotificationCenter

struct {
unsigned int willPresentNotification : 1;
unsigned int didReceiveNotificationResponse : 1;
Expand Down Expand Up @@ -104,7 +103,6 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center
NSDictionary *notifeeNotification =
notification.request.content.userInfo[kNotifeeUserInfoNotification];

// we only care about notifications created through notifee
if (notifeeNotification != nil) {
UNNotificationPresentationOptions presentationOptions = UNNotificationPresentationOptionNone;
NSDictionary *foregroundPresentationOptions =
Expand Down Expand Up @@ -148,23 +146,16 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center
presentationOptions |= UNNotificationPresentationOptionAlert;
}

NSDictionary *notifeeTrigger = notification.request.content.userInfo[kNotifeeUserInfoTrigger];
if (notifeeTrigger != nil) {
// post DELIVERED event
[[NotifeeCoreDelegateHolder instance] didReceiveNotifeeCoreEvent:@{
// post DELIVERED event
[[NotifeeCoreDelegateHolder instance] didReceiveNotifeeCoreEvent:@{
@"type" : @(NotifeeCoreEventTypeDelivered),
@"detail" : @{
@"notification" : notifeeNotification,
}
}];
}
}];

completionHandler(presentationOptions);

} else if (_originalDelegate != nil && originalUNCDelegateRespondsTo.willPresentNotification) {
[_originalDelegate userNotificationCenter:center
willPresentNotification:notification
withCompletionHandler:completionHandler];
}
}

Expand Down