mirror of
https://github.com/zhigang1992/react-native-notifications.git
synced 2026-06-13 09:34:39 +08:00
25 lines
722 B
Objective-C
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
|