Skip to content

Commit

Permalink
Move to async, using global queue
Browse files Browse the repository at this point in the history
  • Loading branch information
Beat-YT authored Jan 7, 2025
1 parent 46b8966 commit a4760eb
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions packages/messaging/ios/RNFBMessaging/RNFBMessagingModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,17 @@ - (NSDictionary *)constantsToExport {
}

RCT_EXPORT_METHOD(completeNotificationProcessing) {
RNFBMessagingAppDelegate *appDelegate = [RNFBMessagingAppDelegate sharedInstance];
if (appDelegate.completionHandler) {
appDelegate.completionHandler(UIBackgroundFetchResultNewData);
appDelegate.completionHandler = nil;
}

if (appDelegate.backgroundTaskId != UIBackgroundTaskInvalid) {
[[UIApplication sharedApplication] endBackgroundTask:appDelegate.backgroundTaskId];
appDelegate.backgroundTaskId = UIBackgroundTaskInvalid;
}
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
RNFBMessagingAppDelegate *appDelegate = [RNFBMessagingAppDelegate sharedInstance];
if (appDelegate.completionHandler) {
appDelegate.completionHandler(UIBackgroundFetchResultNewData);
appDelegate.completionHandler = nil;
}
if (appDelegate.backgroundTaskId != UIBackgroundTaskInvalid) {
[[UIApplication sharedApplication] endBackgroundTask:appDelegate.backgroundTaskId];
appDelegate.backgroundTaskId = UIBackgroundTaskInvalid;
}
});
}

RCT_EXPORT_METHOD(requestPermission
Expand Down

0 comments on commit a4760eb

Please sign in to comment.