@react-native-firebase/messaging 16.5.2 → 16.6.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 +6 -0
- package/lib/index.d.ts +90 -10
- package/lib/index.js +43 -3
- package/lib/version.js +1 -1
- package/modular/index.js +299 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,12 @@
|
|
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
|
+
## [16.6.0](https://github.com/invertase/react-native-firebase/compare/v16.5.2...v16.6.0) (2023-01-27)
|
7
|
+
|
8
|
+
### Features
|
9
|
+
|
10
|
+
- **messaging:** Expose modular API that matches the Firebase web JS SDK v9 API ([#6806](https://github.com/invertase/react-native-firebase/issues/6806)) ([da82c10](https://github.com/invertase/react-native-firebase/commit/da82c1036051f0518da0401de24cef24c7ac091f))
|
11
|
+
|
6
12
|
### [16.5.2](https://github.com/invertase/react-native-firebase/compare/v16.5.1...v16.5.2) (2023-01-23)
|
7
13
|
|
8
14
|
**Note:** Version bump only for package @react-native-firebase/messaging
|
package/lib/index.d.ts
CHANGED
@@ -111,9 +111,9 @@ export namespace FirebaseMessagingTypes {
|
|
111
111
|
data?: { [key: string]: string };
|
112
112
|
|
113
113
|
/**
|
114
|
-
* Additional
|
114
|
+
* Additional NotificationPayload data sent with the message
|
115
115
|
*/
|
116
|
-
notification?:
|
116
|
+
notification?: NotificationPayload;
|
117
117
|
|
118
118
|
/**
|
119
119
|
* Whether the iOS APNs message was configured as a background update notification.
|
@@ -139,14 +139,35 @@ export namespace FirebaseMessagingTypes {
|
|
139
139
|
|
140
140
|
/**
|
141
141
|
* An iOS app specific identifier used for notification grouping.
|
142
|
-
*/
|
143
142
|
threadId?: string;
|
143
|
+
*/
|
144
|
+
threadId?: string;
|
145
|
+
|
146
|
+
/**
|
147
|
+
* Options for features provided by the FCM SDK for Web.
|
148
|
+
*/
|
149
|
+
fcmOptions: FcmOptions;
|
144
150
|
}
|
145
151
|
|
146
152
|
/**
|
147
|
-
* Options for
|
153
|
+
* Options for features provided by the FCM SDK for Web.
|
148
154
|
*/
|
149
|
-
export interface
|
155
|
+
export interface FcmOptions {
|
156
|
+
/**
|
157
|
+
* The link to open when the user clicks on the notification.
|
158
|
+
*/
|
159
|
+
link?: string;
|
160
|
+
|
161
|
+
/**
|
162
|
+
* The label associated with the message's analytics data.
|
163
|
+
*/
|
164
|
+
analyticsLabel?: string;
|
165
|
+
}
|
166
|
+
|
167
|
+
/**
|
168
|
+
* Options for `getToken()` and `deleteToken()`
|
169
|
+
*/
|
170
|
+
export interface NativeTokenOptions {
|
150
171
|
/**
|
151
172
|
* The app name of the FirebaseApp instance.
|
152
173
|
*
|
@@ -162,6 +183,35 @@ export namespace FirebaseMessagingTypes {
|
|
162
183
|
senderId?: string;
|
163
184
|
}
|
164
185
|
|
186
|
+
/**
|
187
|
+
* Options for `getToken()`
|
188
|
+
*/
|
189
|
+
export interface GetTokenOptions {
|
190
|
+
/**
|
191
|
+
* The VAPID key used to authenticate the push subscribers
|
192
|
+
* to receive push messages only from sending servers
|
193
|
+
* that hold the corresponding private key.
|
194
|
+
*
|
195
|
+
* @platform web
|
196
|
+
*/
|
197
|
+
vapidKey?: string;
|
198
|
+
|
199
|
+
/**
|
200
|
+
* The service worker registration for receiving push messaging.
|
201
|
+
* If the registration is not provided explicitly, you need to
|
202
|
+
* have a firebase-messaging-sw.js at your root location.
|
203
|
+
*
|
204
|
+
* @platform web
|
205
|
+
*/
|
206
|
+
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
207
|
+
}
|
208
|
+
|
209
|
+
/**
|
210
|
+
* NotificationPayload is an alias for Notification. This is to keep it the same as
|
211
|
+
* Firebase Web JS SDK v9 and to make it backwards compatible.
|
212
|
+
*/
|
213
|
+
type NotificationPayload = Notification;
|
214
|
+
|
165
215
|
export interface Notification {
|
166
216
|
/**
|
167
217
|
* The notification title.
|
@@ -183,6 +233,22 @@ export namespace FirebaseMessagingTypes {
|
|
183
233
|
*/
|
184
234
|
body?: string;
|
185
235
|
|
236
|
+
/**
|
237
|
+
* Web only. The URL to use for the notification's icon. If you don't send this key in the request,
|
238
|
+
* FCM displays the launcher icon specified in your app manifest.
|
239
|
+
*/
|
240
|
+
icon?: string;
|
241
|
+
|
242
|
+
/**
|
243
|
+
* Web only. The URL of an image that is downloaded on the device and displayed in the notification.
|
244
|
+
*/
|
245
|
+
image?: string;
|
246
|
+
|
247
|
+
/**
|
248
|
+
* Web only. The notification's title.
|
249
|
+
*/
|
250
|
+
title?: string;
|
251
|
+
|
186
252
|
/**
|
187
253
|
* The native localization key for the notification body content.
|
188
254
|
*/
|
@@ -627,10 +693,9 @@ export namespace FirebaseMessagingTypes {
|
|
627
693
|
* fcmTokens: firebase.firestore.FieldValues.arrayUnion(fcmToken),
|
628
694
|
* });
|
629
695
|
* ```
|
630
|
-
*
|
631
|
-
* @param options Options to override senderId (iOS) and projectId (Android).
|
696
|
+
* @param options Options composite type with all members of `GetTokenOptions` and `NativeTokenOptions`
|
632
697
|
*/
|
633
|
-
getToken(options?:
|
698
|
+
getToken(options?: GetTokenOptions & NativeTokenOptions): Promise<string>;
|
634
699
|
|
635
700
|
/**
|
636
701
|
* Returns whether the root view is headless or not
|
@@ -651,9 +716,9 @@ export namespace FirebaseMessagingTypes {
|
|
651
716
|
* await firebase.messaging().deleteToken();
|
652
717
|
* ```
|
653
718
|
*
|
654
|
-
* @param options Options to override senderId (iOS) and
|
719
|
+
* @param options Options to override senderId (iOS) and appName (android)
|
655
720
|
*/
|
656
|
-
deleteToken(options?:
|
721
|
+
deleteToken(options?: NativeTokenOptions): Promise<void>;
|
657
722
|
|
658
723
|
/**
|
659
724
|
* When any FCM payload is received, the listener callback is called with a `RemoteMessage`.
|
@@ -1012,6 +1077,21 @@ export namespace FirebaseMessagingTypes {
|
|
1012
1077
|
* @param enabled A boolean value to enable or disable exporting of message delivery metrics to BigQuery.
|
1013
1078
|
*/
|
1014
1079
|
setDeliveryMetricsExportToBigQuery(enabled: boolean): Promise<void>;
|
1080
|
+
/**
|
1081
|
+
* Checks if all required APIs exist in the browser.
|
1082
|
+
*
|
1083
|
+
* @web
|
1084
|
+
*/
|
1085
|
+
isSupported(): Promise<boolean>;
|
1086
|
+
|
1087
|
+
/**
|
1088
|
+
* Enables or disables Firebase Cloud Messaging message delivery metrics export to BigQuery. By
|
1089
|
+
* default, message delivery metrics are not exported to BigQuery. Use this method to enable or
|
1090
|
+
* disable the export at runtime.
|
1091
|
+
*
|
1092
|
+
* @web
|
1093
|
+
*/
|
1094
|
+
experimentalSetDeliveryMetricsExportedToBigQueryEnabled(): void;
|
1015
1095
|
}
|
1016
1096
|
}
|
1017
1097
|
|
package/lib/index.js
CHANGED
@@ -30,10 +30,41 @@ import {
|
|
30
30
|
FirebaseModule,
|
31
31
|
getFirebaseRoot,
|
32
32
|
} from '@react-native-firebase/app/lib/internal';
|
33
|
-
import { AppRegistry } from 'react-native';
|
33
|
+
import { AppRegistry, Platform } from 'react-native';
|
34
34
|
import remoteMessageOptions from './remoteMessageOptions';
|
35
35
|
import version from './version';
|
36
36
|
|
37
|
+
export {
|
38
|
+
getMessaging,
|
39
|
+
deleteToken,
|
40
|
+
getToken,
|
41
|
+
onMessage,
|
42
|
+
onNotificationOpenedApp,
|
43
|
+
onTokenRefresh,
|
44
|
+
requestPermission,
|
45
|
+
isAutoInitEnabled,
|
46
|
+
setAutoInitEnabled,
|
47
|
+
getInitialNotification,
|
48
|
+
getDidOpenSettingsForNotification,
|
49
|
+
getIsHeadless,
|
50
|
+
registerDeviceForRemoteMessages,
|
51
|
+
isDeviceRegisteredForRemoteMessages,
|
52
|
+
unregisterDeviceForRemoteMessages,
|
53
|
+
getAPNSToken,
|
54
|
+
hasPermission,
|
55
|
+
onDeletedMessages,
|
56
|
+
onMessageSent,
|
57
|
+
onSendError,
|
58
|
+
setBackgroundMessageHandler,
|
59
|
+
setOpenSettingsForNotificationsHandler,
|
60
|
+
sendMessage,
|
61
|
+
subscribeToTopic,
|
62
|
+
unsubscribeFromTopic,
|
63
|
+
experimentalSetDeliveryMetricsExportedToBigQueryEnabled,
|
64
|
+
isDeliveryMetricsExportToBigQueryEnabled,
|
65
|
+
isSupported,
|
66
|
+
} from '../modular/index';
|
67
|
+
|
37
68
|
const statics = {
|
38
69
|
AuthorizationStatus: {
|
39
70
|
NOT_DETERMINED: -1,
|
@@ -166,7 +197,7 @@ class FirebaseMessagingModule extends FirebaseModule {
|
|
166
197
|
|
167
198
|
getToken({ appName, senderId } = {}) {
|
168
199
|
if (!isUndefined(appName) && !isString(appName)) {
|
169
|
-
throw new Error("firebase.messaging().getToken(*) '
|
200
|
+
throw new Error("firebase.messaging().getToken(*) 'appName' expected a string.");
|
170
201
|
}
|
171
202
|
|
172
203
|
if (!isUndefined(senderId) && !isString(senderId)) {
|
@@ -181,7 +212,7 @@ class FirebaseMessagingModule extends FirebaseModule {
|
|
181
212
|
|
182
213
|
deleteToken({ appName, senderId } = {}) {
|
183
214
|
if (!isUndefined(appName) && !isString(appName)) {
|
184
|
-
throw new Error("firebase.messaging().deleteToken(*) '
|
215
|
+
throw new Error("firebase.messaging().deleteToken(*) 'appName' expected a string.");
|
185
216
|
}
|
186
217
|
|
187
218
|
if (!isUndefined(senderId) && !isString(senderId)) {
|
@@ -448,6 +479,15 @@ class FirebaseMessagingModule extends FirebaseModule {
|
|
448
479
|
this._isDeliveryMetricsExportToBigQueryEnabled = enabled;
|
449
480
|
return this.native.setDeliveryMetricsExportToBigQuery(enabled);
|
450
481
|
}
|
482
|
+
|
483
|
+
async isSupported() {
|
484
|
+
if (Platform.isAndroid) {
|
485
|
+
playServicesAvailability = firebase.utils().playServicesAvailability;
|
486
|
+
return playServicesAvailability.isAvailable;
|
487
|
+
}
|
488
|
+
// Always return "true" for iOS. Web will be implemented when it is supported
|
489
|
+
return true;
|
490
|
+
}
|
451
491
|
}
|
452
492
|
|
453
493
|
// import { SDK_VERSION } from '@react-native-firebase/messaging';
|
package/lib/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
// Generated by genversion.
|
2
|
-
module.exports = '16.
|
2
|
+
module.exports = '16.6.0';
|
package/modular/index.js
ADDED
@@ -0,0 +1,299 @@
|
|
1
|
+
import { firebase } from '..';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Returns a Messaging instance for the given app.
|
5
|
+
* @param app - FirebaseApp. Optional.
|
6
|
+
* @returns {Messaging}
|
7
|
+
*/
|
8
|
+
export function getMessaging(app) {
|
9
|
+
if (app) {
|
10
|
+
return firebase.app(app.name).messaging();
|
11
|
+
}
|
12
|
+
|
13
|
+
return firebase.app().messaging();
|
14
|
+
}
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Removes access to an FCM token previously authorized by it's scope.
|
18
|
+
* Messages sent by the server to this token will fail.
|
19
|
+
* @param messaging Messaging instance.
|
20
|
+
* @param tokenOptions Options to override senderId (iOS) and projectId (Android).
|
21
|
+
* @returns {Promise<void>}
|
22
|
+
*/
|
23
|
+
export function deleteToken(messaging, tokenOptions) {
|
24
|
+
if (tokenOptions != null) {
|
25
|
+
return messaging.deleteToken();
|
26
|
+
}
|
27
|
+
|
28
|
+
return messaging.deleteToken(tokenOptions);
|
29
|
+
}
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Returns an FCM token for this device. Optionally you can specify a custom options to your own use-case.
|
33
|
+
* @param messaging Messaging instance.
|
34
|
+
* @param options Options to override senderId (iOS) and appName
|
35
|
+
* @returns {Promise<string>}
|
36
|
+
*/
|
37
|
+
export function getToken(messaging, options) {
|
38
|
+
if (options != null) {
|
39
|
+
return messaging.getToken();
|
40
|
+
}
|
41
|
+
|
42
|
+
return messaging.getToken(options);
|
43
|
+
}
|
44
|
+
|
45
|
+
/**
|
46
|
+
* When any FCM payload is received, the listener callback is called with a `RemoteMessage`.
|
47
|
+
* > This subscriber method is only called when the app is active (in the foreground).
|
48
|
+
* @param messaging Messaging instance.
|
49
|
+
* @param listener Called with a `RemoteMessage` when a new FCM payload is received from the server.
|
50
|
+
* @returns {Function}
|
51
|
+
*/
|
52
|
+
export function onMessage(messaging, nextOrObserver) {
|
53
|
+
return messaging.onMessage(nextOrObserver);
|
54
|
+
}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* When the user presses a notification displayed via FCM, this listener will be called if the app
|
58
|
+
* has opened from a background state.
|
59
|
+
* @param messaging Messaging instance.
|
60
|
+
* @param listener Called with a `RemoteMessage` when a notification press opens the application.
|
61
|
+
* @returns {Function}
|
62
|
+
*/
|
63
|
+
export function onNotificationOpenedApp(messaging, listener) {
|
64
|
+
return messaging.onNotificationOpenedApp(listener);
|
65
|
+
}
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Called when a new registration token is generated for the device. For example, this event can happen when a
|
69
|
+
* token expires or when the server invalidates the token.
|
70
|
+
* > This subscriber method is only called when the app is active (in the foreground).
|
71
|
+
* @param messaging Messaging instance.
|
72
|
+
* @param listener Called with a FCM token when the token is refreshed.
|
73
|
+
* @returns {Function}
|
74
|
+
*/
|
75
|
+
export function onTokenRefresh(messaging, listener) {
|
76
|
+
return messaging.onTokenRefresh(listener);
|
77
|
+
}
|
78
|
+
|
79
|
+
/**
|
80
|
+
* On iOS, messaging permission must be requested by the current application before messages can
|
81
|
+
* be received or sent.
|
82
|
+
* @param messaging Messaging instance.
|
83
|
+
* @param iosPermissions All the available permissions for iOS that can be requested
|
84
|
+
* @returns {Promise<AuthorizationStatus>}
|
85
|
+
*/
|
86
|
+
export function requestPermission(messaging, iosPermissions) {
|
87
|
+
return messaging.requestPermission(iosPermissions);
|
88
|
+
}
|
89
|
+
|
90
|
+
/**
|
91
|
+
* Returns whether messaging auto initialization is enabled or disabled for the device.
|
92
|
+
* @param messaging Messaging instance.
|
93
|
+
* @returns {boolean}
|
94
|
+
*/
|
95
|
+
export function isAutoInitEnabled(messaging) {
|
96
|
+
return messaging.isAutoInitEnabled;
|
97
|
+
}
|
98
|
+
|
99
|
+
/**
|
100
|
+
* Returns whether messaging auto initialization is enabled or disabled for the device.
|
101
|
+
* @param messaging Messaging instance.
|
102
|
+
* @param enabled A boolean value to enable or disable auto initialization.
|
103
|
+
* @returns {Promise<boolean>}
|
104
|
+
*/
|
105
|
+
export function setAutoInitEnabled(messaging, enabled) {
|
106
|
+
return messaging.setAutoInitEnabled(enabled);
|
107
|
+
}
|
108
|
+
|
109
|
+
/**
|
110
|
+
* When a notification from FCM has triggered the application to open from a quit state,
|
111
|
+
* this method will return a `RemoteMessage` containing the notification data, or `null` if
|
112
|
+
* the app was opened via another method.
|
113
|
+
* @param messaging Messaging instance.
|
114
|
+
* @returns {Promise<RemoteMessage | null>}
|
115
|
+
*/
|
116
|
+
export function getInitialNotification(messaging) {
|
117
|
+
return messaging.getInitialNotification();
|
118
|
+
}
|
119
|
+
|
120
|
+
/**
|
121
|
+
* When the app is opened from iOS notifications settings from a quit state,
|
122
|
+
* this method will return `true` or `false` if the app was opened via another method.
|
123
|
+
* @param messaging Messaging instance.
|
124
|
+
* @returns {Promise<boolean>}
|
125
|
+
*/
|
126
|
+
export function getDidOpenSettingsForNotification(messaging) {
|
127
|
+
return messaging.getDidOpenSettingsForNotification();
|
128
|
+
}
|
129
|
+
|
130
|
+
/**
|
131
|
+
* Returns whether the root view is headless or not
|
132
|
+
* i.e true if the app was launched in the background (for example, by data-only cloud message)
|
133
|
+
* @param messaging Messaging instance.
|
134
|
+
* @returns {Promise<boolean>}
|
135
|
+
*/
|
136
|
+
export function getIsHeadless(messaging) {
|
137
|
+
return messaging.getIsHeadless();
|
138
|
+
}
|
139
|
+
|
140
|
+
/**
|
141
|
+
* On iOS, if your app wants to receive remote messages from FCM (via APNs), you must explicitly register
|
142
|
+
* with APNs if auto-registration has been disabled.
|
143
|
+
* @param messaging Messaging instance.
|
144
|
+
* @returns {Promise<void>}
|
145
|
+
*/
|
146
|
+
export function registerDeviceForRemoteMessages(messaging) {
|
147
|
+
return messaging.registerDeviceForRemoteMessages();
|
148
|
+
}
|
149
|
+
|
150
|
+
/**
|
151
|
+
* Returns a boolean value whether the user has registered for remote notifications via
|
152
|
+
* `registerDeviceForRemoteMessages()`. For iOS. Android always returns `true`
|
153
|
+
* @param messaging Messaging instance.
|
154
|
+
* @returns {boolean}
|
155
|
+
*/
|
156
|
+
export function isDeviceRegisteredForRemoteMessages(messaging) {
|
157
|
+
return messaging.isDeviceRegisteredForRemoteMessages;
|
158
|
+
}
|
159
|
+
|
160
|
+
/**
|
161
|
+
* Unregisters the app from receiving remote notifications.
|
162
|
+
* @param messaging Messaging instance.
|
163
|
+
* @returns {Promise<void>}
|
164
|
+
*/
|
165
|
+
export function unregisterDeviceForRemoteMessages(messaging) {
|
166
|
+
return messaging.unregisterDeviceForRemoteMessages();
|
167
|
+
}
|
168
|
+
|
169
|
+
/**
|
170
|
+
* On iOS, it is possible to get the users APNs token. This may be required if you want to send messages to your
|
171
|
+
* iOS devices without using the FCM service.
|
172
|
+
* @param messaging Messaging instance.
|
173
|
+
* @returns {Promise<string | null>}
|
174
|
+
*/
|
175
|
+
export function getAPNSToken(messaging) {
|
176
|
+
return messaging.getAPNSToken();
|
177
|
+
}
|
178
|
+
|
179
|
+
/**
|
180
|
+
* Returns a `AuthorizationStatus` as to whether the user has messaging permission for this app.
|
181
|
+
* @param messaging Messaging instance.
|
182
|
+
* @returns {Promise<AuthorizationStatus>}
|
183
|
+
*/
|
184
|
+
export function hasPermission(messaging) {
|
185
|
+
return messaging.hasPermission();
|
186
|
+
}
|
187
|
+
|
188
|
+
/**
|
189
|
+
* Called when the FCM server deletes pending messages.
|
190
|
+
* @param messaging Messaging instance.
|
191
|
+
* @param listener Called when the FCM deletes pending messages.
|
192
|
+
* @returns {Function}
|
193
|
+
*/
|
194
|
+
export function onDeletedMessages(messaging, listener) {
|
195
|
+
return messaging.onDeletedMessages(listener);
|
196
|
+
}
|
197
|
+
|
198
|
+
/**
|
199
|
+
* When sending a `RemoteMessage`, this listener is called when the message has been sent to FCM.
|
200
|
+
* @param messaging Messaging instance.
|
201
|
+
* @param listener Called when the FCM sends the remote message to FCM.
|
202
|
+
* @returns {Function}
|
203
|
+
*/
|
204
|
+
export function onMessageSent(messaging, listener) {
|
205
|
+
return messaging.onMessageSent(listener);
|
206
|
+
}
|
207
|
+
|
208
|
+
/**
|
209
|
+
* When sending a `RemoteMessage`, this listener is called when the message has been sent to FCM.
|
210
|
+
* @param messaging Messaging instance.
|
211
|
+
* @param listener Called when the FCM sends the remote message to FCM.
|
212
|
+
* @returns {Function}
|
213
|
+
*/
|
214
|
+
export function onSendError(messaging, listener) {
|
215
|
+
return messaging.onSendError(listener);
|
216
|
+
}
|
217
|
+
|
218
|
+
/**
|
219
|
+
* Set a message handler function which is called when the app is in the background
|
220
|
+
* or terminated. In Android, a headless task is created, allowing you to access the React Native environment
|
221
|
+
* to perform tasks such as updating local storage, or sending a network request.
|
222
|
+
* @param messaging Messaging instance.
|
223
|
+
* @param handler Called when a message is sent and the application is in a background or terminated state.
|
224
|
+
* @returns {void}
|
225
|
+
*/
|
226
|
+
export function setBackgroundMessageHandler(messaging, handler) {
|
227
|
+
return messaging.setBackgroundMessageHandler(handler);
|
228
|
+
}
|
229
|
+
|
230
|
+
/**
|
231
|
+
* Set a handler function which is called when the `${App Name} notifications settings`
|
232
|
+
* link in iOS settings is clicked.
|
233
|
+
* @param messaging Messaging instance.
|
234
|
+
* @param handler Called when link in iOS settings is clicked
|
235
|
+
* @returns {void}
|
236
|
+
*/
|
237
|
+
export function setOpenSettingsForNotificationsHandler(messaging, handler) {
|
238
|
+
return messaging.setOpenSettingsForNotificationsHandler(handler);
|
239
|
+
}
|
240
|
+
|
241
|
+
/**
|
242
|
+
* Send a new `RemoteMessage` to the FCM server.
|
243
|
+
* @param messaging Messaging instance.
|
244
|
+
* @param message A `RemoteMessage` interface.
|
245
|
+
* @returns {Promise<void>}
|
246
|
+
*/
|
247
|
+
export function sendMessage(messaging, message) {
|
248
|
+
return messaging.sendMessage(message);
|
249
|
+
}
|
250
|
+
|
251
|
+
/**
|
252
|
+
* Apps can subscribe to a topic, which allows the FCM server to send targeted messages to only those
|
253
|
+
* devices subscribed to that topic.
|
254
|
+
* @param messaging Messaging instance.
|
255
|
+
* @param topic The topic name.
|
256
|
+
* @returns {Promise<void>}
|
257
|
+
*/
|
258
|
+
export function subscribeToTopic(messaging, topic) {
|
259
|
+
return messaging.subscribeToTopic(topic);
|
260
|
+
}
|
261
|
+
|
262
|
+
/**
|
263
|
+
* Unsubscribe the device from a topic.
|
264
|
+
* @param messaging Messaging instance.
|
265
|
+
* @param topic The topic name.
|
266
|
+
* @returns {Promise<void>}
|
267
|
+
*/
|
268
|
+
export function unsubscribeFromTopic(messaging, topic) {
|
269
|
+
return messaging.unsubscribeFromTopic(topic);
|
270
|
+
}
|
271
|
+
|
272
|
+
/**
|
273
|
+
* Returns a boolean whether message delivery metrics are exported to BigQuery.
|
274
|
+
* @param messaging Messaging instance.
|
275
|
+
* @returns {boolean}
|
276
|
+
*/
|
277
|
+
export function isDeliveryMetricsExportToBigQueryEnabled(messaging) {
|
278
|
+
return messaging.isDeliveryMetricsExportToBigQueryEnabled;
|
279
|
+
}
|
280
|
+
|
281
|
+
/**
|
282
|
+
* Checks if all required APIs exist in the browser.
|
283
|
+
* @param messaging Messaging instance.
|
284
|
+
* @returns {boolean}
|
285
|
+
*/
|
286
|
+
export function isSupported(messaging) {
|
287
|
+
return messaging.isSupported();
|
288
|
+
}
|
289
|
+
|
290
|
+
/**
|
291
|
+
* Sets whether message delivery metrics are exported to BigQuery is enabled or disabled.
|
292
|
+
* The value is false by default. Set this to true to allow exporting of message delivery metrics to BigQuery.
|
293
|
+
* @param messaging Messaging instance.
|
294
|
+
* @param enabled A boolean value to enable or disable exporting of message delivery metrics to BigQuery.
|
295
|
+
* @returns {Promise<void>}
|
296
|
+
*/
|
297
|
+
export function experimentalSetDeliveryMetricsExportedToBigQueryEnabled(messaging, enable) {
|
298
|
+
return messaging.setDeliveryMetricsExportToBigQuery(enable);
|
299
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-native-firebase/messaging",
|
3
|
-
"version": "16.
|
3
|
+
"version": "16.6.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",
|
@@ -22,10 +22,10 @@
|
|
22
22
|
"messaging"
|
23
23
|
],
|
24
24
|
"peerDependencies": {
|
25
|
-
"@react-native-firebase/app": "16.
|
25
|
+
"@react-native-firebase/app": "16.6.0"
|
26
26
|
},
|
27
27
|
"publishConfig": {
|
28
28
|
"access": "public"
|
29
29
|
},
|
30
|
-
"gitHead": "
|
30
|
+
"gitHead": "6663dc24dc5697190b930aa510085a681fe81203"
|
31
31
|
}
|