File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
packages/messaging/ios/RNFBMessaging Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,24 @@ - (void)application:(UIApplication *)application
123
123
completionHandler (UIBackgroundFetchResultNoData);
124
124
return ;
125
125
}
126
+
127
+ // If the notification is a probe notification, always call the completion
128
+ // handler with UIBackgroundFetchResultNoData.
129
+ //
130
+ // This fixes a race condition between `FIRAuth/didReceiveRemoteNotification` and this
131
+ // module causing detox to hang when `FIRAuth/didReceiveRemoteNotification` is called first.
132
+ // see
133
+ // https://stackoverflow.com/questions/72044950/detox-tests-hang-with-pending-items-on-dispatch-queue/72989494
134
+ NSDictionary *data = userInfo[@" com.google.firebase.auth" ];
135
+ if ([data isKindOfClass: [NSString class ]]) {
136
+ // Deserialize in case the data is a JSON string.
137
+ NSData *JSONData = [((NSString *)data) dataUsingEncoding: NSUTF8StringEncoding];
138
+ data = [NSJSONSerialization JSONObjectWithData: JSONData options: 0 error: NULL ];
139
+ }
140
+ if ([data isKindOfClass: [NSDictionary class ]] && data[@" warning" ]) {
141
+ completionHandler (UIBackgroundFetchResultNoData);
142
+ return ;
143
+ }
126
144
#endif
127
145
128
146
[[NSNotificationCenter defaultCenter ]
You can’t perform that action at this time.
0 commit comments