Skip to content

Commit

Permalink
fix(messaging): Fixes a race condition between `FIRAuth/didReceiveRem…
Browse files Browse the repository at this point in the history
…oteNotification` and this module causing detox to hang when `FIRAuth/didReceiveRemoteNotification` is called first.

see https://stackoverflow.com/questions/72044950/detox-tests-hang-with-pending-items-on-dispatch-queue/72989494
  • Loading branch information
Gabriel Lesperance committed Jul 15, 2022
1 parent 254f9fc commit 941128b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/messaging/ios/RNFBMessaging/RNFBMessaging+AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ - (void)application:(UIApplication *)application
completionHandler(UIBackgroundFetchResultNoData);
return;
}

// If the notification is a probe notification, always call the completion
// handler with UIBackgroundFetchResultNoData.
//
// This fixes a race condition between `FIRAuth/didReceiveRemoteNotification` and this
// module causing detox to hang when `FIRAuth/didReceiveRemoteNotification` is called first.
// see https://stackoverflow.com/questions/72044950/detox-tests-hang-with-pending-items-on-dispatch-queue/72989494#72989494
NSDictionary *data = userInfo[@"com.google.firebase.auth"];
if (data && data[@"warning"]) {
completionHandler(UIBackgroundFetchResultNoData);
return;
}
#endif

[[NSNotificationCenter defaultCenter]
Expand Down

0 comments on commit 941128b

Please sign in to comment.