Files
react-native-notifications/RNNotifications/RNNotificationsStore.m
yogevbd 6a3809abec WIP
2019-07-07 15:45:04 +03:00

25 lines
722 B
Objective-C

#import "RNNotificationsStore.h"
@implementation RNNotificationsStore {
NSMutableDictionary* _actionCompletionHandlers;
}
- (instancetype)init {
self = [super init];
_actionCompletionHandlers = [NSMutableDictionary new];
return self;
}
- (void)setCompletionHandler:(void (^)())completionHandler withCompletionKey:(NSString *)completionKey {
_actionCompletionHandlers[completionKey] = completionHandler;
}
- (void)completeAction:(NSString *)completionKey {
void (^completionHandler)() = (void (^)())[_actionCompletionHandlers valueForKey:completionKey];
if (completionHandler) {
completionHandler();
[_actionCompletionHandlers removeObjectForKey:completionKey];
}
}
@end