@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
|
@@ -1,407 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.firebase = exports.default = exports.SDK_VERSION = void 0;
|
|
7
|
-
var _common = require("@react-native-firebase/app/lib/common");
|
|
8
|
-
var _internal = require("@react-native-firebase/app/lib/internal");
|
|
9
|
-
var _reactNative = require("react-native");
|
|
10
|
-
var _remoteMessageOptions = _interopRequireDefault(require("./remoteMessageOptions.js"));
|
|
11
|
-
var _version = require("./version.js");
|
|
12
|
-
var _statics = require("./statics.js");
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
/*
|
|
15
|
-
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
16
|
-
*
|
|
17
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
18
|
-
* you may not use this library except in compliance with the License.
|
|
19
|
-
* You may obtain a copy of the License at
|
|
20
|
-
*
|
|
21
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
-
*
|
|
23
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
24
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
25
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26
|
-
* See the License for the specific language governing permissions and
|
|
27
|
-
* limitations under the License.
|
|
28
|
-
*
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
const statics = {
|
|
32
|
-
AuthorizationStatus: _statics.AuthorizationStatus,
|
|
33
|
-
NotificationAndroidPriority: _statics.NotificationAndroidPriority,
|
|
34
|
-
NotificationAndroidVisibility: _statics.NotificationAndroidVisibility
|
|
35
|
-
};
|
|
36
|
-
const namespace = 'messaging';
|
|
37
|
-
const nativeModuleName = 'RNFBMessagingModule';
|
|
38
|
-
let backgroundMessageHandler;
|
|
39
|
-
let openSettingsForNotificationHandler;
|
|
40
|
-
let playServicesAvailability;
|
|
41
|
-
class FirebaseMessagingModule extends _internal.FirebaseModule {
|
|
42
|
-
constructor(app, config, customUrlOrRegion) {
|
|
43
|
-
super(app, config, customUrlOrRegion);
|
|
44
|
-
this._isAutoInitEnabled = this.native.isAutoInitEnabled != null ? this.native.isAutoInitEnabled : true;
|
|
45
|
-
this._isDeliveryMetricsExportToBigQueryEnabled = this.native.isDeliveryMetricsExportToBigQueryEnabled != null ? this.native.isDeliveryMetricsExportToBigQueryEnabled : false;
|
|
46
|
-
this._isRegisteredForRemoteNotifications = this.native.isRegisteredForRemoteNotifications != null ? this.native.isRegisteredForRemoteNotifications : true;
|
|
47
|
-
this._isNotificationDelegationEnabled = this.native.isNotificationDelegationEnabled != null ? this.native.isNotificationDelegationEnabled : false;
|
|
48
|
-
_reactNative.AppRegistry.registerHeadlessTask('ReactNativeFirebaseMessagingHeadlessTask', () => {
|
|
49
|
-
if (!backgroundMessageHandler) {
|
|
50
|
-
// eslint-disable-next-line no-console
|
|
51
|
-
console.warn('No background message handler has been set. Set a handler via the "setBackgroundMessageHandler" method.');
|
|
52
|
-
return () => Promise.resolve();
|
|
53
|
-
}
|
|
54
|
-
return remoteMessage => backgroundMessageHandler(remoteMessage);
|
|
55
|
-
});
|
|
56
|
-
if (_common.isIOS) {
|
|
57
|
-
this.emitter.addListener('messaging_message_received_background', remoteMessage => {
|
|
58
|
-
if (!backgroundMessageHandler) {
|
|
59
|
-
// eslint-disable-next-line no-console
|
|
60
|
-
console.warn('No background message handler has been set. Set a handler via the "setBackgroundMessageHandler" method.');
|
|
61
|
-
return Promise.resolve();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Ensure the handler is a promise
|
|
65
|
-
const handlerPromise = Promise.resolve(backgroundMessageHandler(remoteMessage));
|
|
66
|
-
handlerPromise.finally(() => {
|
|
67
|
-
this.native.completeNotificationProcessing();
|
|
68
|
-
});
|
|
69
|
-
return handlerPromise;
|
|
70
|
-
});
|
|
71
|
-
this.emitter.addListener('messaging_settings_for_notification_opened', remoteMessage => {
|
|
72
|
-
if (!openSettingsForNotificationHandler) {
|
|
73
|
-
// eslint-disable-next-line no-console
|
|
74
|
-
console.warn('No handler for notification settings link has been set. Set a handler via the "setOpenSettingsForNotificationsHandler" method');
|
|
75
|
-
return Promise.resolve();
|
|
76
|
-
}
|
|
77
|
-
return openSettingsForNotificationHandler(remoteMessage);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
get isAutoInitEnabled() {
|
|
82
|
-
return this._isAutoInitEnabled;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* @ios
|
|
87
|
-
*/
|
|
88
|
-
get isDeviceRegisteredForRemoteMessages() {
|
|
89
|
-
if (_common.isAndroid) {
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
return this._isRegisteredForRemoteNotifications;
|
|
93
|
-
}
|
|
94
|
-
get isNotificationDelegationEnabled() {
|
|
95
|
-
return this._isNotificationDelegationEnabled;
|
|
96
|
-
}
|
|
97
|
-
get isDeliveryMetricsExportToBigQueryEnabled() {
|
|
98
|
-
return this._isDeliveryMetricsExportToBigQueryEnabled;
|
|
99
|
-
}
|
|
100
|
-
setAutoInitEnabled(enabled) {
|
|
101
|
-
if (!(0, _common.isBoolean)(enabled)) {
|
|
102
|
-
throw new Error("firebase.messaging().setAutoInitEnabled(*) 'enabled' expected a boolean value.");
|
|
103
|
-
}
|
|
104
|
-
this._isAutoInitEnabled = enabled;
|
|
105
|
-
return this.native.setAutoInitEnabled(enabled);
|
|
106
|
-
}
|
|
107
|
-
getInitialNotification() {
|
|
108
|
-
return this.native.getInitialNotification().then(value => {
|
|
109
|
-
if (value) {
|
|
110
|
-
return value;
|
|
111
|
-
}
|
|
112
|
-
return null;
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
getDidOpenSettingsForNotification() {
|
|
116
|
-
if (!_common.isIOS) return Promise.resolve(false);
|
|
117
|
-
return this.native.getDidOpenSettingsForNotification().then(value => value);
|
|
118
|
-
}
|
|
119
|
-
getIsHeadless() {
|
|
120
|
-
return this.native.getIsHeadless();
|
|
121
|
-
}
|
|
122
|
-
getToken(options) {
|
|
123
|
-
if (!(0, _common.isUndefined)(options?.appName) && !(0, _common.isString)(options?.appName)) {
|
|
124
|
-
throw new Error("firebase.messaging().getToken(*) 'appName' expected a string.");
|
|
125
|
-
}
|
|
126
|
-
if (!(0, _common.isUndefined)(options?.senderId) && !(0, _common.isString)(options?.senderId)) {
|
|
127
|
-
throw new Error("firebase.messaging().getToken(*) 'senderId' expected a string.");
|
|
128
|
-
}
|
|
129
|
-
const appName = options?.appName || this.app.name;
|
|
130
|
-
const senderId = options?.senderId || this.app.options.messagingSenderId;
|
|
131
|
-
return this.native.getToken(appName, senderId);
|
|
132
|
-
}
|
|
133
|
-
deleteToken(options) {
|
|
134
|
-
if (!(0, _common.isUndefined)(options?.appName) && !(0, _common.isString)(options?.appName)) {
|
|
135
|
-
throw new Error("firebase.messaging().deleteToken(*) 'appName' expected a string.");
|
|
136
|
-
}
|
|
137
|
-
if (!(0, _common.isUndefined)(options?.senderId) && !(0, _common.isString)(options?.senderId)) {
|
|
138
|
-
throw new Error("firebase.messaging().deleteToken(*) 'senderId' expected a string.");
|
|
139
|
-
}
|
|
140
|
-
const appName = options?.appName || this.app.name;
|
|
141
|
-
const senderId = options?.senderId || this.app.options.messagingSenderId;
|
|
142
|
-
return this.native.deleteToken(appName, senderId);
|
|
143
|
-
}
|
|
144
|
-
onMessage(listener) {
|
|
145
|
-
if (!(0, _common.isFunction)(listener)) {
|
|
146
|
-
throw new Error("firebase.messaging().onMessage(*) 'listener' expected a function.");
|
|
147
|
-
}
|
|
148
|
-
const subscription = this.emitter.addListener('messaging_message_received', listener);
|
|
149
|
-
return () => subscription.remove();
|
|
150
|
-
}
|
|
151
|
-
onNotificationOpenedApp(listener) {
|
|
152
|
-
if (!(0, _common.isFunction)(listener)) {
|
|
153
|
-
throw new Error("firebase.messaging().onNotificationOpenedApp(*) 'listener' expected a function.");
|
|
154
|
-
}
|
|
155
|
-
const subscription = this.emitter.addListener('messaging_notification_opened', listener);
|
|
156
|
-
return () => subscription.remove();
|
|
157
|
-
}
|
|
158
|
-
onTokenRefresh(listener) {
|
|
159
|
-
if (!(0, _common.isFunction)(listener)) {
|
|
160
|
-
throw new Error("firebase.messaging().onTokenRefresh(*) 'listener' expected a function.");
|
|
161
|
-
}
|
|
162
|
-
const subscription = this.emitter.addListener('messaging_token_refresh', event => {
|
|
163
|
-
const {
|
|
164
|
-
token
|
|
165
|
-
} = event;
|
|
166
|
-
listener(token);
|
|
167
|
-
});
|
|
168
|
-
return () => subscription.remove();
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* @platform ios
|
|
173
|
-
*/
|
|
174
|
-
requestPermission(permissions) {
|
|
175
|
-
if (_common.isAndroid) {
|
|
176
|
-
return Promise.resolve(_statics.AuthorizationStatus.AUTHORIZED);
|
|
177
|
-
}
|
|
178
|
-
const defaultPermissions = {
|
|
179
|
-
alert: true,
|
|
180
|
-
announcement: false,
|
|
181
|
-
badge: true,
|
|
182
|
-
carPlay: true,
|
|
183
|
-
provisional: false,
|
|
184
|
-
sound: true,
|
|
185
|
-
criticalAlert: false,
|
|
186
|
-
providesAppNotificationSettings: false
|
|
187
|
-
};
|
|
188
|
-
if (!permissions) {
|
|
189
|
-
return this.native.requestPermission(defaultPermissions);
|
|
190
|
-
}
|
|
191
|
-
if (!(0, _common.isObject)(permissions)) {
|
|
192
|
-
throw new Error('firebase.messaging().requestPermission(*) expected an object value.');
|
|
193
|
-
}
|
|
194
|
-
Object.entries(permissions).forEach(([key, value]) => {
|
|
195
|
-
if (!(0, _common.hasOwnProperty)(defaultPermissions, key)) {
|
|
196
|
-
throw new Error(`firebase.messaging().requestPermission(*) unexpected key "${key}" provided to permissions object.`);
|
|
197
|
-
}
|
|
198
|
-
if (!(0, _common.isBoolean)(value)) {
|
|
199
|
-
throw new Error(`firebase.messaging().requestPermission(*) the permission "${key}" expected a boolean value.`);
|
|
200
|
-
}
|
|
201
|
-
defaultPermissions[key] = value;
|
|
202
|
-
});
|
|
203
|
-
return this.native.requestPermission(defaultPermissions);
|
|
204
|
-
}
|
|
205
|
-
registerDeviceForRemoteMessages() {
|
|
206
|
-
if (_common.isAndroid) {
|
|
207
|
-
return Promise.resolve();
|
|
208
|
-
}
|
|
209
|
-
const autoRegister = this.firebaseJson['messaging_ios_auto_register_for_remote_messages'];
|
|
210
|
-
if (autoRegister === undefined || autoRegister === true) {
|
|
211
|
-
// eslint-disable-next-line no-console
|
|
212
|
-
console.warn(`Usage of "messaging().registerDeviceForRemoteMessages()" is not required. You only need to register if auto-registration is disabled in your 'firebase.json' configuration file via the 'messaging_ios_auto_register_for_remote_messages' property.`);
|
|
213
|
-
}
|
|
214
|
-
this._isRegisteredForRemoteNotifications = true;
|
|
215
|
-
return this.native.registerForRemoteNotifications();
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* @platform ios
|
|
220
|
-
*/
|
|
221
|
-
unregisterDeviceForRemoteMessages() {
|
|
222
|
-
if (_common.isAndroid) {
|
|
223
|
-
return Promise.resolve();
|
|
224
|
-
}
|
|
225
|
-
this._isRegisteredForRemoteNotifications = false;
|
|
226
|
-
return this.native.unregisterForRemoteNotifications();
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* @platform ios
|
|
231
|
-
*/
|
|
232
|
-
getAPNSToken() {
|
|
233
|
-
if (_common.isAndroid) {
|
|
234
|
-
return Promise.resolve(null);
|
|
235
|
-
}
|
|
236
|
-
return this.native.getAPNSToken();
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* @platform ios
|
|
241
|
-
*/
|
|
242
|
-
setAPNSToken(token, type) {
|
|
243
|
-
if ((0, _common.isUndefined)(token) || !(0, _common.isString)(token)) {
|
|
244
|
-
throw new Error("firebase.messaging().setAPNSToken(*) 'token' expected a string value.");
|
|
245
|
-
}
|
|
246
|
-
if (!(0, _common.isUndefined)(type) && (!(0, _common.isString)(type) || !['prod', 'sandbox', 'unknown'].includes(type))) {
|
|
247
|
-
throw new Error("firebase.messaging().setAPNSToken(*) 'type' expected one of 'prod', 'sandbox', or 'unknown'.");
|
|
248
|
-
}
|
|
249
|
-
if (_common.isAndroid) {
|
|
250
|
-
return Promise.resolve();
|
|
251
|
-
}
|
|
252
|
-
return this.native.setAPNSToken(token, type);
|
|
253
|
-
}
|
|
254
|
-
hasPermission() {
|
|
255
|
-
return this.native.hasPermission();
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
// https://firebase.google.com/docs/reference/android/com/google/firebase/messaging/FirebaseMessagingService.html#public-void-ondeletedmessages-
|
|
259
|
-
onDeletedMessages(listener) {
|
|
260
|
-
if (!(0, _common.isFunction)(listener)) {
|
|
261
|
-
throw new Error("firebase.messaging().onDeletedMessages(*) 'listener' expected a function.");
|
|
262
|
-
}
|
|
263
|
-
const subscription = this.emitter.addListener('messaging_message_deleted', listener);
|
|
264
|
-
return () => subscription.remove();
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
// https://firebase.google.com/docs/reference/android/com/google/firebase/messaging/FirebaseMessagingService.html#onMessageSent(java.lang.String)
|
|
268
|
-
onMessageSent(listener) {
|
|
269
|
-
if (!(0, _common.isFunction)(listener)) {
|
|
270
|
-
throw new Error("firebase.messaging().onMessageSent(*) 'listener' expected a function.");
|
|
271
|
-
}
|
|
272
|
-
const subscription = this.emitter.addListener('messaging_message_sent', listener);
|
|
273
|
-
return () => {
|
|
274
|
-
subscription.remove();
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
// https://firebase.google.com/docs/reference/android/com/google/firebase/messaging/FirebaseMessagingService.html#onSendError(java.lang.String,%20java.lang.Exception)
|
|
279
|
-
onSendError(listener) {
|
|
280
|
-
if (!(0, _common.isFunction)(listener)) {
|
|
281
|
-
throw new Error("firebase.messaging().onSendError(*) 'listener' expected a function.");
|
|
282
|
-
}
|
|
283
|
-
const subscription = this.emitter.addListener('messaging_message_send_error', listener);
|
|
284
|
-
return () => subscription.remove();
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Set a handler that will be called when a message is received while the app is in the background.
|
|
289
|
-
* Should be called before the app is registered in `AppRegistry`, for example in `index.js`.
|
|
290
|
-
* An app is considered to be in the background if no active window is displayed.
|
|
291
|
-
* @param handler called with an argument of type messaging.RemoteMessage that must be async and return a Promise
|
|
292
|
-
*/
|
|
293
|
-
setBackgroundMessageHandler(handler) {
|
|
294
|
-
if (!(0, _common.isFunction)(handler)) {
|
|
295
|
-
throw new Error("firebase.messaging().setBackgroundMessageHandler(*) 'handler' expected a function.");
|
|
296
|
-
}
|
|
297
|
-
backgroundMessageHandler = handler;
|
|
298
|
-
if (_common.isIOS) {
|
|
299
|
-
this.native.signalBackgroundMessageHandlerSet();
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
setOpenSettingsForNotificationsHandler(handler) {
|
|
303
|
-
if (!_common.isIOS) {
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
if (!(0, _common.isFunction)(handler)) {
|
|
307
|
-
throw new Error("firebase.messaging().setOpenSettingsForNotificationsHandler(*) 'handler' expected a function.");
|
|
308
|
-
}
|
|
309
|
-
openSettingsForNotificationHandler = handler;
|
|
310
|
-
}
|
|
311
|
-
sendMessage(remoteMessage) {
|
|
312
|
-
if (_common.isIOS) {
|
|
313
|
-
throw new Error(`firebase.messaging().sendMessage() is only supported on Android devices.`);
|
|
314
|
-
}
|
|
315
|
-
let options;
|
|
316
|
-
try {
|
|
317
|
-
const senderId = this.app.options.messagingSenderId;
|
|
318
|
-
if (!senderId) {
|
|
319
|
-
throw new Error("'messagingSenderId' is required in Firebase app options.");
|
|
320
|
-
}
|
|
321
|
-
options = (0, _remoteMessageOptions.default)(senderId, remoteMessage);
|
|
322
|
-
} catch (e) {
|
|
323
|
-
throw new Error(`firebase.messaging().sendMessage(*) ${e.message}.`);
|
|
324
|
-
}
|
|
325
|
-
return this.native.sendMessage(options);
|
|
326
|
-
}
|
|
327
|
-
subscribeToTopic(topic) {
|
|
328
|
-
if (!(0, _common.isString)(topic)) {
|
|
329
|
-
throw new Error("firebase.messaging().subscribeToTopic(*) 'topic' expected a string value.");
|
|
330
|
-
}
|
|
331
|
-
if (topic.indexOf('/') > -1) {
|
|
332
|
-
throw new Error('firebase.messaging().subscribeToTopic(*) \'topic\' must not include "/".');
|
|
333
|
-
}
|
|
334
|
-
return this.native.subscribeToTopic(topic);
|
|
335
|
-
}
|
|
336
|
-
unsubscribeFromTopic(topic) {
|
|
337
|
-
if (!(0, _common.isString)(topic)) {
|
|
338
|
-
throw new Error("firebase.messaging().unsubscribeFromTopic(*) 'topic' expected a string value.");
|
|
339
|
-
}
|
|
340
|
-
if (topic.indexOf('/') > -1) {
|
|
341
|
-
throw new Error('firebase.messaging().unsubscribeFromTopic(*) \'topic\' must not include "/".');
|
|
342
|
-
}
|
|
343
|
-
return this.native.unsubscribeFromTopic(topic);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
/**
|
|
347
|
-
* unsupported
|
|
348
|
-
*/
|
|
349
|
-
|
|
350
|
-
useServiceWorker() {
|
|
351
|
-
// eslint-disable-next-line no-console
|
|
352
|
-
console.warn('firebase.messaging().useServiceWorker() is not supported on react-native-firebase.');
|
|
353
|
-
}
|
|
354
|
-
usePublicVapidKey() {
|
|
355
|
-
// eslint-disable-next-line no-console
|
|
356
|
-
console.warn('firebase.messaging().usePublicVapidKey() is not supported on react-native-firebase.');
|
|
357
|
-
}
|
|
358
|
-
setDeliveryMetricsExportToBigQuery(enabled) {
|
|
359
|
-
if (!(0, _common.isBoolean)(enabled)) {
|
|
360
|
-
throw new Error("firebase.messaging().setDeliveryMetricsExportToBigQuery(*) 'enabled' expected a boolean value.");
|
|
361
|
-
}
|
|
362
|
-
this._isDeliveryMetricsExportToBigQueryEnabled = enabled;
|
|
363
|
-
return this.native.setDeliveryMetricsExportToBigQuery(enabled);
|
|
364
|
-
}
|
|
365
|
-
setNotificationDelegationEnabled(enabled) {
|
|
366
|
-
if (!(0, _common.isBoolean)(enabled)) {
|
|
367
|
-
throw new Error("firebase.messaging().setNotificationDelegationEnabled(*) 'enabled' expected a boolean value.");
|
|
368
|
-
}
|
|
369
|
-
this._isNotificationDelegationEnabled = enabled;
|
|
370
|
-
if (_common.isIOS) {
|
|
371
|
-
return Promise.resolve();
|
|
372
|
-
}
|
|
373
|
-
return this.native.setNotificationDelegationEnabled(enabled);
|
|
374
|
-
}
|
|
375
|
-
async isSupported() {
|
|
376
|
-
if (_common.isAndroid) {
|
|
377
|
-
const firebase = (0, _internal.getFirebaseRoot)();
|
|
378
|
-
const app = this.app;
|
|
379
|
-
// @ts-ignore - secret "app" argument to avoid deprecation warning when getApp() is called under the hood
|
|
380
|
-
playServicesAvailability = firebase.utils(app).playServicesAvailability;
|
|
381
|
-
return playServicesAvailability.isAvailable;
|
|
382
|
-
}
|
|
383
|
-
// Always return "true" for iOS. Web will be implemented when it is supported
|
|
384
|
-
return true;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
// import { SDK_VERSION } from '@react-native-firebase/messaging';
|
|
389
|
-
const SDK_VERSION = exports.SDK_VERSION = _version.version;
|
|
390
|
-
|
|
391
|
-
// import messaging from '@react-native-firebase/messaging';
|
|
392
|
-
// messaging().X(...);
|
|
393
|
-
const messagingNamespace = (0, _internal.createModuleNamespace)({
|
|
394
|
-
statics,
|
|
395
|
-
version: _version.version,
|
|
396
|
-
namespace,
|
|
397
|
-
nativeModuleName,
|
|
398
|
-
nativeEvents: ['messaging_token_refresh', 'messaging_message_sent', 'messaging_message_deleted', 'messaging_message_received', 'messaging_message_send_error', 'messaging_notification_opened', ...(_common.isIOS ? ['messaging_message_received_background', 'messaging_settings_for_notification_opened'] : [])],
|
|
399
|
-
hasMultiAppSupport: false,
|
|
400
|
-
hasCustomUrlOrRegionSupport: false,
|
|
401
|
-
ModuleClass: FirebaseMessagingModule
|
|
402
|
-
});
|
|
403
|
-
var _default = exports.default = messagingNamespace; // import messaging, { firebase } from '@react-native-firebase/messaging';
|
|
404
|
-
// messaging().X(...);
|
|
405
|
-
// firebase.messaging().X(...);
|
|
406
|
-
const firebase = exports.firebase = (0, _internal.getFirebaseRoot)();
|
|
407
|
-
//# sourceMappingURL=namespaced.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_common","require","_internal","_reactNative","_remoteMessageOptions","_interopRequireDefault","_version","_statics","e","__esModule","default","statics","AuthorizationStatus","NotificationAndroidPriority","NotificationAndroidVisibility","namespace","nativeModuleName","backgroundMessageHandler","openSettingsForNotificationHandler","playServicesAvailability","FirebaseMessagingModule","FirebaseModule","constructor","app","config","customUrlOrRegion","_isAutoInitEnabled","native","isAutoInitEnabled","_isDeliveryMetricsExportToBigQueryEnabled","isDeliveryMetricsExportToBigQueryEnabled","_isRegisteredForRemoteNotifications","isRegisteredForRemoteNotifications","_isNotificationDelegationEnabled","isNotificationDelegationEnabled","AppRegistry","registerHeadlessTask","console","warn","Promise","resolve","remoteMessage","isIOS","emitter","addListener","handlerPromise","finally","completeNotificationProcessing","isDeviceRegisteredForRemoteMessages","isAndroid","setAutoInitEnabled","enabled","isBoolean","Error","getInitialNotification","then","value","getDidOpenSettingsForNotification","getIsHeadless","getToken","options","isUndefined","appName","isString","senderId","name","messagingSenderId","deleteToken","onMessage","listener","isFunction","subscription","remove","onNotificationOpenedApp","onTokenRefresh","event","token","requestPermission","permissions","AUTHORIZED","defaultPermissions","alert","announcement","badge","carPlay","provisional","sound","criticalAlert","providesAppNotificationSettings","isObject","Object","entries","forEach","key","hasOwnProperty","registerDeviceForRemoteMessages","autoRegister","firebaseJson","undefined","registerForRemoteNotifications","unregisterDeviceForRemoteMessages","unregisterForRemoteNotifications","getAPNSToken","setAPNSToken","type","includes","hasPermission","onDeletedMessages","onMessageSent","onSendError","setBackgroundMessageHandler","handler","signalBackgroundMessageHandlerSet","setOpenSettingsForNotificationsHandler","sendMessage","remoteMessageOptions","message","subscribeToTopic","topic","indexOf","unsubscribeFromTopic","useServiceWorker","usePublicVapidKey","setDeliveryMetricsExportToBigQuery","setNotificationDelegationEnabled","isSupported","firebase","getFirebaseRoot","utils","isAvailable","SDK_VERSION","exports","version","messagingNamespace","createModuleNamespace","nativeEvents","hasMultiAppSupport","hasCustomUrlOrRegionSupport","ModuleClass","_default"],"sourceRoot":"../../lib","sources":["namespaced.ts"],"mappings":";;;;;;AAiBA,IAAAA,OAAA,GAAAC,OAAA;AAUA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAImB,SAAAI,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAvCnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkCA,MAAMG,OAAyB,GAAG;EAChCC,mBAAmB,EAAnBA,4BAAmB;EACnBC,2BAA2B,EAA3BA,oCAA2B;EAC3BC,6BAA6B,EAA7BA;AACF,CAAC;AACD,MAAMC,SAAS,GAAG,WAAW;AAE7B,MAAMC,gBAAgB,GAAG,qBAAqB;AAE9C,IAAIC,wBAAsF;AAC1F,IAAIC,kCAAuF;AAC3F,IAAIC,wBAA6B;AAEjC,MAAMC,uBAAuB,SAASC,wBAAc,CAAsB;EAMxEC,WAAWA,CACTC,GAAwC,EACxCC,MAAW,EACXC,iBAAiC,EACjC;IACA,KAAK,CAACF,GAAG,EAAEC,MAAM,EAAEC,iBAAiB,CAAC;IACrC,IAAI,CAACC,kBAAkB,GACrB,IAAI,CAACC,MAAM,CAACC,iBAAiB,IAAI,IAAI,GAAG,IAAI,CAACD,MAAM,CAACC,iBAAiB,GAAG,IAAI;IAC9E,IAAI,CA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AG,IAAI,CAACA,GAAG;MACpB;MACAJ,wBAAwB,GAAG2G,QAAQ,CAACE,KAAK,CAACzG,GAAG,CAAC,CAACJ,wBAAwB;MACvE,OAAOA,wBAAwB,CAAC8G,WAAW;IAC7C;IACA;IACA,OAAO,IAAI;EACb;AACF;;AAEA;AACO,MAAMC,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAGE,gBAAO;;AAElC;AACA;AACA,MAAMC,kBAAkB,GAAG,IAAAC,+BAAqB,EAAC;EAC/C3H,OAAO;EACPyH,OAAO,EAAPA,gBAAO;EACPrH,SAAS;EACTC,gBAAgB;EAChBuH,YAAY,EAAE,CACZ,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC3B,4BAA4B,EAC5B,8BAA8B,EAC9B,+BAA+B,EAC/B,IAAI7F,aAAK,GACL,CAAC,uCAAuC,EAAE,4CAA4C,CAAC,GACvF,EAAE,CAAC,CACR;EACD8F,kBAAkB,EAAE,KAAK;EACzBC,2BAA2B,EAAE,KAAK;EAClCC,WAAW,EAAEtH;AACf,CAAC,CAAC;AAAC,IAAAuH,QAAA,GAAAR,OAAA,CAAAzH,OAAA,GAWY2H,kBAAkB,EAEjC;AACA;AACA;AACO,MAAMP,QAAQ,GAAAK,OAAA,CAAAL,QAAA,GACnB,IAAAC,yBAAe,EAAC,CAKf","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = remoteMessageOptions;
|
|
7
|
-
var _common = require("@react-native-firebase/app/lib/common");
|
|
8
|
-
/*
|
|
9
|
-
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this library except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License.
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
function remoteMessageOptions(messagingSenderId, remoteMessage) {
|
|
26
|
-
const out = {};
|
|
27
|
-
if ((0, _common.isUndefined)(remoteMessage) || !(0, _common.isObject)(remoteMessage)) {
|
|
28
|
-
throw new Error("'remoteMessage' expected an object value");
|
|
29
|
-
}
|
|
30
|
-
if (!remoteMessage.to) {
|
|
31
|
-
out.to = `${messagingSenderId}@fcm.googleapis.com`;
|
|
32
|
-
} else if (!(0, _common.isString)(remoteMessage.to)) {
|
|
33
|
-
throw new Error("'remoteMessage.to' expected a string value");
|
|
34
|
-
} else {
|
|
35
|
-
out.to = remoteMessage.to;
|
|
36
|
-
}
|
|
37
|
-
if (!remoteMessage.messageId) {
|
|
38
|
-
out.messageId = (0, _common.generateFirestoreId)();
|
|
39
|
-
} else if (!(0, _common.isString)(remoteMessage.messageId)) {
|
|
40
|
-
throw new Error("'remoteMessage.messageId' expected a string value");
|
|
41
|
-
} else {
|
|
42
|
-
out.messageId = remoteMessage.messageId;
|
|
43
|
-
}
|
|
44
|
-
if (!(0, _common.hasOwnProperty)(remoteMessage, 'ttl')) {
|
|
45
|
-
out.ttl = 3600;
|
|
46
|
-
} else {
|
|
47
|
-
if (!(0, _common.isNumber)(remoteMessage.ttl)) {
|
|
48
|
-
throw new Error("'remoteMessage.ttl' expected a number value");
|
|
49
|
-
}
|
|
50
|
-
if (remoteMessage.ttl < 0 || !(0, _common.isInteger)(remoteMessage.ttl)) {
|
|
51
|
-
throw new Error("'remoteMessage.ttl' expected a positive integer value");
|
|
52
|
-
}
|
|
53
|
-
out.ttl = remoteMessage.ttl;
|
|
54
|
-
}
|
|
55
|
-
if (!remoteMessage.data) {
|
|
56
|
-
out.data = {};
|
|
57
|
-
} else if (!(0, _common.isObject)(remoteMessage.data)) {
|
|
58
|
-
throw new Error("'remoteMessage.data' expected an object value");
|
|
59
|
-
} else {
|
|
60
|
-
// Serialize all objects to strings
|
|
61
|
-
out.data = {};
|
|
62
|
-
for (const key in remoteMessage.data) {
|
|
63
|
-
if ((0, _common.hasOwnProperty)(remoteMessage.data, key)) {
|
|
64
|
-
const value = remoteMessage.data[key];
|
|
65
|
-
if (typeof value === 'object' && !Array.isArray(value) && value !== null) {
|
|
66
|
-
out.data[key] = JSON.stringify(value);
|
|
67
|
-
} else {
|
|
68
|
-
out.data[key] = String(value);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (remoteMessage.collapseKey) {
|
|
74
|
-
if (!(0, _common.isString)(remoteMessage.collapseKey)) {
|
|
75
|
-
throw new Error("'remoteMessage.collapseKey' expected a string value");
|
|
76
|
-
}
|
|
77
|
-
out.collapseKey = remoteMessage.collapseKey;
|
|
78
|
-
}
|
|
79
|
-
if (remoteMessage.messageType) {
|
|
80
|
-
if (!(0, _common.isString)(remoteMessage.messageType)) {
|
|
81
|
-
throw new Error("'remoteMessage.messageType' expected a string value");
|
|
82
|
-
}
|
|
83
|
-
out.messageType = remoteMessage.messageType;
|
|
84
|
-
}
|
|
85
|
-
return out;
|
|
86
|
-
}
|
|
87
|
-
//# sourceMappingURL=remoteMessageOptions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_common","require","remoteMessageOptions","messagingSenderId","remoteMessage","out","isUndefined","isObject","Error","to","isString","messageId","generateFirestoreId","hasOwnProperty","ttl","isNumber","isInteger","data","key","value","Array","isArray","JSON","stringify","String","collapseKey","messageType"],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AAGrB,aAAa,CAACqB,WAAW;EAC7C;EAEA,IAAIrB,aAAa,CAACsB,WAAW,EAAE;IAC7B,IAAI,CAAC,IAAAhB,gBAAQ,EAACN,aAAa,CAACsB,WAAW,CAAC,EAAE;MACxC,MAAM,IAAIlB,KAAK,CAAC,qDAAqD,CAAC;IACxE;IACAH,GAAG,CAACqB,WAAW,GAAGtB,aAAa,CAACsB,WAAW;EAC7C;EAEA,OAAOrB,GAAG;AACZ","ignoreList":[]}
|
package/dist/commonjs/statics.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.NotificationAndroidVisibility = exports.NotificationAndroidPriority = exports.AuthorizationStatus = void 0;
|
|
7
|
-
// shared between namespaced and modular API
|
|
8
|
-
|
|
9
|
-
// Export as objects for runtime use (matching the old statics.js pattern)
|
|
10
|
-
const AuthorizationStatus = exports.AuthorizationStatus = {
|
|
11
|
-
NOT_DETERMINED: -1,
|
|
12
|
-
DENIED: 0,
|
|
13
|
-
AUTHORIZED: 1,
|
|
14
|
-
PROVISIONAL: 2,
|
|
15
|
-
EPHEMERAL: 3
|
|
16
|
-
};
|
|
17
|
-
const NotificationAndroidPriority = exports.NotificationAndroidPriority = {
|
|
18
|
-
PRIORITY_MIN: -2,
|
|
19
|
-
PRIORITY_LOW: -1,
|
|
20
|
-
PRIORITY_DEFAULT: 0,
|
|
21
|
-
PRIORITY_HIGH: 1,
|
|
22
|
-
PRIORITY_MAX: 2
|
|
23
|
-
};
|
|
24
|
-
const NotificationAndroidVisibility = exports.NotificationAndroidVisibility = {
|
|
25
|
-
VISIBILITY_SECRET: -1,
|
|
26
|
-
VISIBILITY_PRIVATE: 0,
|
|
27
|
-
VISIBILITY_PUBLIC: 1
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=statics.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["AuthorizationStatus","exports","NOT_DETERMINED","DENIED","AUTHORIZED","PROVISIONAL","EPHEMERAL","NotificationAndroidPriority","PRIORITY_MIN","PRIORITY_LOW","PRIORITY_DEFAULT","PRIORITY_HIGH","PRIORITY_MAX","NotificationAndroidVisibility","VISIBILITY_SECRET","VISIBILITY_PRIVATE","VISIBILITY_PUBLIC"],"sourceRoot":"../../lib","sources":["statics.ts"],"mappings":";;;;;;AAAA;;AAEA;AACO,MAAMA,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG;EACjCE,cAAc,EAAE,CAAC,CAAC;EAClBC,MAAM,EAAE,CAAC;EACTC,UAAU,EAAE,CAAC;EACbC,WAAW,EAAE,CAAC;EACdC,SAAS,EAAE;AACb,CAAU;AAEH,MAAMC,2BAA2B,GAAAN,OAAA,CAAAM,2BAAA,GAAG;EACzCC,YAAY,EAAE,CAAC,CAAC;EAChBC,YAAY,EAAE,CAAC,CAAC;EAChBC,gBAAgB,EAAE,CAAC;EACnBC,aAAa,EAAE,CAAC;EAChBC,YAAY,EAAE;AAChB,CAAU;AAEH,MAAMC,6BAA6B,GAAAZ,OAAA,CAAAY,6BAAA,GAAG;EAC3CC,iBAAiB,EAAE,CAAC,CAAC;EACrBC,kBAAkB,EAAE,CAAC;EACrBC,iBAAiB,EAAE;AACrB,CAAU","ignoreList":[]}
|