1// Copyright 2018-present 650 Industries. All rights reserved.
2
3#import "EXScopedNotificationsHandlerModule.h"
4#import "EXScopedNotificationsUtils.h"
5
6@interface EXScopedNotificationsHandlerModule ()
7
8@property (nonatomic, strong) NSString *scopeKey;
9
10@end
11
12@implementation EXScopedNotificationsHandlerModule
13
14- (instancetype)initWithScopeKey:(NSString *)scopeKey
15{
16  if (self = [super init]) {
17    _scopeKey = scopeKey;
18  }
19
20  return self;
21}
22
23- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler
24{
25  if ([EXScopedNotificationsUtils shouldNotification:notification beHandledByExperience:_scopeKey]) {
26    [super userNotificationCenter:center willPresentNotification:notification withCompletionHandler:completionHandler];
27  }
28}
29
30@end
31