@react-native-firebase/app 20.3.0 → 20.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/__tests__/app.test.ts +43 -0
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseVersion.java +1 -1
- package/ios/RNFBApp/RNFBVersion.m +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +1 -1
- package/lib/internal/registry/namespace.js +9 -7
- package/lib/internal/registry/nativeModule.js +4 -1
- package/lib/modular/index.d.ts +62 -0
- package/lib/modular/index.js +80 -0
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/lib/modular/app.js +0 -33
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,16 @@
|
|
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
|
+
## [20.5.0](https://github.com/invertase/react-native-firebase/compare/v20.4.0...v20.5.0) (2024-09-11)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @react-native-firebase/app
|
9
|
+
|
10
|
+
## [20.4.0](https://github.com/invertase/react-native-firebase/compare/v20.3.0...v20.4.0) (2024-08-13)
|
11
|
+
|
12
|
+
### Features
|
13
|
+
|
14
|
+
- **firestore:** support for second database ([#7949](https://github.com/invertase/react-native-firebase/issues/7949)) ([eec08a0](https://github.com/invertase/react-native-firebase/commit/eec08a06f41dd96d13778fbed2afcaaac238fca4))
|
15
|
+
|
6
16
|
## [20.3.0](https://github.com/invertase/react-native-firebase/compare/v20.2.1...v20.3.0) (2024-07-19)
|
7
17
|
|
8
18
|
### Bug Fixes
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { describe, expect, it } from '@jest/globals';
|
2
|
+
|
3
|
+
import {
|
4
|
+
deleteApp,
|
5
|
+
registerVersion,
|
6
|
+
onLog,
|
7
|
+
getApps,
|
8
|
+
initializeApp,
|
9
|
+
getApp,
|
10
|
+
setLogLevel,
|
11
|
+
} from '../lib';
|
12
|
+
|
13
|
+
describe('App', function () {
|
14
|
+
describe('modular', function () {
|
15
|
+
it('`deleteApp` function is properly exposed to end user', function () {
|
16
|
+
expect(deleteApp).toBeDefined();
|
17
|
+
});
|
18
|
+
|
19
|
+
it('`registerVersion` function is properly exposed to end user', function () {
|
20
|
+
expect(registerVersion).toBeDefined();
|
21
|
+
});
|
22
|
+
|
23
|
+
it('`onLog` function is properly exposed to end user', function () {
|
24
|
+
expect(onLog).toBeDefined();
|
25
|
+
});
|
26
|
+
|
27
|
+
it('`getApps` function is properly exposed to end user', function () {
|
28
|
+
expect(getApps).toBeDefined();
|
29
|
+
});
|
30
|
+
|
31
|
+
it('`initializeApp` function is properly exposed to end user', function () {
|
32
|
+
expect(initializeApp).toBeDefined();
|
33
|
+
});
|
34
|
+
|
35
|
+
it('`getApp` function is properly exposed to end user', function () {
|
36
|
+
expect(getApp).toBeDefined();
|
37
|
+
});
|
38
|
+
|
39
|
+
it('`setLogLevel` function is properly exposed to end user', function () {
|
40
|
+
expect(setLogLevel).toBeDefined();
|
41
|
+
});
|
42
|
+
});
|
43
|
+
});
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
*
|
16
16
|
*/
|
17
17
|
|
18
|
-
import { isString } from '
|
18
|
+
import { isString } 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';
|
@@ -93,19 +93,21 @@ function getOrCreateModuleForApp(app, moduleNamespace) {
|
|
93
93
|
);
|
94
94
|
}
|
95
95
|
|
96
|
-
// e.g. firebase.storage(customUrlOrRegion)
|
97
|
-
function firebaseModuleWithArgs(
|
98
|
-
if (
|
96
|
+
// e.g. firebase.storage(customUrlOrRegion), firebase.functions(customUrlOrRegion), firebase.firestore(databaseId), firebase.database(url)
|
97
|
+
function firebaseModuleWithArgs(customUrlOrRegionOrDatabaseId) {
|
98
|
+
if (customUrlOrRegionOrDatabaseId !== undefined) {
|
99
99
|
if (!hasCustomUrlOrRegionSupport) {
|
100
100
|
// TODO throw Module does not support arguments error
|
101
101
|
}
|
102
102
|
|
103
|
-
if (!isString(
|
103
|
+
if (!isString(customUrlOrRegionOrDatabaseId)) {
|
104
104
|
// TODO throw Module first argument must be a string error
|
105
105
|
}
|
106
106
|
}
|
107
107
|
|
108
|
-
const key =
|
108
|
+
const key = customUrlOrRegionOrDatabaseId
|
109
|
+
? `${customUrlOrRegionOrDatabaseId}:${moduleNamespace}`
|
110
|
+
: moduleNamespace;
|
109
111
|
|
110
112
|
if (!APP_MODULE_INSTANCE[app.name]) {
|
111
113
|
APP_MODULE_INSTANCE[app.name] = {};
|
@@ -115,7 +117,7 @@ function getOrCreateModuleForApp(app, moduleNamespace) {
|
|
115
117
|
APP_MODULE_INSTANCE[app.name][key] = new ModuleClass(
|
116
118
|
app,
|
117
119
|
NAMESPACE_REGISTRY[moduleNamespace],
|
118
|
-
|
120
|
+
customUrlOrRegionOrDatabaseId,
|
119
121
|
);
|
120
122
|
}
|
121
123
|
|
@@ -153,7 +153,10 @@ function initialiseNativeModule(module) {
|
|
153
153
|
function subscribeToNativeModuleEvent(eventName) {
|
154
154
|
if (!NATIVE_MODULE_EVENT_SUBSCRIPTIONS[eventName]) {
|
155
155
|
RNFBNativeEventEmitter.addListener(eventName, event => {
|
156
|
-
if (event.appName) {
|
156
|
+
if (event.appName && event.databaseId) {
|
157
|
+
// Firestore requires both appName and databaseId to prefix
|
158
|
+
SharedEventEmitter.emit(`${event.appName}-${event.databaseId}-${eventName}`, event);
|
159
|
+
} else if (event.appName) {
|
157
160
|
// native event has an appName property - auto prefix and internally emit
|
158
161
|
SharedEventEmitter.emit(`${event.appName}-${eventName}`, event);
|
159
162
|
} else {
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import { ReactNativeFirebase } from '..';
|
2
|
+
|
3
|
+
import FirebaseApp = ReactNativeFirebase.FirebaseApp;
|
4
|
+
import FirebaseAppOptions = ReactNativeFirebase.FirebaseAppOptions;
|
5
|
+
import LogLevelString = ReactNativeFirebase.LogLevelString;
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Renders this app unusable and frees the resources of all associated services.
|
9
|
+
* @param app - FirebaseApp - The app to delete.
|
10
|
+
* @returns Promise<void>
|
11
|
+
*/
|
12
|
+
export function deleteApp(app: FirebaseApp): Promise<void>;
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Registers a library's name and version for platform logging purposes.
|
16
|
+
* @param libraryKeyOrName - Library name or key.
|
17
|
+
* @param version - Library version.
|
18
|
+
* @param variant - Library variant.
|
19
|
+
* @returns Promise<void>
|
20
|
+
*/
|
21
|
+
export function registerVersion(
|
22
|
+
libraryKeyOrName: string,
|
23
|
+
version: string,
|
24
|
+
variant: string | null,
|
25
|
+
): Promise<void>;
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Sets log handler for all Firebase SDKs.
|
29
|
+
* @param logCallback - The callback function to handle logs.
|
30
|
+
* @param options - Optional settings for log handling.
|
31
|
+
* @returns Promise<void>
|
32
|
+
* @throws Error - onLog is only supported on Web
|
33
|
+
*/
|
34
|
+
export function onLog(logCallback: (logData: any) => void, options?: any): Promise<void>;
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Gets the list of all initialized apps.
|
38
|
+
* @returns FirebaseApp[] - An array of all initialized Firebase apps.
|
39
|
+
*/
|
40
|
+
export function getApps(): FirebaseApp[];
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Initializes a Firebase app with the provided options and name.
|
44
|
+
* @param options - Options to configure the services used in the app.
|
45
|
+
* @param name - The optional name of the app to initialize ('[DEFAULT]' if omitted).
|
46
|
+
* @returns FirebaseApp - The initialized Firebase app.
|
47
|
+
*/
|
48
|
+
export function initializeApp(options: FirebaseAppOptions, name?: string): FirebaseApp;
|
49
|
+
|
50
|
+
/**
|
51
|
+
* Retrieves an instance of a Firebase app.
|
52
|
+
* @param name - The optional name of the app to return ('[DEFAULT]' if omitted).
|
53
|
+
* @returns FirebaseApp - The requested Firebase app instance.
|
54
|
+
*/
|
55
|
+
export function getApp(name?: string): FirebaseApp;
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Sets the log level across all Firebase SDKs.
|
59
|
+
* @param logLevel - The log level to set ('debug', 'verbose', 'info', 'warn', 'error', 'silent').
|
60
|
+
* @returns void
|
61
|
+
*/
|
62
|
+
export function setLogLevel(logLevel: LogLevelString): void;
|
@@ -0,0 +1,80 @@
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
2
|
+
import {
|
3
|
+
deleteApp as deleteAppCompat,
|
4
|
+
getApp as getAppCompat,
|
5
|
+
getApps as getAppsCompat,
|
6
|
+
initializeApp as initializeAppCompat,
|
7
|
+
setLogLevel as setLogLevelCompat,
|
8
|
+
} from '../internal';
|
9
|
+
|
10
|
+
/**
|
11
|
+
* @typedef {import('..').ReactNativeFirebase.FirebaseApp} FirebaseApp
|
12
|
+
* @typedef {import('..').ReactNativeFirebase.FirebaseAppOptions} FirebaseAppOptions
|
13
|
+
* @typedef {import('..').ReactNativeFirebase.LogLevelString} LogLevelString
|
14
|
+
*/
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Renders this app unusable and frees the resources of all associated services.
|
18
|
+
* @param {FirebaseApp} app - The app to delete.
|
19
|
+
* @returns {Promise<void>}
|
20
|
+
*/
|
21
|
+
export function deleteApp(app) {
|
22
|
+
return deleteAppCompat(app.name, app._nativeInitialized);
|
23
|
+
}
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Registers a library's name and version for platform logging purposes.
|
27
|
+
@param {string} libraryKeyOrName - library name or key.
|
28
|
+
@param {string} version - library version.
|
29
|
+
@param {string | null} variant - library variant.
|
30
|
+
* @returns {Promise<void>}
|
31
|
+
*/
|
32
|
+
export function registerVersion(libraryKeyOrName, version, variant) {
|
33
|
+
throw new Error('registerVersion is only supported on Web');
|
34
|
+
}
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Sets log handler for all Firebase SDKs.
|
38
|
+
* @param {Function} logCallback - The callback function to handle logs.
|
39
|
+
* @param {Object} [options] - Optional settings for log handling.
|
40
|
+
* @returns {Promise<void>}
|
41
|
+
*/
|
42
|
+
export function onLog(logCallback, options) {
|
43
|
+
throw new Error('onLog is only supported on Web');
|
44
|
+
}
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Gets the list of all initialized apps.
|
48
|
+
* @returns {FirebaseApp[]} - An array of all initialized Firebase apps.
|
49
|
+
*/
|
50
|
+
export function getApps() {
|
51
|
+
return getAppsCompat();
|
52
|
+
}
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Initializes a Firebase app with the provided options and name.
|
56
|
+
* @param {FirebaseAppOptions} options - Options to configure the services used in the app.
|
57
|
+
* @param {string} [name] - The optional name of the app to initialize ('[DEFAULT]' if omitted).
|
58
|
+
* @returns {FirebaseApp} - The initialized Firebase app.
|
59
|
+
*/
|
60
|
+
export function initializeApp(options, name) {
|
61
|
+
return initializeAppCompat(options, name);
|
62
|
+
}
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Retrieves an instance of a Firebase app.
|
66
|
+
* @param {string} [name] - The optional name of the app to return ('[DEFAULT]' if omitted).
|
67
|
+
* @returns {FirebaseApp} - The requested Firebase app instance.
|
68
|
+
*/
|
69
|
+
export function getApp(name) {
|
70
|
+
return getAppCompat(name);
|
71
|
+
}
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Sets the log level across all Firebase SDKs.
|
75
|
+
* @param {LogLevelString} logLevel - The log level to set ('debug', 'verbose', 'info', 'warn', 'error', 'silent').
|
76
|
+
* @returns {void}
|
77
|
+
*/
|
78
|
+
export function setLogLevel(logLevel) {
|
79
|
+
return setLogLevelCompat(logLevel);
|
80
|
+
}
|
package/lib/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
// Generated by genversion.
|
2
|
-
module.exports = '20.
|
2
|
+
module.exports = '20.5.0';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-native-firebase/app",
|
3
|
-
"version": "20.
|
3
|
+
"version": "20.5.0",
|
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",
|
@@ -89,5 +89,5 @@
|
|
89
89
|
"playServicesAuth": "21.2.0"
|
90
90
|
}
|
91
91
|
},
|
92
|
-
"gitHead": "
|
92
|
+
"gitHead": "daf2bc9086c14bbb0e1b02a4d4274b7060263eb1"
|
93
93
|
}
|
package/lib/modular/app.js
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
2
|
-
import {
|
3
|
-
deleteApp as deleteAppCompat,
|
4
|
-
getApp,
|
5
|
-
getApps,
|
6
|
-
initializeApp,
|
7
|
-
setLogLevel,
|
8
|
-
} from '../internal';
|
9
|
-
|
10
|
-
/**
|
11
|
-
* Renders this app unusable and frees the resources of all associated services.
|
12
|
-
* @param app - FirebaseApp - The app to delete.
|
13
|
-
* @returns
|
14
|
-
*/
|
15
|
-
export function deleteApp(app) {
|
16
|
-
return deleteAppCompat(app.name, app._nativeInitialized);
|
17
|
-
}
|
18
|
-
|
19
|
-
/**
|
20
|
-
* Registers a library's name and version for platform logging purposes.
|
21
|
-
*/
|
22
|
-
export function registerVersion() {
|
23
|
-
throw new Error('registerVersion is only supported on Web');
|
24
|
-
}
|
25
|
-
|
26
|
-
/**
|
27
|
-
* Sets log handler for all Firebase SDKs.
|
28
|
-
*/
|
29
|
-
export function onLog(logCallback, options) {
|
30
|
-
throw new Error('onLog is only supported on Web');
|
31
|
-
}
|
32
|
-
|
33
|
-
export { getApps, initializeApp, getApp, setLogLevel };
|