@react-native-firebase/app 21.7.1 → 21.7.3
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 +13 -0
- package/README.md +1 -1
- package/__tests__/app.test.ts +56 -3
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseVersion.java +1 -1
- package/ios/RNFBApp/RNFBVersion.m +1 -1
- package/lib/FirebaseApp.js +4 -1
- package/lib/common/Base64.js +0 -1
- package/lib/common/index.js +273 -2
- package/lib/common/path.js +0 -2
- package/lib/common/unitTestUtils.ts +63 -0
- package/lib/index.d.ts +5 -5
- package/lib/internal/registry/app.js +5 -0
- package/lib/internal/registry/namespace.js +12 -11
- package/lib/internal/web/RNFBAppModule.js +0 -1
- package/lib/internal/web/memidb/FDBCursor.js +1 -1
- package/lib/internal/web/memidb/lib/Index.js +2 -2
- package/lib/internal/web/memidb/lib/validateKeyPath.js +0 -1
- package/lib/modular/index.js +9 -5
- package/lib/utils/UtilsStatics.js +0 -1
- package/lib/version.js +1 -1
- package/package.json +8 -8
- package/plugin/build/android/copyGoogleServices.js +1 -1
- package/plugin/build/ios/appDelegate.js +1 -1
- package/plugin/src/android/copyGoogleServices.ts +1 -1
- package/plugin/src/ios/appDelegate.ts +1 -1
- package/plugin/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,19 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [21.7.3](https://github.com/invertase/react-native-firebase/compare/v21.7.2...v21.7.3) (2025-02-08)
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
- use same deprecation message everywhere, correct tests for new message ([684081b](https://github.com/invertase/react-native-firebase/commit/684081b7bdc17bc314fce827972dca5b1a58e01b))
|
11
|
+
|
12
|
+
## [21.7.2](https://github.com/invertase/react-native-firebase/compare/v21.7.1...v21.7.2) (2025-02-05)
|
13
|
+
|
14
|
+
### Bug Fixes
|
15
|
+
|
16
|
+
- **android, auth:** adopt play-services-auth 21.3.0 ([5506164](https://github.com/invertase/react-native-firebase/commit/55061640f55312b1df2315df6d0fa053c19d25e5)), closes [/developers.google.com/android/guides/releases#december_09_2024](https://github.com/invertase//developers.google.com/android/guides/releases/issues/december_09_2024)
|
17
|
+
- **app, android:** adopt firebase-android-sdk 33.8.0 ([14f3dd5](https://github.com/invertase/react-native-firebase/commit/14f3dd51d466d04fa92416d44035bf10194bfbee))
|
18
|
+
|
6
19
|
## [21.7.1](https://github.com/invertase/react-native-firebase/compare/v21.7.0...v21.7.1) (2025-01-20)
|
7
20
|
|
8
21
|
**Note:** Version bump only for package @react-native-firebase/app
|
package/README.md
CHANGED
@@ -43,7 +43,7 @@ yarn add @react-native-firebase/app
|
|
43
43
|
---
|
44
44
|
|
45
45
|
<p>
|
46
|
-
<img align="left" width="75px" src="https://static.invertase.io/assets/invertase-
|
46
|
+
<img align="left" width="75px" src="https://static.invertase.io/assets/invertase/invertase-rounded.png">
|
47
47
|
<p align="left">
|
48
48
|
Built and maintained with 💛 by <a href="https://invertase.io">Invertase</a>.
|
49
49
|
</p>
|
package/__tests__/app.test.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import { describe, expect, it } from '@jest/globals';
|
2
|
-
|
3
|
-
import {
|
1
|
+
import { describe, expect, it, jest } from '@jest/globals';
|
2
|
+
import { checkV9Deprecation } from '../lib/common/unitTestUtils';
|
3
|
+
import firebase, {
|
4
4
|
deleteApp,
|
5
5
|
registerVersion,
|
6
6
|
onLog,
|
@@ -40,4 +40,57 @@ describe('App', function () {
|
|
40
40
|
expect(setLogLevel).toBeDefined();
|
41
41
|
});
|
42
42
|
});
|
43
|
+
|
44
|
+
describe('`console.warn` only called for non-modular API', function () {
|
45
|
+
it('deleteApp', function () {
|
46
|
+
// this test has a slightly special setup
|
47
|
+
// @ts-ignore test
|
48
|
+
jest.spyOn(getApp(), '_deleteApp').mockImplementation(() => Promise.resolve(null));
|
49
|
+
checkV9Deprecation(
|
50
|
+
() => {}, // no modular replacement
|
51
|
+
() => getApp().delete(), // modular getApp(), then non-modular to check
|
52
|
+
);
|
53
|
+
});
|
54
|
+
|
55
|
+
it('getApps', function () {
|
56
|
+
checkV9Deprecation(
|
57
|
+
() => getApps(),
|
58
|
+
() => firebase.apps,
|
59
|
+
);
|
60
|
+
});
|
61
|
+
|
62
|
+
it('getApp', function () {
|
63
|
+
checkV9Deprecation(
|
64
|
+
() => getApp(),
|
65
|
+
() => firebase.app(),
|
66
|
+
);
|
67
|
+
});
|
68
|
+
|
69
|
+
it('setLogLevel', function () {
|
70
|
+
checkV9Deprecation(
|
71
|
+
() => setLogLevel('debug'),
|
72
|
+
() => firebase.setLogLevel('debug'),
|
73
|
+
);
|
74
|
+
});
|
75
|
+
|
76
|
+
it('FirebaseApp.toString()', function () {
|
77
|
+
checkV9Deprecation(
|
78
|
+
() => {}, // no modular replacement
|
79
|
+
() => getApp().toString(), // modular getApp(), then non-modular to check
|
80
|
+
);
|
81
|
+
});
|
82
|
+
|
83
|
+
it('FirebaseApp.extendApp()', function () {
|
84
|
+
checkV9Deprecation(
|
85
|
+
// no modular replacement for this one so no modular func to send in
|
86
|
+
() => {},
|
87
|
+
// modular getApp(), then non-modular to check
|
88
|
+
() => {
|
89
|
+
const app = getApp();
|
90
|
+
(app as any).extendApp({ some: 'property' });
|
91
|
+
return;
|
92
|
+
},
|
93
|
+
);
|
94
|
+
});
|
95
|
+
});
|
43
96
|
});
|
package/lib/FirebaseApp.js
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*
|
16
16
|
*/
|
17
|
-
|
17
|
+
import { warnIfNotModularCall } from '@react-native-firebase/app/lib/common';
|
18
18
|
import { getAppModule } from './internal/registry/nativeModule';
|
19
19
|
|
20
20
|
export default class FirebaseApp {
|
@@ -61,16 +61,19 @@ export default class FirebaseApp {
|
|
61
61
|
}
|
62
62
|
|
63
63
|
extendApp(extendedProps) {
|
64
|
+
warnIfNotModularCall(arguments);
|
64
65
|
this._checkDestroyed();
|
65
66
|
Object.assign(this, extendedProps);
|
66
67
|
}
|
67
68
|
|
68
69
|
delete() {
|
70
|
+
warnIfNotModularCall(arguments, 'deleteApp()');
|
69
71
|
this._checkDestroyed();
|
70
72
|
return this._deleteApp();
|
71
73
|
}
|
72
74
|
|
73
75
|
toString() {
|
76
|
+
warnIfNotModularCall(arguments);
|
74
77
|
return this.name;
|
75
78
|
}
|
76
79
|
}
|
package/lib/common/Base64.js
CHANGED
package/lib/common/index.js
CHANGED
@@ -90,7 +90,7 @@ export const isOther = Platform.OS !== 'ios' && Platform.OS !== 'android';
|
|
90
90
|
export function tryJSONParse(string) {
|
91
91
|
try {
|
92
92
|
return string && JSON.parse(string);
|
93
|
-
} catch (
|
93
|
+
} catch (_) {
|
94
94
|
return string;
|
95
95
|
}
|
96
96
|
}
|
@@ -98,7 +98,278 @@ export function tryJSONParse(string) {
|
|
98
98
|
export function tryJSONStringify(data) {
|
99
99
|
try {
|
100
100
|
return JSON.stringify(data);
|
101
|
-
} catch (
|
101
|
+
} catch (_) {
|
102
102
|
return null;
|
103
103
|
}
|
104
104
|
}
|
105
|
+
|
106
|
+
// Used to indicate if there is no corresponding modular function
|
107
|
+
const NO_REPLACEMENT = true;
|
108
|
+
|
109
|
+
const mapOfDeprecationReplacements = {
|
110
|
+
appCheck: {
|
111
|
+
default: {
|
112
|
+
activate: 'initializeAppCheck()',
|
113
|
+
setTokenAutoRefreshEnabled: 'setTokenAutoRefreshEnabled()',
|
114
|
+
getToken: 'getToken()',
|
115
|
+
getLimitedUseToken: 'getLimitedUseToken()',
|
116
|
+
onTokenChanged: 'onTokenChanged()',
|
117
|
+
},
|
118
|
+
statics: {
|
119
|
+
CustomProvider: 'CustomProvider',
|
120
|
+
},
|
121
|
+
},
|
122
|
+
crashlytics: {
|
123
|
+
default: {
|
124
|
+
checkForUnsentReports: 'checkForUnsentReports()',
|
125
|
+
crash: 'crash()',
|
126
|
+
deleteUnsentReports: 'deleteUnsentReports()',
|
127
|
+
didCrashOnPreviousExecution: 'didCrashOnPreviousExecution()',
|
128
|
+
log: 'log()',
|
129
|
+
setAttribute: 'setAttribute()',
|
130
|
+
setAttributes: 'setAttributes()',
|
131
|
+
setUserId: 'setUserId()',
|
132
|
+
recordError: 'recordError()',
|
133
|
+
sendUnsentReports: 'sendUnsentReports()',
|
134
|
+
setCrashlyticsCollectionEnabled: 'setCrashlyticsCollectionEnabled()',
|
135
|
+
},
|
136
|
+
},
|
137
|
+
firestore: {
|
138
|
+
default: {
|
139
|
+
batch: 'writeBatch()',
|
140
|
+
loadBundle: 'loadBundle()',
|
141
|
+
namedQuery: 'namedQuery()',
|
142
|
+
clearPersistence: 'clearIndexedDbPersistence()',
|
143
|
+
waitForPendingWrites: 'waitForPendingWrites()',
|
144
|
+
terminate: 'terminate()',
|
145
|
+
useEmulator: 'connectFirestoreEmulator()',
|
146
|
+
collection: 'collection()',
|
147
|
+
collectionGroup: 'collectionGroup()',
|
148
|
+
disableNetwork: 'disableNetwork()',
|
149
|
+
doc: 'doc()',
|
150
|
+
enableNetwork: 'enableNetwork()',
|
151
|
+
runTransaction: 'runTransaction()',
|
152
|
+
settings: 'settings()',
|
153
|
+
persistentCacheIndexManager: 'getPersistentCacheIndexManager()',
|
154
|
+
},
|
155
|
+
statics: {
|
156
|
+
setLogLevel: 'setLogLevel()',
|
157
|
+
Filter: 'where()',
|
158
|
+
FieldValue: 'FieldValue',
|
159
|
+
Timestamp: 'Timestamp',
|
160
|
+
GeoPoint: 'GeoPoint',
|
161
|
+
Blob: 'Bytes',
|
162
|
+
FieldPath: 'FieldPath',
|
163
|
+
},
|
164
|
+
FirestoreCollectionReference: {
|
165
|
+
count: 'getCountFromServer()',
|
166
|
+
countFromServer: 'getCountFromServer()',
|
167
|
+
endAt: 'endAt()',
|
168
|
+
endBefore: 'endBefore()',
|
169
|
+
get: 'getDocs()',
|
170
|
+
isEqual: NO_REPLACEMENT,
|
171
|
+
limit: 'limit()',
|
172
|
+
limitToLast: 'limitToLast()',
|
173
|
+
onSnapshot: 'onSnapshot()',
|
174
|
+
orderBy: 'orderBy()',
|
175
|
+
startAfter: 'startAfter()',
|
176
|
+
startAt: 'startAt()',
|
177
|
+
where: 'where()',
|
178
|
+
add: 'addDoc()',
|
179
|
+
doc: 'doc()',
|
180
|
+
},
|
181
|
+
FirestoreDocumentReference: {
|
182
|
+
collection: 'collection()',
|
183
|
+
delete: 'deleteDoc()',
|
184
|
+
get: 'getDoc()',
|
185
|
+
isEqual: NO_REPLACEMENT,
|
186
|
+
onSnapshot: 'onSnapshot()',
|
187
|
+
set: 'setDoc()',
|
188
|
+
update: 'updateDoc()',
|
189
|
+
},
|
190
|
+
FirestoreDocumentSnapshot: {
|
191
|
+
isEqual: NO_REPLACEMENT,
|
192
|
+
},
|
193
|
+
FirestoreFieldValue: {
|
194
|
+
arrayRemove: 'arrayRemove()',
|
195
|
+
arrayUnion: 'arrayUnion()',
|
196
|
+
delete: 'deleteField()',
|
197
|
+
increment: 'increment()',
|
198
|
+
serverTimestamp: 'serverTimestamp()',
|
199
|
+
},
|
200
|
+
Filter: {
|
201
|
+
or: 'or()',
|
202
|
+
and: 'and()',
|
203
|
+
},
|
204
|
+
FirestorePersistentCacheIndexManager: {
|
205
|
+
enableIndexAutoCreation: 'enablePersistentCacheIndexAutoCreation()',
|
206
|
+
disableIndexAutoCreation: 'disablePersistentCacheIndexAutoCreation()',
|
207
|
+
deleteAllIndexes: 'deleteAllPersistentCacheIndexes()',
|
208
|
+
},
|
209
|
+
FirestoreTimestamp: {
|
210
|
+
seconds: NO_REPLACEMENT,
|
211
|
+
nanoseconds: NO_REPLACEMENT,
|
212
|
+
},
|
213
|
+
},
|
214
|
+
};
|
215
|
+
|
216
|
+
const modularDeprecationMessage =
|
217
|
+
'This method is deprecated (as well as all React Native Firebase namespaced API) and will be removed in the next major release ' +
|
218
|
+
'as part of move to match Firebase Web modular SDK API. Please see migration guide for more details: https://rnfirebase.io/migrating-to-v22';
|
219
|
+
|
220
|
+
export function deprecationConsoleWarning(nameSpace, methodName, instanceName, isModularMethod) {
|
221
|
+
if (!isModularMethod) {
|
222
|
+
const moduleMap = mapOfDeprecationReplacements[nameSpace];
|
223
|
+
if (moduleMap) {
|
224
|
+
const instanceMap = moduleMap[instanceName];
|
225
|
+
const deprecatedMethod = instanceMap[methodName];
|
226
|
+
if (instanceMap && deprecatedMethod) {
|
227
|
+
const message = createMessage(nameSpace, methodName, instanceName);
|
228
|
+
|
229
|
+
if (!globalThis.RNFB_SILENCE_MODULAR_DEPRECATION_WARNINGS) {
|
230
|
+
// eslint-disable-next-line no-console
|
231
|
+
console.warn(message);
|
232
|
+
}
|
233
|
+
}
|
234
|
+
}
|
235
|
+
}
|
236
|
+
}
|
237
|
+
|
238
|
+
export function createMessage(
|
239
|
+
nameSpace,
|
240
|
+
methodName,
|
241
|
+
instanceName = 'default',
|
242
|
+
uniqueMessage = null,
|
243
|
+
) {
|
244
|
+
if (uniqueMessage) {
|
245
|
+
// Unique deprecation message used for testing
|
246
|
+
return uniqueMessage;
|
247
|
+
}
|
248
|
+
|
249
|
+
const moduleMap = mapOfDeprecationReplacements[nameSpace];
|
250
|
+
if (moduleMap) {
|
251
|
+
const instance = moduleMap[instanceName];
|
252
|
+
if (instance) {
|
253
|
+
const replacementMethodName = instance[methodName];
|
254
|
+
|
255
|
+
if (replacementMethodName !== NO_REPLACEMENT) {
|
256
|
+
return modularDeprecationMessage + ` Please use \`${replacementMethodName}\` instead.`;
|
257
|
+
} else {
|
258
|
+
return modularDeprecationMessage;
|
259
|
+
}
|
260
|
+
}
|
261
|
+
}
|
262
|
+
}
|
263
|
+
|
264
|
+
function getNamespace(target) {
|
265
|
+
if (target.GeoPoint || target.CustomProvider) {
|
266
|
+
// target is statics object. GeoPoint - Firestore, CustomProvider - AppCheck
|
267
|
+
return 'firestore';
|
268
|
+
}
|
269
|
+
if (target._config && target._config.namespace) {
|
270
|
+
return target._config.namespace;
|
271
|
+
}
|
272
|
+
const className = target.name ? target.name : target.constructor.name;
|
273
|
+
return Object.keys(mapOfDeprecationReplacements).find(key => {
|
274
|
+
if (mapOfDeprecationReplacements[key][className]) {
|
275
|
+
return key;
|
276
|
+
}
|
277
|
+
});
|
278
|
+
}
|
279
|
+
|
280
|
+
function getInstanceName(target) {
|
281
|
+
if (target.GeoPoint || target.CustomProvider) {
|
282
|
+
// target is statics object. GeoPoint - Firestore, CustomProvider - AppCheck
|
283
|
+
return 'statics';
|
284
|
+
}
|
285
|
+
if (target._config) {
|
286
|
+
// module class instance, we use default to store map of deprecated methods
|
287
|
+
return 'default';
|
288
|
+
}
|
289
|
+
if (target.name) {
|
290
|
+
// It's a function which has a name property unlike classes
|
291
|
+
return target.name;
|
292
|
+
}
|
293
|
+
// It's a class instance
|
294
|
+
return target.constructor.name;
|
295
|
+
}
|
296
|
+
|
297
|
+
export function createDeprecationProxy(instance) {
|
298
|
+
return new Proxy(instance, {
|
299
|
+
construct(target, args) {
|
300
|
+
// needed for Timestamp which we pass as static, when we construct new instance, we need to wrap it in proxy again.
|
301
|
+
return createDeprecationProxy(new target(...args));
|
302
|
+
},
|
303
|
+
get(target, prop, receiver) {
|
304
|
+
const originalMethod = target[prop];
|
305
|
+
|
306
|
+
if (prop === 'constructor') {
|
307
|
+
return Reflect.get(target, prop, receiver);
|
308
|
+
}
|
309
|
+
|
310
|
+
if (target && target.constructor && target.constructor.name === 'FirestoreTimestamp') {
|
311
|
+
deprecationConsoleWarning('firestore', prop, 'FirestoreTimestamp', false);
|
312
|
+
return Reflect.get(target, prop, receiver);
|
313
|
+
}
|
314
|
+
|
315
|
+
if (target && target.name === 'firebaseModuleWithApp') {
|
316
|
+
// statics
|
317
|
+
if (
|
318
|
+
prop === 'Filter' ||
|
319
|
+
prop === 'FieldValue' ||
|
320
|
+
prop === 'Timestamp' ||
|
321
|
+
prop === 'GeoPoint' ||
|
322
|
+
prop === 'Blob' ||
|
323
|
+
prop === 'FieldPath'
|
324
|
+
) {
|
325
|
+
deprecationConsoleWarning('firestore', prop, 'statics', false);
|
326
|
+
}
|
327
|
+
if (prop === 'CustomProvider') {
|
328
|
+
deprecationConsoleWarning('appCheck', prop, 'statics', false);
|
329
|
+
}
|
330
|
+
|
331
|
+
if (prop !== 'setLogLevel') {
|
332
|
+
// we want to capture setLogLevel function call which we do below
|
333
|
+
return Reflect.get(target, prop, receiver);
|
334
|
+
}
|
335
|
+
}
|
336
|
+
|
337
|
+
if (typeof originalMethod === 'function') {
|
338
|
+
return function (...args) {
|
339
|
+
const isModularMethod = args.includes(MODULAR_DEPRECATION_ARG);
|
340
|
+
const instanceName = getInstanceName(target);
|
341
|
+
const nameSpace = getNamespace(target);
|
342
|
+
|
343
|
+
deprecationConsoleWarning(nameSpace, prop, instanceName, isModularMethod);
|
344
|
+
|
345
|
+
return originalMethod.apply(target, filterModularArgument(args));
|
346
|
+
};
|
347
|
+
}
|
348
|
+
return Reflect.get(target, prop, receiver);
|
349
|
+
},
|
350
|
+
});
|
351
|
+
}
|
352
|
+
|
353
|
+
export const MODULAR_DEPRECATION_ARG = 'react-native-firebase-modular-method-call';
|
354
|
+
|
355
|
+
export function filterModularArgument(list) {
|
356
|
+
return list.filter(arg => arg !== MODULAR_DEPRECATION_ARG);
|
357
|
+
}
|
358
|
+
|
359
|
+
export function warnIfNotModularCall(args, replacementMethodName = '') {
|
360
|
+
for (let i = 0; i < args.length; i++) {
|
361
|
+
if (args[i] === MODULAR_DEPRECATION_ARG) {
|
362
|
+
return;
|
363
|
+
}
|
364
|
+
}
|
365
|
+
|
366
|
+
let message = modularDeprecationMessage;
|
367
|
+
if (replacementMethodName.length > 0) {
|
368
|
+
message += ` Please use \`${replacementMethodName}\` instead.`;
|
369
|
+
}
|
370
|
+
|
371
|
+
if (!globalThis.RNFB_SILENCE_MODULAR_DEPRECATION_WARNINGS) {
|
372
|
+
// eslint-disable-next-line no-console
|
373
|
+
console.warn(message);
|
374
|
+
}
|
375
|
+
}
|
package/lib/common/path.js
CHANGED
@@ -88,7 +88,6 @@ export function pathToUrlEncodedString(path) {
|
|
88
88
|
return pathString || '/';
|
89
89
|
}
|
90
90
|
|
91
|
-
// eslint-disable-next-line no-control-regex
|
92
91
|
export const INVALID_PATH_REGEX = /[[\].#$\u0000-\u001F\u007F]/;
|
93
92
|
|
94
93
|
/**
|
@@ -100,7 +99,6 @@ export function isValidPath(path) {
|
|
100
99
|
return typeof path === 'string' && path.length !== 0 && !INVALID_PATH_REGEX.test(path);
|
101
100
|
}
|
102
101
|
|
103
|
-
// eslint-disable-next-line no-control-regex
|
104
102
|
export const INVALID_KEY_REGEX = /[\[\].#$\/\u0000-\u001F\u007F]/;
|
105
103
|
|
106
104
|
/**
|
@@ -0,0 +1,63 @@
|
|
1
|
+
// @ts-nocheck
|
2
|
+
import { expect, jest } from '@jest/globals';
|
3
|
+
import { createMessage } from './index';
|
4
|
+
|
5
|
+
export const checkV9Deprecation = (modularFunction: () => void, nonModularFunction: () => void) => {
|
6
|
+
const consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
|
7
|
+
consoleWarnSpy.mockRestore();
|
8
|
+
modularFunction();
|
9
|
+
expect(consoleWarnSpy).not.toHaveBeenCalled();
|
10
|
+
consoleWarnSpy.mockClear();
|
11
|
+
const consoleWarnSpy2 = jest.spyOn(console, 'warn').mockImplementation(() => {});
|
12
|
+
nonModularFunction();
|
13
|
+
|
14
|
+
expect(consoleWarnSpy2).toHaveBeenCalledTimes(1);
|
15
|
+
consoleWarnSpy2.mockClear();
|
16
|
+
};
|
17
|
+
|
18
|
+
export type CheckV9DeprecationFunction = (
|
19
|
+
modularFunction: () => void,
|
20
|
+
nonModularFunction: () => void,
|
21
|
+
methodNameKey: string,
|
22
|
+
uniqueMessage?: string | null,
|
23
|
+
ignoreFirebaseAppDeprecationWarning?: boolean,
|
24
|
+
) => void;
|
25
|
+
|
26
|
+
export const createCheckV9Deprecation = (moduleNames: string[]): CheckV9DeprecationFunction => {
|
27
|
+
return (
|
28
|
+
modularFunction: () => void,
|
29
|
+
nonModularFunction: () => void,
|
30
|
+
methodNameKey: string,
|
31
|
+
uniqueMessage: string?,
|
32
|
+
checkFirebaseAppDeprecationWarning: boolean = false,
|
33
|
+
) => {
|
34
|
+
const moduleName = moduleNames[0]; // firestore, database, etc
|
35
|
+
const instanceName = moduleNames[1] || 'default'; // default, FirestoreCollectionReference, etc
|
36
|
+
const consoleWarnSpy = jest.spyOn(console, 'warn');
|
37
|
+
consoleWarnSpy.mockReset();
|
38
|
+
|
39
|
+
consoleWarnSpy.mockImplementation(warnMessage => {
|
40
|
+
const firebaseAppDeprecationMessage = warnMessage.includes('Please use `getApp()` instead.');
|
41
|
+
if (checkFirebaseAppDeprecationWarning) {
|
42
|
+
throw new Error(`Console warn was called unexpectedly with: ${warnMessage}`);
|
43
|
+
} else {
|
44
|
+
if (!firebaseAppDeprecationMessage) {
|
45
|
+
// we want to ignore all firebase app deprecation warnings (e.g. "Please use `getApp()` instead.") unless actually testing for it which we do above
|
46
|
+
throw new Error(`Console warn was called unexpectedly with: ${warnMessage}`);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
});
|
50
|
+
// Do not call `mockRestore()` unless removing the spy
|
51
|
+
modularFunction();
|
52
|
+
consoleWarnSpy.mockReset();
|
53
|
+
consoleWarnSpy.mockRestore();
|
54
|
+
const consoleWarnSpy2 = jest.spyOn(console, 'warn').mockImplementation(warnMessage => {
|
55
|
+
const message = createMessage(moduleName, methodNameKey, instanceName, uniqueMessage);
|
56
|
+
expect(warnMessage).toMatch(message);
|
57
|
+
});
|
58
|
+
nonModularFunction();
|
59
|
+
|
60
|
+
expect(consoleWarnSpy2).toHaveBeenCalledTimes(1);
|
61
|
+
consoleWarnSpy2.mockReset();
|
62
|
+
};
|
63
|
+
};
|
package/lib/index.d.ts
CHANGED
@@ -168,21 +168,21 @@ export namespace ReactNativeFirebase {
|
|
168
168
|
* @param key - storage key.
|
169
169
|
* @param value - storage value.
|
170
170
|
*/
|
171
|
-
// eslint-disable-next-line @typescript-eslint/
|
171
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
172
172
|
setItem: Function;
|
173
173
|
/**
|
174
174
|
* Retrieve an item from storage.
|
175
175
|
*
|
176
176
|
* @param key - storage key.
|
177
177
|
*/
|
178
|
-
// eslint-disable-next-line @typescript-eslint/
|
178
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
179
179
|
getItem: Function;
|
180
180
|
/**
|
181
181
|
* Remove an item from storage.
|
182
182
|
*
|
183
183
|
* @param key - storage key.
|
184
184
|
*/
|
185
|
-
// eslint-disable-next-line @typescript-eslint/
|
185
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
186
186
|
removeItem: Function;
|
187
187
|
|
188
188
|
[key: string]: any;
|
@@ -277,7 +277,7 @@ export namespace ReactNativeFirebase {
|
|
277
277
|
private emitter: any;
|
278
278
|
}
|
279
279
|
|
280
|
-
// eslint-disable-next-line @typescript-eslint/
|
280
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
281
281
|
export type FirebaseModuleWithStatics<M, S = {}> = {
|
282
282
|
(): M;
|
283
283
|
|
@@ -287,7 +287,7 @@ export namespace ReactNativeFirebase {
|
|
287
287
|
readonly SDK_VERSION: string;
|
288
288
|
} & S;
|
289
289
|
|
290
|
-
// eslint-disable-next-line @typescript-eslint/
|
290
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
291
291
|
export type FirebaseModuleWithStaticsAndApp<M, S = {}> = {
|
292
292
|
(app?: FirebaseApp): M;
|
293
293
|
|
@@ -19,6 +19,7 @@ import {
|
|
19
19
|
isIOS,
|
20
20
|
isOther,
|
21
21
|
isNull,
|
22
|
+
warnIfNotModularCall,
|
22
23
|
isObject,
|
23
24
|
isFunction,
|
24
25
|
isString,
|
@@ -84,6 +85,7 @@ export function initializeNativeApps() {
|
|
84
85
|
* @param name
|
85
86
|
*/
|
86
87
|
export function getApp(name = DEFAULT_APP_NAME) {
|
88
|
+
warnIfNotModularCall(arguments, 'getApp()');
|
87
89
|
if (!initializedNativeApps) {
|
88
90
|
initializeNativeApps();
|
89
91
|
}
|
@@ -100,6 +102,7 @@ export function getApp(name = DEFAULT_APP_NAME) {
|
|
100
102
|
* Gets all app instances, used for `firebase.apps`
|
101
103
|
*/
|
102
104
|
export function getApps() {
|
105
|
+
warnIfNotModularCall(arguments, 'getApps()');
|
103
106
|
if (!initializedNativeApps) {
|
104
107
|
initializeNativeApps();
|
105
108
|
}
|
@@ -112,6 +115,7 @@ export function getApps() {
|
|
112
115
|
* @param configOrName
|
113
116
|
*/
|
114
117
|
export function initializeApp(options = {}, configOrName) {
|
118
|
+
warnIfNotModularCall(arguments, 'initializeApp()');
|
115
119
|
let appConfig = configOrName;
|
116
120
|
|
117
121
|
if (!isObject(configOrName) || isNull(configOrName)) {
|
@@ -200,6 +204,7 @@ export function initializeApp(options = {}, configOrName) {
|
|
200
204
|
}
|
201
205
|
|
202
206
|
export function setLogLevel(logLevel) {
|
207
|
+
warnIfNotModularCall(arguments, 'setLogLevel()');
|
203
208
|
if (!['error', 'warn', 'info', 'debug', 'verbose'].includes(logLevel)) {
|
204
209
|
throw new Error('LogLevel must be one of "error", "warn", "info", "debug", "verbose"');
|
205
210
|
}
|
@@ -15,7 +15,7 @@
|
|
15
15
|
*
|
16
16
|
*/
|
17
17
|
|
18
|
-
import { isString } from '../../common';
|
18
|
+
import { isString, createDeprecationProxy } from '../../common';
|
19
19
|
import FirebaseApp from '../../FirebaseApp';
|
20
20
|
import SDK_VERSION from '../../version';
|
21
21
|
import { DEFAULT_APP_NAME, KNOWN_NAMESPACES } from '../constants';
|
@@ -114,11 +114,11 @@ function getOrCreateModuleForApp(app, moduleNamespace) {
|
|
114
114
|
}
|
115
115
|
|
116
116
|
if (!APP_MODULE_INSTANCE[app.name][key]) {
|
117
|
-
|
118
|
-
app,
|
119
|
-
NAMESPACE_REGISTRY[moduleNamespace],
|
120
|
-
customUrlOrRegionOrDatabaseId,
|
117
|
+
const module = createDeprecationProxy(
|
118
|
+
new ModuleClass(app, NAMESPACE_REGISTRY[moduleNamespace], customUrlOrRegionOrDatabaseId),
|
121
119
|
);
|
120
|
+
|
121
|
+
APP_MODULE_INSTANCE[app.name][key] = module;
|
122
122
|
}
|
123
123
|
|
124
124
|
return APP_MODULE_INSTANCE[app.name][key];
|
@@ -170,18 +170,19 @@ function getOrCreateModuleForRoot(moduleNamespace) {
|
|
170
170
|
}
|
171
171
|
|
172
172
|
if (!APP_MODULE_INSTANCE[_app.name][moduleNamespace]) {
|
173
|
-
|
174
|
-
_app,
|
175
|
-
NAMESPACE_REGISTRY[moduleNamespace],
|
173
|
+
const module = createDeprecationProxy(
|
174
|
+
new ModuleClass(_app, NAMESPACE_REGISTRY[moduleNamespace]),
|
176
175
|
);
|
176
|
+
APP_MODULE_INSTANCE[_app.name][moduleNamespace] = module;
|
177
177
|
}
|
178
178
|
|
179
179
|
return APP_MODULE_INSTANCE[_app.name][moduleNamespace];
|
180
180
|
}
|
181
181
|
|
182
182
|
Object.assign(firebaseModuleWithApp, statics || {});
|
183
|
-
Object.freeze(firebaseModuleWithApp);
|
184
|
-
|
183
|
+
// Object.freeze(firebaseModuleWithApp);
|
184
|
+
// Wrap around statics, e.g. firebase.firestore.FieldValue, removed freeze as it stops proxy working. it is deprecated anyway
|
185
|
+
MODULE_GETTER_FOR_ROOT[moduleNamespace] = createDeprecationProxy(firebaseModuleWithApp);
|
185
186
|
|
186
187
|
return MODULE_GETTER_FOR_ROOT[moduleNamespace];
|
187
188
|
}
|
@@ -192,7 +193,7 @@ function getOrCreateModuleForRoot(moduleNamespace) {
|
|
192
193
|
* @param moduleNamespace
|
193
194
|
* @returns {*}
|
194
195
|
*/
|
195
|
-
function firebaseRootModuleProxy(
|
196
|
+
function firebaseRootModuleProxy(_firebaseNamespace, moduleNamespace) {
|
196
197
|
if (NAMESPACE_REGISTRY[moduleNamespace]) {
|
197
198
|
return getOrCreateModuleForRoot(moduleNamespace);
|
198
199
|
}
|
@@ -75,7 +75,7 @@ class Index {
|
|
75
75
|
if (!this.multiEntry || !Array.isArray(indexKey)) {
|
76
76
|
try {
|
77
77
|
valueToKey(indexKey);
|
78
|
-
} catch (
|
78
|
+
} catch (_) {
|
79
79
|
return;
|
80
80
|
}
|
81
81
|
} else {
|
@@ -86,7 +86,7 @@ class Index {
|
|
86
86
|
if (keep.indexOf(part) < 0) {
|
87
87
|
try {
|
88
88
|
keep.push(valueToKey(part));
|
89
|
-
} catch (
|
89
|
+
} catch (_) {
|
90
90
|
/* Do nothing */
|
91
91
|
}
|
92
92
|
}
|
@@ -19,7 +19,6 @@ const validateKeyPath = (keyPath, parent) => {
|
|
19
19
|
// https://mathiasbynens.be/demo/javascript-identifier-regex for ECMAScript 5.1 / Unicode v7.0.0, with
|
20
20
|
// reserved words at beginning removed
|
21
21
|
const validIdentifierRegex =
|
22
|
-
// eslint-disable-next-line no-misleading-character-class
|
23
22
|
/^(?:[$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC])(?:[$0-9A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC])*$/;
|
24
23
|
if (keyPath.length >= 1 && validIdentifierRegex.test(keyPath)) {
|
25
24
|
return;
|
package/lib/modular/index.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/lib/common';
|
1
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
2
3
|
import {
|
3
4
|
deleteApp as deleteAppCompat,
|
@@ -6,6 +7,7 @@ import {
|
|
6
7
|
initializeApp as initializeAppCompat,
|
7
8
|
setLogLevel as setLogLevelCompat,
|
8
9
|
} from '../internal';
|
10
|
+
import sdkVersion from '../version';
|
9
11
|
|
10
12
|
/**
|
11
13
|
* @typedef {import('..').ReactNativeFirebase.FirebaseApp} FirebaseApp
|
@@ -19,7 +21,7 @@ import {
|
|
19
21
|
* @returns {Promise<void>}
|
20
22
|
*/
|
21
23
|
export function deleteApp(app) {
|
22
|
-
return deleteAppCompat(app.name, app._nativeInitialized);
|
24
|
+
return deleteAppCompat.call(null, app.name, app._nativeInitialized, MODULAR_DEPRECATION_ARG);
|
23
25
|
}
|
24
26
|
|
25
27
|
/**
|
@@ -48,7 +50,7 @@ export function onLog(logCallback, options) {
|
|
48
50
|
* @returns {FirebaseApp[]} - An array of all initialized Firebase apps.
|
49
51
|
*/
|
50
52
|
export function getApps() {
|
51
|
-
return getAppsCompat();
|
53
|
+
return getAppsCompat.call(null, MODULAR_DEPRECATION_ARG);
|
52
54
|
}
|
53
55
|
|
54
56
|
/**
|
@@ -58,7 +60,7 @@ export function getApps() {
|
|
58
60
|
* @returns {FirebaseApp} - The initialized Firebase app.
|
59
61
|
*/
|
60
62
|
export function initializeApp(options, name) {
|
61
|
-
return initializeAppCompat(options, name);
|
63
|
+
return initializeAppCompat.call(null, options, name, MODULAR_DEPRECATION_ARG);
|
62
64
|
}
|
63
65
|
|
64
66
|
/**
|
@@ -67,7 +69,7 @@ export function initializeApp(options, name) {
|
|
67
69
|
* @returns {FirebaseApp} - The requested Firebase app instance.
|
68
70
|
*/
|
69
71
|
export function getApp(name) {
|
70
|
-
return getAppCompat(name);
|
72
|
+
return getAppCompat.call(null, name, MODULAR_DEPRECATION_ARG);
|
71
73
|
}
|
72
74
|
|
73
75
|
/**
|
@@ -76,5 +78,7 @@ export function getApp(name) {
|
|
76
78
|
* @returns {void}
|
77
79
|
*/
|
78
80
|
export function setLogLevel(logLevel) {
|
79
|
-
return setLogLevelCompat(logLevel);
|
81
|
+
return setLogLevelCompat.call(null, logLevel, MODULAR_DEPRECATION_ARG);
|
80
82
|
}
|
83
|
+
|
84
|
+
export const SDK_VERSION = sdkVersion;
|
package/lib/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
// Generated by genversion.
|
2
|
-
module.exports = '21.7.
|
2
|
+
module.exports = '21.7.3';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-native-firebase/app",
|
3
|
-
"version": "21.7.
|
3
|
+
"version": "21.7.3",
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
5
5
|
"description": "A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Storage and more.",
|
6
6
|
"main": "lib/index.js",
|
@@ -57,11 +57,11 @@
|
|
57
57
|
"react-native": "*"
|
58
58
|
},
|
59
59
|
"dependencies": {
|
60
|
-
"firebase": "
|
60
|
+
"firebase": "11.2.0"
|
61
61
|
},
|
62
62
|
"devDependencies": {
|
63
|
-
"@react-native-async-storage/async-storage": "^1.
|
64
|
-
"expo": "^
|
63
|
+
"@react-native-async-storage/async-storage": "^2.1.1",
|
64
|
+
"expo": "^52.0.30"
|
65
65
|
},
|
66
66
|
"peerDependenciesMeta": {
|
67
67
|
"expo": {
|
@@ -82,13 +82,13 @@
|
|
82
82
|
"minSdk": 21,
|
83
83
|
"targetSdk": 34,
|
84
84
|
"compileSdk": 34,
|
85
|
-
"firebase": "33.
|
85
|
+
"firebase": "33.8.0",
|
86
86
|
"firebaseCrashlyticsGradle": "3.0.2",
|
87
87
|
"firebasePerfGradle": "1.4.2",
|
88
88
|
"gmsGoogleServicesGradle": "4.4.2",
|
89
|
-
"playServicesAuth": "21.
|
90
|
-
"firebaseAppDistributionGradle": "5.
|
89
|
+
"playServicesAuth": "21.3.0",
|
90
|
+
"firebaseAppDistributionGradle": "5.1.0"
|
91
91
|
}
|
92
92
|
},
|
93
|
-
"gitHead": "
|
93
|
+
"gitHead": "e1446c8737b4df5067fcc4f99ca30b0a3afcc8e5"
|
94
94
|
}
|
@@ -23,7 +23,7 @@ const withCopyAndroidGoogleServices = config => {
|
|
23
23
|
try {
|
24
24
|
await fs_1.default.promises.copyFile(srcPath, destPath);
|
25
25
|
}
|
26
|
-
catch (
|
26
|
+
catch (_) {
|
27
27
|
throw new Error(`Cannot copy google-services.json, because the file ${srcPath} doesn't exist. Please provide a valid path in \`app.json\`.`);
|
28
28
|
}
|
29
29
|
return config;
|
@@ -41,7 +41,7 @@ function modifyObjcAppDelegate(contents) {
|
|
41
41
|
comment: '//',
|
42
42
|
}).contents;
|
43
43
|
}
|
44
|
-
catch (
|
44
|
+
catch (_) {
|
45
45
|
// tests if the opening `{` is in the new line
|
46
46
|
const multilineMatcher = new RegExp(fallbackInvocationLineMatcher.source + '.+\\n*{');
|
47
47
|
const isHeaderMultiline = multilineMatcher.test(contents);
|
@@ -25,7 +25,7 @@ export const withCopyAndroidGoogleServices: ConfigPlugin = config => {
|
|
25
25
|
|
26
26
|
try {
|
27
27
|
await fs.promises.copyFile(srcPath, destPath);
|
28
|
-
} catch (
|
28
|
+
} catch (_) {
|
29
29
|
throw new Error(
|
30
30
|
`Cannot copy google-services.json, because the file ${srcPath} doesn't exist. Please provide a valid path in \`app.json\`.`,
|
31
31
|
);
|
@@ -49,7 +49,7 @@ export function modifyObjcAppDelegate(contents: string): string {
|
|
49
49
|
offset: 0, // new line will be inserted right above matched anchor
|
50
50
|
comment: '//',
|
51
51
|
}).contents;
|
52
|
-
} catch (
|
52
|
+
} catch (_: any) {
|
53
53
|
// tests if the opening `{` is in the new line
|
54
54
|
const multilineMatcher = new RegExp(fallbackInvocationLineMatcher.source + '.+\\n*{');
|
55
55
|
const isHeaderMultiline = multilineMatcher.test(contents);
|
@@ -1 +1 @@
|
|
1
|
-
{"root":["./src/index.ts","./src/android/applyPlugin.ts","./src/android/buildscriptDependency.ts","./src/android/constants.ts","./src/android/copyGoogleServices.ts","./src/android/index.ts","./src/ios/appDelegate.ts","./src/ios/googleServicesPlist.ts","./src/ios/index.ts"],"version":"5.
|
1
|
+
{"root":["./src/index.ts","./src/android/applyPlugin.ts","./src/android/buildscriptDependency.ts","./src/android/constants.ts","./src/android/copyGoogleServices.ts","./src/android/index.ts","./src/ios/appDelegate.ts","./src/ios/googleServicesPlist.ts","./src/ios/index.ts"],"version":"5.7.3"}
|