RNNotificationsStore.m 722 Bytes
Newer Older
1 2 3
#import "RNNotificationsStore.h"

@implementation RNNotificationsStore {
yogevbd's avatar
WIP  
yogevbd committed
4
    NSMutableDictionary* _actionCompletionHandlers;
5 6 7
}

- (instancetype)init {
yogevbd's avatar
WIP  
yogevbd committed
8 9
    self = [super init];
    _actionCompletionHandlers = [NSMutableDictionary new];
10 11 12
    return self;
}

yogevbd's avatar
WIP  
yogevbd committed
13 14 15 16 17 18 19 20 21 22 23
- (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];
    }
}
24
@end