@react-native-firebase/messaging 21.13.0 → 22.0.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 +14 -0
- package/android/build.gradle +23 -9
- package/android/src/main/AndroidManifest.xml +6 -0
- package/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingModule.java +39 -0
- package/lib/index.d.ts +34 -0
- package/lib/index.js +23 -0
- package/lib/modular/index.d.ts +23 -0
- package/lib/modular/index.js +22 -0
- package/lib/version.js +1 -1
- package/package.json +6 -5
- package/plugin/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,20 @@
|
|
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
|
+
## [22.0.0](https://github.com/invertase/react-native-firebase/compare/v21.14.0...v22.0.0) (2025-04-25)
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
- **android:** use `=` assignment vs deprecated space-assignment ([39c2ecb](https://github.com/invertase/react-native-firebase/commit/39c2ecb0069a8a5a65b04fb7f86ccecf83273868))
|
11
|
+
- enable provenance signing during publish ([4535f0d](https://github.com/invertase/react-native-firebase/commit/4535f0d5756c89aeb8f8e772348c71d8176348be))
|
12
|
+
|
13
|
+
## [21.14.0](https://github.com/invertase/react-native-firebase/compare/v21.13.0...v21.14.0) (2025-04-14)
|
14
|
+
|
15
|
+
### Features
|
16
|
+
|
17
|
+
- **messaging, android:** notification delegation APIs, firebase.json feature toggle ([c0c5054](https://github.com/invertase/react-native-firebase/commit/c0c505432e95c85fa6621b548b24e755e2894c37))
|
18
|
+
- **messaging, android:** support BigQuery export setting in firebase.json ([fa0e967](https://github.com/invertase/react-native-firebase/commit/fa0e967f9a06719c159a4980749f80c5ff2e2c39))
|
19
|
+
|
6
20
|
## [21.13.0](https://github.com/invertase/react-native-firebase/compare/v21.12.3...v21.13.0) (2025-03-31)
|
7
21
|
|
8
22
|
**Note:** Version bump only for package @react-native-firebase/messaging
|
package/android/build.gradle
CHANGED
@@ -61,13 +61,18 @@ project.ext {
|
|
61
61
|
|
62
62
|
apply from: file('./../../app/android/firebase-json.gradle')
|
63
63
|
|
64
|
-
String
|
64
|
+
String defaultNotificationChannelId = ''
|
65
|
+
String notificationChannelId = defaultNotificationChannelId
|
65
66
|
String defaultNotificationColor = '@color/white'
|
66
67
|
String notificationColor = defaultNotificationColor
|
67
68
|
|
69
|
+
String deliveryMetricsExportEnabled = 'false'
|
70
|
+
|
68
71
|
// If nothing is defined, data collection defaults to true
|
69
72
|
String dataCollectionEnabled = 'true'
|
70
73
|
|
74
|
+
String notificationDelegationEnabled = 'false'
|
75
|
+
|
71
76
|
if (rootProject.ext && rootProject.ext.firebaseJson) {
|
72
77
|
/* groovylint-disable-next-line NoDef, VariableTypeRequired */
|
73
78
|
def rnfbConfig = rootProject.ext.firebaseJson
|
@@ -84,39 +89,48 @@ if (rootProject.ext && rootProject.ext.firebaseJson) {
|
|
84
89
|
}
|
85
90
|
}
|
86
91
|
|
87
|
-
|
92
|
+
if (rnfbConfig.isFlagEnabled('messaging_android_notification_delivery_metrics_export_enabled', false)) {
|
93
|
+
deliveryMetricsExportEnabled = 'true'
|
94
|
+
}
|
95
|
+
notificationChannelId = rnfbConfig.getStringValue('messaging_android_notification_channel_id', defaultNotificationChannelId)
|
88
96
|
notificationColor = rnfbConfig.getStringValue('messaging_android_notification_color', defaultNotificationColor)
|
97
|
+
|
98
|
+
if (rnfbConfig.isFlagEnabled('messaging_android_notification_delegation_enabled', false)) {
|
99
|
+
notificationDelegationEnabled = 'true'
|
100
|
+
}
|
89
101
|
}
|
90
102
|
|
91
103
|
android {
|
92
104
|
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
|
93
105
|
if (agpVersion >= 7) {
|
94
|
-
namespace 'io.invertase.firebase.messaging'
|
106
|
+
namespace = 'io.invertase.firebase.messaging'
|
95
107
|
}
|
96
108
|
|
97
109
|
defaultConfig {
|
98
|
-
multiDexEnabled true
|
110
|
+
multiDexEnabled = true
|
99
111
|
manifestPlaceholders = [
|
112
|
+
firebaseJsonDeliveryMetricsExportEnabled: deliveryMetricsExportEnabled,
|
100
113
|
firebaseJsonAutoInitEnabled: dataCollectionEnabled,
|
101
114
|
firebaseJsonNotificationChannelId: notificationChannelId,
|
102
|
-
firebaseJsonNotificationColor: notificationColor
|
115
|
+
firebaseJsonNotificationColor: notificationColor,
|
116
|
+
firebaseJsonNotificationDelegationEnabled: notificationDelegationEnabled
|
103
117
|
]
|
104
118
|
}
|
105
119
|
|
106
120
|
buildFeatures {
|
107
121
|
// AGP 8 no longer builds config by default
|
108
|
-
buildConfig true
|
122
|
+
buildConfig = true
|
109
123
|
}
|
110
124
|
|
111
125
|
lintOptions {
|
112
126
|
disable 'GradleCompatible'
|
113
|
-
abortOnError false
|
127
|
+
abortOnError = false
|
114
128
|
}
|
115
129
|
|
116
130
|
if (agpVersion < 8) {
|
117
131
|
compileOptions {
|
118
|
-
sourceCompatibility JavaVersion.VERSION_11
|
119
|
-
targetCompatibility JavaVersion.VERSION_11
|
132
|
+
sourceCompatibility = JavaVersion.VERSION_11
|
133
|
+
targetCompatibility = JavaVersion.VERSION_11
|
120
134
|
}
|
121
135
|
}
|
122
136
|
}
|
@@ -24,9 +24,15 @@
|
|
24
24
|
</intent-filter>
|
25
25
|
</receiver>
|
26
26
|
|
27
|
+
<meta-data
|
28
|
+
android:name= "delivery_metrics_exported_to_big_query_enabled"
|
29
|
+
android:value="${firebaseJsonDeliveryMetricsExportEnabled}"/>
|
27
30
|
<meta-data
|
28
31
|
android:name="firebase_messaging_auto_init_enabled"
|
29
32
|
android:value="${firebaseJsonAutoInitEnabled}"/>
|
33
|
+
<meta-data
|
34
|
+
android:name="firebase_messaging_notification_delegation_enabled"
|
35
|
+
android:value="${firebaseJsonNotificationDelegationEnabled}"/>
|
30
36
|
<meta-data
|
31
37
|
android:name="com.google.firebase.messaging.default_notification_channel_id"
|
32
38
|
android:value="${firebaseJsonNotificationChannelId}" />
|
@@ -120,6 +120,42 @@ public class ReactNativeFirebaseMessagingModule extends ReactNativeFirebaseModul
|
|
120
120
|
});
|
121
121
|
}
|
122
122
|
|
123
|
+
@ReactMethod
|
124
|
+
public void isNotificationDelegationEnabled(Promise promise) {
|
125
|
+
Tasks.call(
|
126
|
+
getExecutor(),
|
127
|
+
() -> {
|
128
|
+
FirebaseMessaging.getInstance().isNotificationDelegationEnabled();
|
129
|
+
return null;
|
130
|
+
})
|
131
|
+
.addOnCompleteListener(
|
132
|
+
task -> {
|
133
|
+
if (task.isSuccessful()) {
|
134
|
+
promise.resolve(task.getResult());
|
135
|
+
} else {
|
136
|
+
rejectPromiseWithExceptionMap(promise, task.getException());
|
137
|
+
}
|
138
|
+
});
|
139
|
+
}
|
140
|
+
|
141
|
+
@ReactMethod
|
142
|
+
public void setNotificationDelegationEnabled(Boolean enabled, Promise promise) {
|
143
|
+
Tasks.call(
|
144
|
+
getExecutor(),
|
145
|
+
() -> {
|
146
|
+
FirebaseMessaging.getInstance().setNotificationDelegationEnabled(enabled);
|
147
|
+
return null;
|
148
|
+
})
|
149
|
+
.addOnCompleteListener(
|
150
|
+
task -> {
|
151
|
+
if (task.isSuccessful()) {
|
152
|
+
promise.resolve(FirebaseMessaging.getInstance().isNotificationDelegationEnabled());
|
153
|
+
} else {
|
154
|
+
rejectPromiseWithExceptionMap(promise, task.getException());
|
155
|
+
}
|
156
|
+
});
|
157
|
+
}
|
158
|
+
|
123
159
|
@ReactMethod
|
124
160
|
public void getToken(String appName, String senderId, Promise promise) {
|
125
161
|
FirebaseMessaging messagingInstance =
|
@@ -247,6 +283,9 @@ public class ReactNativeFirebaseMessagingModule extends ReactNativeFirebaseModul
|
|
247
283
|
constants.put(
|
248
284
|
"isDeliveryMetricsExportToBigQueryEnabled",
|
249
285
|
FirebaseMessaging.getInstance().deliveryMetricsExportToBigQueryEnabled());
|
286
|
+
constants.put(
|
287
|
+
"isNotificationDelegationEnabled",
|
288
|
+
FirebaseMessaging.getInstance().isNotificationDelegationEnabled());
|
250
289
|
return constants;
|
251
290
|
}
|
252
291
|
|
package/lib/index.d.ts
CHANGED
@@ -1145,6 +1145,40 @@ export namespace FirebaseMessagingTypes {
|
|
1145
1145
|
* @param enabled A boolean value to enable or disable exporting of message delivery metrics to BigQuery.
|
1146
1146
|
*/
|
1147
1147
|
setDeliveryMetricsExportToBigQuery(enabled: boolean): Promise<void>;
|
1148
|
+
|
1149
|
+
/**
|
1150
|
+
* Sets whether remote notification delegation to Google Play Services is enabled or disabled.
|
1151
|
+
*
|
1152
|
+
* The value is false by default. Set this to true to allow remote notification delegation.
|
1153
|
+
*
|
1154
|
+
* Warning: this will disable notification handlers on Android, and on iOS it has no effect
|
1155
|
+
*
|
1156
|
+
*
|
1157
|
+
* #### Example
|
1158
|
+
*
|
1159
|
+
* ```js
|
1160
|
+
* // Enable delegation of remote notifications to Google Play Services
|
1161
|
+
* await firebase.messaging().setNotificationDelegationEnabled(true);
|
1162
|
+
* ```
|
1163
|
+
*
|
1164
|
+
* @param enabled A boolean value to enable or disable remote notification delegation to Google Play Services.
|
1165
|
+
*/
|
1166
|
+
setNotificationDelegationEnabled(enabled: boolean): Promise<void>;
|
1167
|
+
|
1168
|
+
/**
|
1169
|
+
* Gets whether remote notification delegation to Google Play Services is enabled or disabled.
|
1170
|
+
*
|
1171
|
+
* #### Example
|
1172
|
+
*
|
1173
|
+
* ```js
|
1174
|
+
* // Determine if delegation of remote notifications to Google Play Services is enabled
|
1175
|
+
* const delegationEnabled = await firebase.messaging().isNotificationDelegationEnabled();
|
1176
|
+
* ```
|
1177
|
+
*
|
1178
|
+
* @returns enabled A boolean value indicatign if remote notification delegation to Google Play Services is enabled.
|
1179
|
+
*/
|
1180
|
+
istNotificationDelegationEnabled(): Promise<boolean>;
|
1181
|
+
|
1148
1182
|
/**
|
1149
1183
|
* Checks if all required APIs exist in the browser.
|
1150
1184
|
*
|
package/lib/index.js
CHANGED
@@ -60,6 +60,10 @@ class FirebaseMessagingModule extends FirebaseModule {
|
|
60
60
|
this.native.isRegisteredForRemoteNotifications != null
|
61
61
|
? this.native.isRegisteredForRemoteNotifications
|
62
62
|
: true;
|
63
|
+
this._isNotificationDelegationEnabled =
|
64
|
+
this.native.isNotificationDelegationEnabled != null
|
65
|
+
? this.native.isNotificationDelegationEnabled
|
66
|
+
: false;
|
63
67
|
|
64
68
|
AppRegistry.registerHeadlessTask('ReactNativeFirebaseMessagingHeadlessTask', () => {
|
65
69
|
if (!backgroundMessageHandler) {
|
@@ -121,6 +125,10 @@ class FirebaseMessagingModule extends FirebaseModule {
|
|
121
125
|
return this._isRegisteredForRemoteNotifications;
|
122
126
|
}
|
123
127
|
|
128
|
+
get isNotificationDelegationEnabled() {
|
129
|
+
return this._isNotificationDelegationEnabled;
|
130
|
+
}
|
131
|
+
|
124
132
|
get isDeliveryMetricsExportToBigQueryEnabled() {
|
125
133
|
return this._isDeliveryMetricsExportToBigQueryEnabled;
|
126
134
|
}
|
@@ -460,6 +468,21 @@ class FirebaseMessagingModule extends FirebaseModule {
|
|
460
468
|
return this.native.setDeliveryMetricsExportToBigQuery(enabled);
|
461
469
|
}
|
462
470
|
|
471
|
+
setNotificationDelegationEnabled(enabled) {
|
472
|
+
if (!isBoolean(enabled)) {
|
473
|
+
throw new Error(
|
474
|
+
"firebase.messaging().setNotificationDelegationEnabled(*) 'enabled' expected a boolean value.",
|
475
|
+
);
|
476
|
+
}
|
477
|
+
|
478
|
+
this._isNotificationDelegationEnabled = enabled;
|
479
|
+
if (isIOS) {
|
480
|
+
return;
|
481
|
+
}
|
482
|
+
|
483
|
+
return this.native.setNotificationDelegationEnabled(enabled);
|
484
|
+
}
|
485
|
+
|
463
486
|
async isSupported() {
|
464
487
|
if (Platform.isAndroid) {
|
465
488
|
playServicesAvailability = firebase.utils().playServicesAvailability;
|
package/lib/modular/index.d.ts
CHANGED
@@ -99,6 +99,29 @@ export function isAutoInitEnabled(messaging: Messaging): boolean;
|
|
99
99
|
*/
|
100
100
|
export function setAutoInitEnabled(messaging: Messaging, enabled: boolean): Promise<void>;
|
101
101
|
|
102
|
+
/**
|
103
|
+
* Sets whether remote notification delegation to Google Play Services is enabled or disabled.
|
104
|
+
*
|
105
|
+
* The value is false by default. Set this to true to allow remote notification delegation.
|
106
|
+
*
|
107
|
+
* Warning: this will disable notification handlers on Android, and on iOS it has no effect
|
108
|
+
*
|
109
|
+
* @param messaging - Messaging instance.
|
110
|
+
* @param enabled A boolean value to enable or disable remote notification delegation to Google Play Services.
|
111
|
+
*/
|
112
|
+
export function setNotificationDelegationEnabled(
|
113
|
+
messaging: Messaging,
|
114
|
+
enabled: boolean,
|
115
|
+
): Promise<void>;
|
116
|
+
|
117
|
+
/**
|
118
|
+
* Gets whether remote notification delegation to Google Play Services is enabled or disabled.
|
119
|
+
*
|
120
|
+
* @param messaging - Messaging instance.
|
121
|
+
* @returns enabled A boolean value indicatign if remote notification delegation to Google Play Services is enabled.
|
122
|
+
*/
|
123
|
+
export function istNotificationDelegationEnabled(messaging: Messaging): Promise<boolean>;
|
124
|
+
|
102
125
|
/**
|
103
126
|
* When a notification from FCM has triggered the application to open from a quit state,
|
104
127
|
* this method will return a `RemoteMessage` containing the notification data, or `null` if
|
package/lib/modular/index.js
CHANGED
@@ -317,6 +317,28 @@ export function isDeliveryMetricsExportToBigQueryEnabled(messaging) {
|
|
317
317
|
return messaging.isDeliveryMetricsExportToBigQueryEnabled;
|
318
318
|
}
|
319
319
|
|
320
|
+
/**
|
321
|
+
* Returns a boolean whether message delegation is enabled. Android only,
|
322
|
+
* always returns false on iOS
|
323
|
+
* @param {Messaging} messaging - Messaging instance.
|
324
|
+
* @returns {boolean}
|
325
|
+
*/
|
326
|
+
export function isNotificationDelegationEnabled(messaging) {
|
327
|
+
return messaging.isNotificationDelegationEnabled;
|
328
|
+
}
|
329
|
+
|
330
|
+
/**
|
331
|
+
* Sets whether message notification delegation is enabled or disabled.
|
332
|
+
* The value is false by default. Set this to true to allow delegation of notification to Google Play Services.
|
333
|
+
* Note if true message handlers will not function on Android, and it has no effect on iOS
|
334
|
+
* @param {Messaging} messaging - Messaging instance.
|
335
|
+
* @param {boolean} enabled - A boolean value to enable or disable delegation of messages to Google Play Services.
|
336
|
+
* @returns {Promise<void>}
|
337
|
+
*/
|
338
|
+
export function setNotificationDelegationEnabled(messaging, enabled) {
|
339
|
+
return messaging.setNotificationDelegationEnabled(enabled);
|
340
|
+
}
|
341
|
+
|
320
342
|
/**
|
321
343
|
* Checks if all required APIs exist in the browser.
|
322
344
|
* @param {Messaging} messaging - Messaging instance.
|
package/lib/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
// Generated by genversion.
|
2
|
-
module.exports = '
|
2
|
+
module.exports = '22.0.0';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-native-firebase/messaging",
|
3
|
-
"version": "
|
3
|
+
"version": "22.0.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": "
|
27
|
+
"@react-native-firebase/app": "22.0.0",
|
28
28
|
"expo": ">=47.0.0"
|
29
29
|
},
|
30
30
|
"devDependencies": {
|
31
|
-
"expo": "^52.0.
|
31
|
+
"expo": "^52.0.46"
|
32
32
|
},
|
33
33
|
"peerDependenciesMeta": {
|
34
34
|
"expo": {
|
@@ -36,7 +36,8 @@
|
|
36
36
|
}
|
37
37
|
},
|
38
38
|
"publishConfig": {
|
39
|
-
"access": "public"
|
39
|
+
"access": "public",
|
40
|
+
"provenance": true
|
40
41
|
},
|
41
|
-
"gitHead": "
|
42
|
+
"gitHead": "e9fee87b413c90e243347d5c60272f07f41d99b8"
|
42
43
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"root":["./src/index.ts","./src/android/index.ts","./src/android/setupFirebaseNotifationIcon.ts"],"version":"5.
|
1
|
+
{"root":["./src/index.ts","./src/android/index.ts","./src/android/setupFirebaseNotifationIcon.ts"],"version":"5.8.3"}
|