@react-native-firebase/messaging 21.8.0 → 21.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,16 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [21.10.0](https://github.com/invertase/react-native-firebase/compare/v21.9.0...v21.10.0) (2025-02-11)
|
7
|
+
|
8
|
+
### Features
|
9
|
+
|
10
|
+
- **messaging, ios:** background completion handler from JS ([#8128](https://github.com/invertase/react-native-firebase/issues/8128)) ([f00fa8d](https://github.com/invertase/react-native-firebase/commit/f00fa8d26071c33b30a3d0a155e19a90a221a828))
|
11
|
+
|
12
|
+
## [21.9.0](https://github.com/invertase/react-native-firebase/compare/v21.8.0...v21.9.0) (2025-02-11)
|
13
|
+
|
14
|
+
**Note:** Version bump only for package @react-native-firebase/messaging
|
15
|
+
|
6
16
|
## [21.8.0](https://github.com/invertase/react-native-firebase/compare/v21.7.4...v21.8.0) (2025-02-10)
|
7
17
|
|
8
18
|
### Bug Fixes
|
@@ -27,6 +27,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
27
27
|
@property _Nullable RCTPromiseResolveBlock registerPromiseResolver;
|
28
28
|
@property(nonatomic, strong) NSCondition *conditionBackgroundMessageHandlerSet;
|
29
29
|
@property(nonatomic) BOOL backgroundMessageHandlerSet;
|
30
|
+
@property(nonatomic, copy) void (^completionHandler)(UIBackgroundFetchResult);
|
31
|
+
@property(nonatomic, assign) UIBackgroundTaskIdentifier backgroundTaskId;
|
30
32
|
|
31
33
|
+ (_Nonnull instancetype)sharedInstance;
|
32
34
|
|
@@ -156,30 +156,34 @@
|
|
156
156
|
DLog(@"didReceiveRemoteNotification gcm.message_id was present %@", userInfo);
|
157
157
|
|
158
158
|
if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) {
|
159
|
+
// Store the completion handler to call later when the JS code finishes
|
160
|
+
RNFBMessagingAppDelegate *sharedInstance = [RNFBMessagingAppDelegate sharedInstance];
|
161
|
+
sharedInstance.completionHandler = completionHandler;
|
162
|
+
|
159
163
|
// If app is in background state, register background task to guarantee async queues aren't
|
160
164
|
// frozen.
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
// TODO add support in a later version for calling completion handler directly from JS when
|
169
|
-
// user JS code complete
|
165
|
+
sharedInstance.backgroundTaskId = [application beginBackgroundTaskWithExpirationHandler:^{
|
166
|
+
if (sharedInstance.backgroundTaskId != UIBackgroundTaskInvalid) {
|
167
|
+
[application endBackgroundTask:sharedInstance.backgroundTaskId];
|
168
|
+
sharedInstance.backgroundTaskId = UIBackgroundTaskInvalid;
|
169
|
+
}
|
170
|
+
}];
|
171
|
+
|
170
172
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(25 * NSEC_PER_SEC)),
|
171
173
|
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
172
|
-
completionHandler
|
174
|
+
if (sharedInstance.completionHandler) {
|
175
|
+
sharedInstance.completionHandler(UIBackgroundFetchResultNewData);
|
176
|
+
sharedInstance.completionHandler = nil;
|
177
|
+
}
|
173
178
|
|
174
179
|
// Stop background task after the longest timeout, async queue is okay to
|
175
180
|
// freeze again after handling period
|
176
|
-
if (backgroundTaskId != UIBackgroundTaskInvalid) {
|
177
|
-
[application endBackgroundTask:backgroundTaskId];
|
178
|
-
backgroundTaskId = UIBackgroundTaskInvalid;
|
181
|
+
if (sharedInstance.backgroundTaskId != UIBackgroundTaskInvalid) {
|
182
|
+
[application endBackgroundTask:sharedInstance.backgroundTaskId];
|
183
|
+
sharedInstance.backgroundTaskId = UIBackgroundTaskInvalid;
|
179
184
|
}
|
180
185
|
});
|
181
186
|
|
182
|
-
RNFBMessagingAppDelegate *sharedInstance = [RNFBMessagingAppDelegate sharedInstance];
|
183
187
|
[sharedInstance.conditionBackgroundMessageHandlerSet lock];
|
184
188
|
@try {
|
185
189
|
DLog(@"didReceiveRemoteNotification sharedInstance.backgroundMessageHandlerSet = %@",
|
@@ -242,4 +246,4 @@
|
|
242
246
|
}
|
243
247
|
}
|
244
248
|
|
245
|
-
@end
|
249
|
+
@end
|
@@ -219,6 +219,20 @@ RCT_EXPORT_METHOD(getIsHeadless : (RCTPromiseResolveBlock)resolve : (RCTPromiseR
|
|
219
219
|
return resolve(@([RCTConvert BOOL:@(notifCenter.isHeadless)]));
|
220
220
|
}
|
221
221
|
|
222
|
+
RCT_EXPORT_METHOD(completeNotificationProcessing) {
|
223
|
+
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
224
|
+
RNFBMessagingAppDelegate *appDelegate = [RNFBMessagingAppDelegate sharedInstance];
|
225
|
+
if (appDelegate.completionHandler) {
|
226
|
+
appDelegate.completionHandler(UIBackgroundFetchResultNewData);
|
227
|
+
appDelegate.completionHandler = nil;
|
228
|
+
}
|
229
|
+
if (appDelegate.backgroundTaskId != UIBackgroundTaskInvalid) {
|
230
|
+
[[UIApplication sharedApplication] endBackgroundTask:appDelegate.backgroundTaskId];
|
231
|
+
appDelegate.backgroundTaskId = UIBackgroundTaskInvalid;
|
232
|
+
}
|
233
|
+
});
|
234
|
+
}
|
235
|
+
|
222
236
|
RCT_EXPORT_METHOD(requestPermission
|
223
237
|
: (NSDictionary *)permissions
|
224
238
|
: (RCTPromiseResolveBlock)resolve
|
package/lib/index.js
CHANGED
@@ -98,7 +98,13 @@ class FirebaseMessagingModule extends FirebaseModule {
|
|
98
98
|
return Promise.resolve();
|
99
99
|
}
|
100
100
|
|
101
|
-
|
101
|
+
// Ensure the handler is a promise
|
102
|
+
const handlerPromise = Promise.resolve(backgroundMessageHandler(remoteMessage));
|
103
|
+
handlerPromise.finally(() => {
|
104
|
+
this.native.completeNotificationProcessing();
|
105
|
+
});
|
106
|
+
|
107
|
+
return handlerPromise;
|
102
108
|
});
|
103
109
|
|
104
110
|
this.emitter.addListener('messaging_settings_for_notification_opened', remoteMessage => {
|
package/lib/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
// Generated by genversion.
|
2
|
-
module.exports = '21.
|
2
|
+
module.exports = '21.10.0';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-native-firebase/messaging",
|
3
|
-
"version": "21.
|
3
|
+
"version": "21.10.0",
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
5
5
|
"description": "React Native Firebase - React Native Firebase provides native integration of Firebase Cloud Messaging (FCM) for both Android & iOS. FCM is a cost free service, allowing for server-device and device-device communication. The React Native Firebase Messaging module provides a simple JavaScript API to interact with FCM.",
|
6
6
|
"main": "lib/index.js",
|
@@ -24,11 +24,11 @@
|
|
24
24
|
"messaging"
|
25
25
|
],
|
26
26
|
"peerDependencies": {
|
27
|
-
"@react-native-firebase/app": "21.
|
27
|
+
"@react-native-firebase/app": "21.10.0",
|
28
28
|
"expo": ">=47.0.0"
|
29
29
|
},
|
30
30
|
"devDependencies": {
|
31
|
-
"expo": "^52.0.
|
31
|
+
"expo": "^52.0.32"
|
32
32
|
},
|
33
33
|
"peerDependenciesMeta": {
|
34
34
|
"expo": {
|
@@ -38,5 +38,5 @@
|
|
38
38
|
"publishConfig": {
|
39
39
|
"access": "public"
|
40
40
|
},
|
41
|
-
"gitHead": "
|
41
|
+
"gitHead": "3fd30c09b2eb7d60a6ac7f6f906673a12b7bc1a7"
|
42
42
|
}
|