@react-native-firebase/messaging 23.8.3 → 23.8.4
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 +7 -0
- package/dist/module/modular.js +2 -2
- package/dist/module/modular.js.map +1 -1
- package/dist/module/namespaced.js +2 -2
- package/dist/module/namespaced.js.map +1 -1
- package/dist/module/remoteMessageOptions.js +1 -1
- package/dist/module/remoteMessageOptions.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/typescript/lib/index.d.ts.map +1 -0
- package/dist/typescript/lib/modular.d.ts.map +1 -0
- package/dist/typescript/{commonjs/lib → lib}/namespaced.d.ts +1 -1
- package/dist/typescript/lib/namespaced.d.ts.map +1 -0
- package/dist/typescript/lib/remoteMessageOptions.d.ts.map +1 -0
- package/dist/typescript/lib/statics.d.ts.map +1 -0
- package/dist/typescript/lib/types/messaging.d.ts.map +1 -0
- package/dist/typescript/lib/version.d.ts +2 -0
- package/dist/typescript/lib/version.d.ts.map +1 -0
- package/lib/modular.ts +2 -2
- package/lib/namespaced.ts +2 -2
- package/lib/remoteMessageOptions.ts +1 -1
- package/lib/version.ts +1 -1
- package/package.json +7 -20
- package/tsconfig.json +8 -8
- package/dist/commonjs/index.js +0 -61
- package/dist/commonjs/index.js.map +0 -1
- package/dist/commonjs/modular.js +0 -439
- package/dist/commonjs/modular.js.map +0 -1
- package/dist/commonjs/namespaced.js +0 -407
- package/dist/commonjs/namespaced.js.map +0 -1
- package/dist/commonjs/package.json +0 -1
- package/dist/commonjs/remoteMessageOptions.js +0 -87
- package/dist/commonjs/remoteMessageOptions.js.map +0 -1
- package/dist/commonjs/statics.js +0 -29
- package/dist/commonjs/statics.js.map +0 -1
- package/dist/commonjs/types/messaging.js +0 -105
- package/dist/commonjs/types/messaging.js.map +0 -1
- package/dist/commonjs/version.js +0 -9
- package/dist/commonjs/version.js.map +0 -1
- package/dist/typescript/commonjs/lib/index.d.ts.map +0 -1
- package/dist/typescript/commonjs/lib/modular.d.ts.map +0 -1
- package/dist/typescript/commonjs/lib/namespaced.d.ts.map +0 -1
- package/dist/typescript/commonjs/lib/remoteMessageOptions.d.ts.map +0 -1
- package/dist/typescript/commonjs/lib/statics.d.ts.map +0 -1
- package/dist/typescript/commonjs/lib/types/messaging.d.ts.map +0 -1
- package/dist/typescript/commonjs/lib/version.d.ts +0 -2
- package/dist/typescript/commonjs/lib/version.d.ts.map +0 -1
- package/dist/typescript/commonjs/package.json +0 -1
- package/dist/typescript/module/lib/index.d.ts +0 -6
- package/dist/typescript/module/lib/index.d.ts.map +0 -1
- package/dist/typescript/module/lib/modular.d.ts +0 -247
- package/dist/typescript/module/lib/modular.d.ts.map +0 -1
- package/dist/typescript/module/lib/namespaced.d.ts +0 -12
- package/dist/typescript/module/lib/namespaced.d.ts.map +0 -1
- package/dist/typescript/module/lib/remoteMessageOptions.d.ts +0 -14
- package/dist/typescript/module/lib/remoteMessageOptions.d.ts.map +0 -1
- package/dist/typescript/module/lib/statics.d.ts +0 -20
- package/dist/typescript/module/lib/statics.d.ts.map +0 -1
- package/dist/typescript/module/lib/types/messaging.d.ts +0 -673
- package/dist/typescript/module/lib/types/messaging.d.ts.map +0 -1
- package/dist/typescript/module/lib/version.d.ts +0 -2
- package/dist/typescript/module/lib/version.d.ts.map +0 -1
- /package/dist/typescript/{commonjs/lib → lib}/index.d.ts +0 -0
- /package/dist/typescript/{commonjs/lib → lib}/modular.d.ts +0 -0
- /package/dist/typescript/{commonjs/lib → lib}/remoteMessageOptions.d.ts +0 -0
- /package/dist/typescript/{commonjs/lib → lib}/statics.d.ts +0 -0
- /package/dist/typescript/{commonjs/lib → lib}/types/messaging.d.ts +0 -0
- /package/dist/typescript/{module/package.json → package.json} +0 -0
package/dist/commonjs/modular.js
DELETED
|
@@ -1,439 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "AuthorizationStatus", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _statics.AuthorizationStatus;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "NotificationAndroidPriority", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _statics.NotificationAndroidPriority;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "NotificationAndroidVisibility", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _statics.NotificationAndroidVisibility;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
exports.deleteToken = deleteToken;
|
|
25
|
-
exports.experimentalSetDeliveryMetricsExportedToBigQueryEnabled = experimentalSetDeliveryMetricsExportedToBigQueryEnabled;
|
|
26
|
-
exports.getAPNSToken = getAPNSToken;
|
|
27
|
-
exports.getDidOpenSettingsForNotification = getDidOpenSettingsForNotification;
|
|
28
|
-
exports.getInitialNotification = getInitialNotification;
|
|
29
|
-
exports.getIsHeadless = getIsHeadless;
|
|
30
|
-
exports.getMessaging = getMessaging;
|
|
31
|
-
exports.getToken = getToken;
|
|
32
|
-
exports.hasPermission = hasPermission;
|
|
33
|
-
exports.isAutoInitEnabled = isAutoInitEnabled;
|
|
34
|
-
exports.isDeliveryMetricsExportToBigQueryEnabled = isDeliveryMetricsExportToBigQueryEnabled;
|
|
35
|
-
exports.isDeviceRegisteredForRemoteMessages = isDeviceRegisteredForRemoteMessages;
|
|
36
|
-
exports.isNotificationDelegationEnabled = isNotificationDelegationEnabled;
|
|
37
|
-
exports.isSupported = isSupported;
|
|
38
|
-
exports.onDeletedMessages = onDeletedMessages;
|
|
39
|
-
exports.onMessage = onMessage;
|
|
40
|
-
exports.onMessageSent = onMessageSent;
|
|
41
|
-
exports.onNotificationOpenedApp = onNotificationOpenedApp;
|
|
42
|
-
exports.onSendError = onSendError;
|
|
43
|
-
exports.onTokenRefresh = onTokenRefresh;
|
|
44
|
-
exports.registerDeviceForRemoteMessages = registerDeviceForRemoteMessages;
|
|
45
|
-
exports.requestPermission = requestPermission;
|
|
46
|
-
exports.sendMessage = sendMessage;
|
|
47
|
-
exports.setAPNSToken = setAPNSToken;
|
|
48
|
-
exports.setAutoInitEnabled = setAutoInitEnabled;
|
|
49
|
-
exports.setBackgroundMessageHandler = setBackgroundMessageHandler;
|
|
50
|
-
exports.setNotificationDelegationEnabled = setNotificationDelegationEnabled;
|
|
51
|
-
exports.setOpenSettingsForNotificationsHandler = setOpenSettingsForNotificationsHandler;
|
|
52
|
-
exports.subscribeToTopic = subscribeToTopic;
|
|
53
|
-
exports.unregisterDeviceForRemoteMessages = unregisterDeviceForRemoteMessages;
|
|
54
|
-
exports.unsubscribeFromTopic = unsubscribeFromTopic;
|
|
55
|
-
var _app = require("@react-native-firebase/app");
|
|
56
|
-
var _common = require("@react-native-firebase/app/lib/common");
|
|
57
|
-
var _statics = require("./statics.js");
|
|
58
|
-
/*
|
|
59
|
-
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
60
|
-
*
|
|
61
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
62
|
-
* you may not use this library except in compliance with the License.
|
|
63
|
-
* You may obtain a copy of the License at
|
|
64
|
-
*
|
|
65
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
66
|
-
*
|
|
67
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
68
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
69
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
70
|
-
* See the License for the specific language governing permissions and
|
|
71
|
-
* limitations under the License.
|
|
72
|
-
*
|
|
73
|
-
*/
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Returns a Messaging instance for the given app.
|
|
77
|
-
* @param app - FirebaseApp. Optional.
|
|
78
|
-
* @returns Messaging instance
|
|
79
|
-
*/
|
|
80
|
-
function getMessaging(app) {
|
|
81
|
-
if (app) {
|
|
82
|
-
return (0, _app.getApp)(app.name).messaging();
|
|
83
|
-
}
|
|
84
|
-
return (0, _app.getApp)().messaging();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Removes access to an FCM token previously authorized by its scope.
|
|
89
|
-
* Messages sent by the server to this token will fail.
|
|
90
|
-
* @param messaging - Messaging instance.
|
|
91
|
-
* @param tokenOptions - Options to override senderId (iOS) and projectId (Android).
|
|
92
|
-
* @returns Promise that resolves when the token is deleted.
|
|
93
|
-
*/
|
|
94
|
-
function deleteToken(messaging, tokenOptions) {
|
|
95
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
96
|
-
return messaging.deleteToken.call(messaging, tokenOptions, _common.MODULAR_DEPRECATION_ARG);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Returns an FCM token for this device. Optionally, you can specify custom options for your own use case.
|
|
101
|
-
* @param messaging - Messaging instance.
|
|
102
|
-
* @param options - Options to override senderId (iOS) and appName.
|
|
103
|
-
* @returns Promise that resolves with the FCM token.
|
|
104
|
-
*/
|
|
105
|
-
function getToken(messaging, options) {
|
|
106
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
107
|
-
return messaging.getToken.call(messaging, options, _common.MODULAR_DEPRECATION_ARG);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* When any FCM payload is received, the listener callback is called with a `RemoteMessage`.
|
|
112
|
-
* > This subscriber method is only called when the app is active (in the foreground).
|
|
113
|
-
* @param messaging - Messaging instance.
|
|
114
|
-
* @param listener - Called with a `RemoteMessage` when a new FCM payload is received from the server.
|
|
115
|
-
* @returns Function to unsubscribe from the message listener.
|
|
116
|
-
*/
|
|
117
|
-
function onMessage(messaging, listener) {
|
|
118
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
119
|
-
return messaging.onMessage.call(messaging, listener, _common.MODULAR_DEPRECATION_ARG);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* When the user presses a notification displayed via FCM, this listener will be called if the app
|
|
124
|
-
* has opened from a background state.
|
|
125
|
-
* @param messaging - Messaging instance.
|
|
126
|
-
* @param listener - Called with a `RemoteMessage` when a notification press opens the application.
|
|
127
|
-
* @returns Function to unsubscribe from the notification opened listener.
|
|
128
|
-
*/
|
|
129
|
-
function onNotificationOpenedApp(messaging, listener) {
|
|
130
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
131
|
-
return messaging.onNotificationOpenedApp.call(messaging, listener, _common.MODULAR_DEPRECATION_ARG);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Called when a new registration token is generated for the device. For example, this event can happen when a
|
|
136
|
-
* token expires or when the server invalidates the token.
|
|
137
|
-
* > This subscriber method is only called when the app is active (in the foreground).
|
|
138
|
-
* @param messaging - Messaging instance.
|
|
139
|
-
* @param listener - Called with a FCM token when the token is refreshed.
|
|
140
|
-
* @returns Function to unsubscribe from the token refresh listener.
|
|
141
|
-
*/
|
|
142
|
-
function onTokenRefresh(messaging, listener) {
|
|
143
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
144
|
-
return messaging.onTokenRefresh.call(messaging, listener, _common.MODULAR_DEPRECATION_ARG);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* On iOS, messaging permission must be requested by the current application before messages can
|
|
149
|
-
* be received or sent.
|
|
150
|
-
* @param messaging - Messaging instance.
|
|
151
|
-
* @param iosPermissions - All the available permissions for iOS that can be requested.
|
|
152
|
-
* @returns Promise that resolves with the authorization status.
|
|
153
|
-
*/
|
|
154
|
-
function requestPermission(messaging, iosPermissions) {
|
|
155
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
156
|
-
return messaging.requestPermission.call(messaging, iosPermissions, _common.MODULAR_DEPRECATION_ARG);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Returns whether messaging auto initialization is enabled or disabled for the device.
|
|
161
|
-
* @param messaging - Messaging instance.
|
|
162
|
-
* @returns Boolean indicating whether auto initialization is enabled.
|
|
163
|
-
*/
|
|
164
|
-
function isAutoInitEnabled(messaging) {
|
|
165
|
-
return (0, _common.withModularFlag)(() => messaging.isAutoInitEnabled);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Sets whether messaging auto initialization is enabled or disabled for the device.
|
|
170
|
-
* @param messaging - Messaging instance.
|
|
171
|
-
* @param enabled - A boolean value to enable or disable auto initialization.
|
|
172
|
-
* @returns Promise that resolves when the setting is updated.
|
|
173
|
-
*/
|
|
174
|
-
function setAutoInitEnabled(messaging, enabled) {
|
|
175
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
176
|
-
return messaging.setAutoInitEnabled.call(messaging, enabled, _common.MODULAR_DEPRECATION_ARG);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* When a notification from FCM has triggered the application to open from a quit state,
|
|
181
|
-
* this method will return a `RemoteMessage` containing the notification data, or `null` if
|
|
182
|
-
* the app was opened via another method.
|
|
183
|
-
* @param messaging - Messaging instance.
|
|
184
|
-
* @returns Promise that resolves with the initial notification or null.
|
|
185
|
-
*/
|
|
186
|
-
function getInitialNotification(messaging) {
|
|
187
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
188
|
-
return messaging.getInitialNotification.call(messaging, _common.MODULAR_DEPRECATION_ARG);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* When the app is opened from iOS notifications settings from a quit state,
|
|
193
|
-
* this method will return `true` or `false` if the app was opened via another method.
|
|
194
|
-
* @param messaging - Messaging instance.
|
|
195
|
-
* @returns Promise that resolves with a boolean indicating if the app was opened from settings.
|
|
196
|
-
*/
|
|
197
|
-
function getDidOpenSettingsForNotification(messaging) {
|
|
198
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
199
|
-
return messaging.getDidOpenSettingsForNotification.call(messaging, _common.MODULAR_DEPRECATION_ARG);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Returns whether the root view is headless or not
|
|
204
|
-
* i.e true if the app was launched in the background (for example, by data-only cloud message)
|
|
205
|
-
* @param messaging - Messaging instance.
|
|
206
|
-
* @returns Promise that resolves with a boolean indicating if the app is headless.
|
|
207
|
-
*/
|
|
208
|
-
function getIsHeadless(messaging) {
|
|
209
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
210
|
-
return messaging.getIsHeadless.call(messaging, _common.MODULAR_DEPRECATION_ARG);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* On iOS, if your app wants to receive remote messages from FCM (via APNs), you must explicitly register
|
|
215
|
-
* with APNs if auto-registration has been disabled.
|
|
216
|
-
* @param messaging - Messaging instance.
|
|
217
|
-
* @returns Promise that resolves when the device is registered.
|
|
218
|
-
*/
|
|
219
|
-
function registerDeviceForRemoteMessages(messaging) {
|
|
220
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
221
|
-
return messaging.registerDeviceForRemoteMessages.call(messaging, _common.MODULAR_DEPRECATION_ARG);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Returns a boolean value whether the user has registered for remote notifications via
|
|
226
|
-
* `registerDeviceForRemoteMessages()`. For iOS. Android always returns `true`.
|
|
227
|
-
* @param messaging - Messaging instance.
|
|
228
|
-
* @returns Boolean indicating if the device is registered for remote messages.
|
|
229
|
-
*/
|
|
230
|
-
function isDeviceRegisteredForRemoteMessages(messaging) {
|
|
231
|
-
return (0, _common.withModularFlag)(() => messaging.isDeviceRegisteredForRemoteMessages);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Unregisters the app from receiving remote notifications.
|
|
236
|
-
* @param messaging - Messaging instance.
|
|
237
|
-
* @returns Promise that resolves when the device is unregistered.
|
|
238
|
-
*/
|
|
239
|
-
function unregisterDeviceForRemoteMessages(messaging) {
|
|
240
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
241
|
-
return messaging.unregisterDeviceForRemoteMessages.call(messaging, _common.MODULAR_DEPRECATION_ARG);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* On iOS, it is possible to get the users APNs token. This may be required if you want to send messages to your
|
|
246
|
-
* iOS devices without using the FCM service.
|
|
247
|
-
* @param messaging - Messaging instance.
|
|
248
|
-
* @returns Promise that resolves with the APNs token or null.
|
|
249
|
-
*/
|
|
250
|
-
function getAPNSToken(messaging) {
|
|
251
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
252
|
-
return messaging.getAPNSToken.call(messaging, _common.MODULAR_DEPRECATION_ARG);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* On iOS, This method is used to set the APNs Token received by the application delegate.
|
|
257
|
-
* Note that the token is expected to be a hexadecimal string, as it is an NSData type in
|
|
258
|
-
* the underlying native firebase SDK, and raw data may only be passed as a string if it is
|
|
259
|
-
* hex encoded. Calling code is responsible for correct encoding, you should verify by comparing
|
|
260
|
-
* the results of `getAPNSToken()` with your token parameter to make sure they are equivalent.
|
|
261
|
-
*
|
|
262
|
-
* Messaging uses method swizzling to ensure that the APNs token is set automatically.
|
|
263
|
-
* However, if you have disabled swizzling by setting FirebaseAppDelegateProxyEnabled to NO
|
|
264
|
-
* in your app's Info.plist, you should manually set the APNs token in your application
|
|
265
|
-
* delegate's application(_:didRegisterForRemoteNotificationsWithDeviceToken:) method.
|
|
266
|
-
*
|
|
267
|
-
* If you would like to set the type of the APNs token, rather than relying on automatic
|
|
268
|
-
* detection, provide a type of either 'prod', 'sandbox'. Omitting the type parameter
|
|
269
|
-
* or specifying 'unknown' will rely on automatic type detection based on provisioning profile.
|
|
270
|
-
*
|
|
271
|
-
* At a native level you may also call objective-c `[FIRMessaging setAPNSToken];` as needed.
|
|
272
|
-
*
|
|
273
|
-
* @param messaging - Messaging instance.
|
|
274
|
-
* @param token - A hexadecimal string representing your APNs token.
|
|
275
|
-
* @param type - Optional. A string specifying 'prod', 'sandbox' or 'unknown' token type.
|
|
276
|
-
* @returns Promise that resolves when the APNs token is set.
|
|
277
|
-
*/
|
|
278
|
-
function setAPNSToken(messaging, token, type) {
|
|
279
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
280
|
-
return messaging.setAPNSToken.call(messaging, token, type, _common.MODULAR_DEPRECATION_ARG);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Returns a `AuthorizationStatus` as to whether the user has messaging permission for this app.
|
|
285
|
-
* @param messaging - Messaging instance.
|
|
286
|
-
* @returns Promise that resolves with the authorization status.
|
|
287
|
-
*/
|
|
288
|
-
function hasPermission(messaging) {
|
|
289
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
290
|
-
return messaging.hasPermission.call(messaging, _common.MODULAR_DEPRECATION_ARG);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Called when the FCM server deletes pending messages.
|
|
295
|
-
* @param messaging - Messaging instance.
|
|
296
|
-
* @param listener - Called when the FCM deletes pending messages.
|
|
297
|
-
* @returns Function to unsubscribe from the deleted messages listener.
|
|
298
|
-
*/
|
|
299
|
-
function onDeletedMessages(messaging, listener) {
|
|
300
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
301
|
-
return messaging.onDeletedMessages.call(messaging, listener, _common.MODULAR_DEPRECATION_ARG);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* When sending a `RemoteMessage`, this listener is called when the message has been sent to FCM.
|
|
306
|
-
* @param messaging - Messaging instance.
|
|
307
|
-
* @param listener - Called when the FCM sends the remote message to FCM.
|
|
308
|
-
* @returns Function to unsubscribe from the message sent listener.
|
|
309
|
-
*/
|
|
310
|
-
function onMessageSent(messaging, listener) {
|
|
311
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
312
|
-
return messaging.onMessageSent.call(messaging, listener, _common.MODULAR_DEPRECATION_ARG);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* When sending a `RemoteMessage`, this listener is called when an error is thrown and the
|
|
317
|
-
* message could not be sent.
|
|
318
|
-
* @param messaging - Messaging instance.
|
|
319
|
-
* @param listener - Called when the FCM sends the remote message to FCM.
|
|
320
|
-
* @returns Function to unsubscribe from the send error listener.
|
|
321
|
-
*/
|
|
322
|
-
function onSendError(messaging, listener) {
|
|
323
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
324
|
-
return messaging.onSendError.call(messaging, listener, _common.MODULAR_DEPRECATION_ARG);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* Set a message handler function which is called when the app is in the background
|
|
329
|
-
* or terminated. In Android, a headless task is created, allowing you to access the React Native environment
|
|
330
|
-
* to perform tasks such as updating local storage, or sending a network request.
|
|
331
|
-
* @param messaging - Messaging instance.
|
|
332
|
-
* @param handler - Called when a message is sent and the application is in a background or terminated state.
|
|
333
|
-
* @returns void
|
|
334
|
-
*/
|
|
335
|
-
function setBackgroundMessageHandler(messaging, handler) {
|
|
336
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
337
|
-
return messaging.setBackgroundMessageHandler.call(messaging, handler, _common.MODULAR_DEPRECATION_ARG);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Set a handler function which is called when the `${App Name} notifications settings`
|
|
342
|
-
* link in iOS settings is clicked.
|
|
343
|
-
* @param messaging - Messaging instance.
|
|
344
|
-
* @param handler - Called when link in iOS settings is clicked.
|
|
345
|
-
* @returns void
|
|
346
|
-
*/
|
|
347
|
-
function setOpenSettingsForNotificationsHandler(messaging, handler) {
|
|
348
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
349
|
-
return messaging.setOpenSettingsForNotificationsHandler.call(messaging, handler, _common.MODULAR_DEPRECATION_ARG);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* Send a new `RemoteMessage` to the FCM server.
|
|
354
|
-
* @param messaging - Messaging instance.
|
|
355
|
-
* @param message - A `RemoteMessage` interface.
|
|
356
|
-
* @returns Promise that resolves when the message is sent.
|
|
357
|
-
*/
|
|
358
|
-
function sendMessage(messaging, message) {
|
|
359
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
360
|
-
return messaging.sendMessage.call(messaging, message, _common.MODULAR_DEPRECATION_ARG);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* Apps can subscribe to a topic, which allows the FCM server to send targeted messages to only those
|
|
365
|
-
* devices subscribed to that topic.
|
|
366
|
-
* @param messaging - Messaging instance.
|
|
367
|
-
* @param topic - The topic name.
|
|
368
|
-
* @returns Promise that resolves when the subscription is complete.
|
|
369
|
-
*/
|
|
370
|
-
function subscribeToTopic(messaging, topic) {
|
|
371
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
372
|
-
return messaging.subscribeToTopic.call(messaging, topic, _common.MODULAR_DEPRECATION_ARG);
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* Unsubscribe the device from a topic.
|
|
377
|
-
* @param messaging - Messaging instance.
|
|
378
|
-
* @param topic - The topic name.
|
|
379
|
-
* @returns Promise that resolves when the unsubscription is complete.
|
|
380
|
-
*/
|
|
381
|
-
function unsubscribeFromTopic(messaging, topic) {
|
|
382
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
383
|
-
return messaging.unsubscribeFromTopic.call(messaging, topic, _common.MODULAR_DEPRECATION_ARG);
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
/**
|
|
387
|
-
* Returns a boolean whether message delivery metrics are exported to BigQuery.
|
|
388
|
-
* @param messaging - Messaging instance.
|
|
389
|
-
* @returns Boolean indicating if message delivery metrics are exported to BigQuery.
|
|
390
|
-
*/
|
|
391
|
-
function isDeliveryMetricsExportToBigQueryEnabled(messaging) {
|
|
392
|
-
return (0, _common.withModularFlag)(() => messaging.isDeliveryMetricsExportToBigQueryEnabled);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
* Returns a boolean whether message delegation is enabled. Android only,
|
|
397
|
-
* always returns false on iOS
|
|
398
|
-
* @param messaging - Messaging instance.
|
|
399
|
-
* @returns Boolean indicating if notification delegation is enabled.
|
|
400
|
-
*/
|
|
401
|
-
function isNotificationDelegationEnabled(messaging) {
|
|
402
|
-
return (0, _common.withModularFlag)(() => messaging.isNotificationDelegationEnabled);
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
/**
|
|
406
|
-
* Sets whether message notification delegation is enabled or disabled.
|
|
407
|
-
* The value is false by default. Set this to true to allow delegation of notification to Google Play Services.
|
|
408
|
-
* Note if true message handlers will not function on Android, and it has no effect on iOS
|
|
409
|
-
* @param messaging - Messaging instance.
|
|
410
|
-
* @param enabled - A boolean value to enable or disable delegation of messages to Google Play Services.
|
|
411
|
-
* @returns Promise that resolves when the setting is updated.
|
|
412
|
-
*/
|
|
413
|
-
function setNotificationDelegationEnabled(messaging, enabled) {
|
|
414
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
415
|
-
return messaging.setNotificationDelegationEnabled.call(messaging, enabled, _common.MODULAR_DEPRECATION_ARG);
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* Checks if all required APIs exist in the browser.
|
|
420
|
-
* @param messaging - Messaging instance.
|
|
421
|
-
* @returns Promise that resolves with a boolean indicating if the APIs are supported.
|
|
422
|
-
*/
|
|
423
|
-
function isSupported(messaging) {
|
|
424
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
425
|
-
return messaging.isSupported.call(messaging, _common.MODULAR_DEPRECATION_ARG);
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
/**
|
|
429
|
-
* Sets whether message delivery metrics are exported to BigQuery is enabled or disabled.
|
|
430
|
-
* The value is false by default. Set this to true to allow exporting of message delivery metrics to BigQuery.
|
|
431
|
-
* @param messaging - Messaging instance.
|
|
432
|
-
* @param enabled - A boolean value to enable or disable exporting of message delivery metrics to BigQuery.
|
|
433
|
-
* @returns Promise that resolves when the setting is updated.
|
|
434
|
-
*/
|
|
435
|
-
function experimentalSetDeliveryMetricsExportedToBigQueryEnabled(messaging, enabled) {
|
|
436
|
-
// @ts-ignore - MODULAR_DEPRECATION_ARG is used internally
|
|
437
|
-
return messaging.setDeliveryMetricsExportToBigQuery.call(messaging, enabled, _common.MODULAR_DEPRECATION_ARG);
|
|
438
|
-
}
|
|
439
|
-
//# sourceMappingURL=modular.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_app","require","_common","_statics","getMessaging","app","getApp","name","messaging","deleteToken","tokenOptions","call","MODULAR_DEPRECATION_ARG","getToken","options","onMessage","listener","onNotificationOpenedApp","onTokenRefresh","requestPermission","iosPermissions","isAutoInitEnabled","withModularFlag","setAutoInitEnabled","enabled","getInitialNotification","getDidOpenSettingsForNotification","getIsHeadless","registerDeviceForRemoteMessages","isDeviceRegisteredForRemoteMessages","unregisterDeviceForRemoteMessages","getAPNSToken","setAPNSToken","token","type","hasPermission","onDeletedMessages","onMessageSent","onSendError","setBackgroundMessageHandler","handler","setOpenSettingsForNotificationsHandler","sendMessage","message","subscribeToTopic","topic","unsubscribeFromTopic","isDeliveryMetricsExportToBigQueryEnabled","isNotificationDelegationEnabled","setNotificationDelegationEnabled","isSupported","experimentalSetDeliveryMetricsExportedToBigQueryEnabled","setDeliveryMetricsExportToBigQuery"],"sourceRoot":"../../lib","sources":["modular.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAwaA,IAAAE,QAAA,GAAAF,OAAA;AA1bA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACO,SAASG,YAAYA,CAACC,GAAqC,EAAa;EAC7E,IAAIA,GAAG,EAAE;IACP,OAAO,IAAAC,WAAM,EAACD,GAAG,CAACE,IAAI,CAAC,CAACC,SAAS,CAAC,CAAC;EACrC;EAEA,OAAO,IAAAF,WAAM,EAAC,CAAC,CAACE,SAAS,CAAC,CAAC;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CACzBD,SAAoB,EACpBE,YAAiC,EAClB;EACf;EACA,OAAOF,SAAS,CAACC,WAAW,CAACE,IAAI,CAACH,SAAS,EAAEE,YAAY,EAAEE,+BAAuB,CAAC;AACrF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,QAAQA,CACtBL,SAAoB,EACpBM,OAA8C,EAC7B;EACjB;EACA,OAAON,SAAS,CAACK,QAAQ,CAACF,IAAI,CAACH,SAAS,EAAEM,OAAO,EAAEF,+BAAuB,CAAC;AAC7E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,SAASA,CACvBP,SAAoB,EACpBQ,QAAyC,EAC7B;EACZ;EACA,OAAOR,SAAS,CAACO,SAAS,CAACJ,IAAI,CAACH,SAAS,EAAEQ,QAAQ,EAAEJ,+BAAuB,CAAC;AAC/E;;AAEA;AACA;AACA;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