Protect against multiple calls to start/stop handling native methods
This commit is contained in:
parent
b53695ad52
commit
0291605934
@ -99,12 +99,22 @@ RCT_EXPORT_MODULE();
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(startHandlingNotificationDisplayed) {
|
||||
if(isUserHandlingOnNotificationDisplayed == YES) {
|
||||
return;
|
||||
}
|
||||
|
||||
isUserHandlingOnNotificationDisplayed = YES;
|
||||
|
||||
completionHandlers = [[NSMutableDictionary alloc] init];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(stopHandlingNotificationDisplayed) {
|
||||
if(isUserHandlingOnNotificationDisplayed == NO) {
|
||||
return;
|
||||
}
|
||||
|
||||
isUserHandlingOnNotificationDisplayed = NO;
|
||||
|
||||
NSArray *allHandlers = completionHandlers.allValues;
|
||||
for (void (^ completionHandler)(UIBackgroundFetchResult) in allHandlers) {
|
||||
completionHandler(UIBackgroundFetchResultNoData);
|
||||
|
Loading…
x
Reference in New Issue
Block a user