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) {
|
RCT_EXPORT_METHOD(startHandlingNotificationDisplayed) {
|
||||||
|
if(isUserHandlingOnNotificationDisplayed == YES) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
isUserHandlingOnNotificationDisplayed = YES;
|
isUserHandlingOnNotificationDisplayed = YES;
|
||||||
|
|
||||||
completionHandlers = [[NSMutableDictionary alloc] init];
|
completionHandlers = [[NSMutableDictionary alloc] init];
|
||||||
}
|
}
|
||||||
|
|
||||||
RCT_EXPORT_METHOD(stopHandlingNotificationDisplayed) {
|
RCT_EXPORT_METHOD(stopHandlingNotificationDisplayed) {
|
||||||
|
if(isUserHandlingOnNotificationDisplayed == NO) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
isUserHandlingOnNotificationDisplayed = NO;
|
isUserHandlingOnNotificationDisplayed = NO;
|
||||||
|
|
||||||
NSArray *allHandlers = completionHandlers.allValues;
|
NSArray *allHandlers = completionHandlers.allValues;
|
||||||
for (void (^ completionHandler)(UIBackgroundFetchResult) in allHandlers) {
|
for (void (^ completionHandler)(UIBackgroundFetchResult) in allHandlers) {
|
||||||
completionHandler(UIBackgroundFetchResultNoData);
|
completionHandler(UIBackgroundFetchResultNoData);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user