RNNotificationCenterListener.m 1.09 KB
Newer Older
1
#import "RNNotificationCenterListener.h"
2
#import "RCTConvert+RNNotifications.h"
3 4 5 6 7 8 9 10 11 12 13 14 15 16

@implementation RNNotificationCenterListener {
    RNNotificationEventHandler* _notificationEventHandler;
}

- (instancetype)initWithNotificationEventHandler:(RNNotificationEventHandler *)notificationEventHandler {
    self = [super init];
    _notificationEventHandler = notificationEventHandler;
    [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];
    
    return self;
}

- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
yogevbd's avatar
WIP  
yogevbd committed
17
    [_notificationEventHandler didReceiveForegroundNotification:notification withCompletionHandler:completionHandler];
18 19 20
}

- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {
yogevbd's avatar
WIP  
yogevbd committed
21
    [_notificationEventHandler didReceiveNotificationResponse:response completionHandler:completionHandler];
22 23 24
}

@end