Commit 641ff31a by wezzle Committed by Sebastián Katzer

Save delegate and proxy calls to previous delegate (#1514)

parent 689f47b9
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
@interface APPLocalNotification () @interface APPLocalNotification ()
@property (strong, nonatomic) UNUserNotificationCenter* center; @property (strong, nonatomic) UNUserNotificationCenter* center;
@property (NS_NONATOMIC_IOSONLY, nullable, weak) id <UNUserNotificationCenterDelegate> delegate;
@property (readwrite, assign) BOOL deviceready; @property (readwrite, assign) BOOL deviceready;
@property (readwrite, assign) BOOL isActive; @property (readwrite, assign) BOOL isActive;
@property (readonly, nonatomic, retain) NSArray* launchDetails; @property (readonly, nonatomic, retain) NSArray* launchDetails;
...@@ -506,8 +507,10 @@ ...@@ -506,8 +507,10 @@
{ {
UNNotificationRequest* toast = notification.request; UNNotificationRequest* toast = notification.request;
if ([toast.trigger isKindOfClass:UNPushNotificationTrigger.class]) if ([toast.trigger isKindOfClass:UNPushNotificationTrigger.class]) {
[_delegate userNotificationCenter:center willPresentNotification:notification withCompletionHandler:completionHandler];
return; return;
}
APPNotificationOptions* options = toast.options; APPNotificationOptions* options = toast.options;
...@@ -536,8 +539,10 @@ ...@@ -536,8 +539,10 @@
completionHandler(); completionHandler();
if ([toast.trigger isKindOfClass:UNPushNotificationTrigger.class]) if ([toast.trigger isKindOfClass:UNPushNotificationTrigger.class]) {
[_delegate userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
return; return;
}
NSMutableDictionary* data = [[NSMutableDictionary alloc] init]; NSMutableDictionary* data = [[NSMutableDictionary alloc] init];
NSString* action = response.actionIdentifier; NSString* action = response.actionIdentifier;
...@@ -577,6 +582,7 @@ ...@@ -577,6 +582,7 @@
eventQueue = [[NSMutableArray alloc] init]; eventQueue = [[NSMutableArray alloc] init];
_center = [UNUserNotificationCenter currentNotificationCenter]; _center = [UNUserNotificationCenter currentNotificationCenter];
_delegate = _center.delegate;
_center.delegate = self; _center.delegate = self;
[_center registerGeneralNotificationCategory]; [_center registerGeneralNotificationCategory];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment