@react-native-firebase/app 21.7.4 → 21.9.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 +16 -0
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseVersion.java +1 -1
- package/ios/RNFBApp/RNFBVersion.m +1 -1
- package/lib/internal/RNFBNativeEventEmitter.js +4 -4
- package/lib/internal/nativeModuleAndroidIos.js +1 -1
- package/lib/internal/nativeModuleWeb.js +2 -1
- package/lib/version.js +1 -1
- package/package.json +8 -8
- package/plugin/build/ios/appDelegate.d.ts +1 -0
- package/plugin/build/ios/appDelegate.js +47 -13
- package/plugin/src/ios/appDelegate.ts +62 -15
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/__tests__/app.test.ts +0 -96
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,22 @@
|
|
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.9.0](https://github.com/invertase/react-native-firebase/compare/v21.8.0...v21.9.0) (2025-02-11)
|
7
|
+
|
8
|
+
### Features
|
9
|
+
|
10
|
+
- **app, expo:** support rn77 AppDelegate.swift in config plugin ([#8324](https://github.com/invertase/react-native-firebase/issues/8324)) ([6a7867c](https://github.com/invertase/react-native-firebase/commit/6a7867c9366b851a6de62cc37b7834090caad98b))
|
11
|
+
|
12
|
+
### Bug Fixes
|
13
|
+
|
14
|
+
- firebase-ios-sdk 11.8.0 / firebase-android-sdk 33.9.0 ([67aba08](https://github.com/invertase/react-native-firebase/commit/67aba08c00aa46b72fcb1353bd428fa552b6686a))
|
15
|
+
|
16
|
+
## [21.8.0](https://github.com/invertase/react-native-firebase/compare/v21.7.4...v21.8.0) (2025-02-10)
|
17
|
+
|
18
|
+
### Bug Fixes
|
19
|
+
|
20
|
+
- do not ship unit tests in released packages ([e71dadf](https://github.com/invertase/react-native-firebase/commit/e71dadfc1c0cad2e89c94100913af31ddf7d9c91))
|
21
|
+
|
6
22
|
## [21.7.4](https://github.com/invertase/react-native-firebase/compare/v21.7.3...v21.7.4) (2025-02-08)
|
7
23
|
|
8
24
|
**Note:** Version bump only for package @react-native-firebase/app
|
@@ -37,24 +37,24 @@ class RNFBNativeEventEmitter extends NativeEventEmitter {
|
|
37
37
|
this.ready = true;
|
38
38
|
}
|
39
39
|
RNFBAppModule.eventsAddListener(eventType);
|
40
|
-
if (
|
40
|
+
if (globalThis.RNFBDebug) {
|
41
41
|
// eslint-disable-next-line no-console
|
42
42
|
console.debug(`[RNFB-->Event][👂] ${eventType} -> listening`);
|
43
43
|
}
|
44
44
|
const listenerDebugger = (...args) => {
|
45
|
-
if (
|
45
|
+
if (globalThis.RNFBDebug) {
|
46
46
|
// eslint-disable-next-line no-console
|
47
47
|
console.debug(`[RNFB<--Event][📣] ${eventType} <-`, JSON.stringify(args[0]));
|
48
48
|
// Possible leaking test if events are still being received after the test.
|
49
49
|
// This is not super accurate but it's better than nothing, e.g. if doing setup/teardown
|
50
50
|
// logic outside of a test this may cause false positives.
|
51
|
-
if (
|
51
|
+
if (globalThis.RNFBTest && !globalThis.RNFBDebugInTestLeakDetection) {
|
52
52
|
// eslint-disable-next-line no-console
|
53
53
|
console.debug(
|
54
54
|
`[TEST--->Leak][💡] Possible leaking test detected! An event (☝️) ` +
|
55
55
|
`was received outside of any running tests which may indicates that some ` +
|
56
56
|
`listeners/event subscriptions that have not been unsubscribed from in your ` +
|
57
|
-
`test code. The last test that ran was: "${
|
57
|
+
`test code. The last test that ran was: "${globalThis.RNFBDebugLastTest}".`,
|
58
58
|
);
|
59
59
|
}
|
60
60
|
}
|
@@ -9,7 +9,7 @@ import { NativeModules } from 'react-native';
|
|
9
9
|
*/
|
10
10
|
export function getReactNativeModule(moduleName) {
|
11
11
|
const nativeModule = NativeModules[moduleName];
|
12
|
-
if (!
|
12
|
+
if (!globalThis.RNFBDebug) {
|
13
13
|
return nativeModule;
|
14
14
|
}
|
15
15
|
return new Proxy(nativeModule, {
|
@@ -10,11 +10,12 @@ export function getReactNativeModule(moduleName) {
|
|
10
10
|
if (!nativeModule) {
|
11
11
|
throw new Error(`Native module ${moduleName} is not registered.`);
|
12
12
|
}
|
13
|
-
if (!
|
13
|
+
if (!globalThis.RNFBDebug) {
|
14
14
|
return nativeModule;
|
15
15
|
}
|
16
16
|
return new Proxy(nativeModule, {
|
17
17
|
ownKeys(target) {
|
18
|
+
// FIXME - test in new arch context - I don't think Object.keys works
|
18
19
|
return Object.keys(target);
|
19
20
|
},
|
20
21
|
get: (_, name) => {
|
package/lib/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
// Generated by genversion.
|
2
|
-
module.exports = '21.
|
2
|
+
module.exports = '21.9.0';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-native-firebase/app",
|
3
|
-
"version": "21.
|
3
|
+
"version": "21.9.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",
|
@@ -57,11 +57,11 @@
|
|
57
57
|
"react-native": "*"
|
58
58
|
},
|
59
59
|
"dependencies": {
|
60
|
-
"firebase": "11.
|
60
|
+
"firebase": "11.3.0"
|
61
61
|
},
|
62
62
|
"devDependencies": {
|
63
63
|
"@react-native-async-storage/async-storage": "^2.1.1",
|
64
|
-
"expo": "^52.0.
|
64
|
+
"expo": "^52.0.32"
|
65
65
|
},
|
66
66
|
"peerDependenciesMeta": {
|
67
67
|
"expo": {
|
@@ -73,7 +73,7 @@
|
|
73
73
|
},
|
74
74
|
"sdkVersions": {
|
75
75
|
"ios": {
|
76
|
-
"firebase": "11.
|
76
|
+
"firebase": "11.8.0",
|
77
77
|
"iosTarget": "13.0",
|
78
78
|
"macosTarget": "10.15",
|
79
79
|
"tvosTarget": "13.0"
|
@@ -82,13 +82,13 @@
|
|
82
82
|
"minSdk": 21,
|
83
83
|
"targetSdk": 34,
|
84
84
|
"compileSdk": 34,
|
85
|
-
"firebase": "33.
|
86
|
-
"firebaseCrashlyticsGradle": "3.0.
|
85
|
+
"firebase": "33.9.0",
|
86
|
+
"firebaseCrashlyticsGradle": "3.0.3",
|
87
87
|
"firebasePerfGradle": "1.4.2",
|
88
88
|
"gmsGoogleServicesGradle": "4.4.2",
|
89
89
|
"playServicesAuth": "21.3.0",
|
90
|
-
"firebaseAppDistributionGradle": "5.1.
|
90
|
+
"firebaseAppDistributionGradle": "5.1.1"
|
91
91
|
}
|
92
92
|
},
|
93
|
-
"gitHead": "
|
93
|
+
"gitHead": "306d9c766ff5614fff6404be5c3dd4bcdb450754"
|
94
94
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ConfigPlugin } from '@expo/config-plugins';
|
2
2
|
import { AppDelegateProjectFile } from '@expo/config-plugins/build/ios/Paths';
|
3
3
|
export declare function modifyObjcAppDelegate(contents: string): string;
|
4
|
+
export declare function modifySwiftAppDelegate(contents: string): string;
|
4
5
|
export declare function modifyAppDelegateAsync(appDelegateFileInfo: AppDelegateProjectFile): Promise<void>;
|
5
6
|
export declare const withFirebaseAppDelegate: ConfigPlugin;
|
@@ -5,17 +5,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.withFirebaseAppDelegate = void 0;
|
7
7
|
exports.modifyObjcAppDelegate = modifyObjcAppDelegate;
|
8
|
+
exports.modifySwiftAppDelegate = modifySwiftAppDelegate;
|
8
9
|
exports.modifyAppDelegateAsync = modifyAppDelegateAsync;
|
9
10
|
const config_plugins_1 = require("@expo/config-plugins");
|
10
11
|
const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
|
11
12
|
const fs_1 = __importDefault(require("fs"));
|
12
|
-
const methodInvocationBlock = `[FIRApp configure];`;
|
13
|
-
// https://regex101.com/r/mPgaq6/1
|
14
|
-
const methodInvocationLineMatcher = /(?:self\.moduleName\s*=\s*@\"([^"]*)\";)|(?:(self\.|_)(\w+)\s?=\s?\[\[UMModuleRegistryAdapter alloc\])|(?:RCTBridge\s?\*\s?(\w+)\s?=\s?\[(\[RCTBridge alloc\]|self\.reactDelegate))/g;
|
15
|
-
// https://regex101.com/r/nHrTa9/1/
|
16
|
-
// if the above regex fails, we can use this one as a fallback:
|
17
|
-
const fallbackInvocationLineMatcher = /-\s*\(BOOL\)\s*application:\s*\(UIApplication\s*\*\s*\)\s*\w+\s+didFinishLaunchingWithOptions:/g;
|
18
13
|
function modifyObjcAppDelegate(contents) {
|
14
|
+
const methodInvocationBlock = `[FIRApp configure];`;
|
15
|
+
// https://regex101.com/r/mPgaq6/1
|
16
|
+
const methodInvocationLineMatcher = /(?:self\.moduleName\s*=\s*@\"([^"]*)\";)|(?:(self\.|_)(\w+)\s?=\s?\[\[UMModuleRegistryAdapter alloc\])|(?:RCTBridge\s?\*\s?(\w+)\s?=\s?\[(\[RCTBridge alloc\]|self\.reactDelegate))/g;
|
17
|
+
// https://regex101.com/r/nHrTa9/1/
|
18
|
+
// if the above regex fails, we can use this one as a fallback:
|
19
|
+
const fallbackInvocationLineMatcher = /-\s*\(BOOL\)\s*application:\s*\(UIApplication\s*\*\s*\)\s*\w+\s+didFinishLaunchingWithOptions:/g;
|
19
20
|
// Add import
|
20
21
|
if (!contents.includes('#import <Firebase/Firebase.h>')) {
|
21
22
|
contents = contents.replace(/#import "AppDelegate.h"/g, `#import "AppDelegate.h"
|
@@ -58,16 +59,49 @@ function modifyObjcAppDelegate(contents) {
|
|
58
59
|
}).contents;
|
59
60
|
}
|
60
61
|
}
|
62
|
+
function modifySwiftAppDelegate(contents) {
|
63
|
+
const methodInvocationBlock = `FirebaseApp.configure()`;
|
64
|
+
const methodInvocationLineMatcher = /(?:self\.moduleName\s*=\s*"([^"]*)")/g;
|
65
|
+
// Add import
|
66
|
+
if (!contents.includes('import FirebaseCore')) {
|
67
|
+
contents = contents.replace(/import ReactAppDependencyProvider/g, `import ReactAppDependencyProvider
|
68
|
+
import FirebaseCore`);
|
69
|
+
}
|
70
|
+
// To avoid potential issues with existing changes from older plugin versions
|
71
|
+
if (contents.includes(methodInvocationBlock)) {
|
72
|
+
return contents;
|
73
|
+
}
|
74
|
+
if (!methodInvocationLineMatcher.test(contents)) {
|
75
|
+
config_plugins_1.WarningAggregator.addWarningIOS('@react-native-firebase/app', 'Unable to determine correct Firebase insertion point in AppDelegate.swift. Skipping Firebase addition.');
|
76
|
+
return contents;
|
77
|
+
}
|
78
|
+
// Add invocation
|
79
|
+
return (0, generateCode_1.mergeContents)({
|
80
|
+
tag: '@react-native-firebase/app-didFinishLaunchingWithOptions',
|
81
|
+
src: contents,
|
82
|
+
newSrc: methodInvocationBlock,
|
83
|
+
anchor: methodInvocationLineMatcher,
|
84
|
+
offset: 0, // new line will be inserted right above matched anchor
|
85
|
+
comment: '//',
|
86
|
+
}).contents;
|
87
|
+
}
|
61
88
|
async function modifyAppDelegateAsync(appDelegateFileInfo) {
|
62
89
|
const { language, path, contents } = appDelegateFileInfo;
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
90
|
+
let newContents = contents;
|
91
|
+
switch (language) {
|
92
|
+
case 'objc':
|
93
|
+
case 'objcpp': {
|
94
|
+
newContents = modifyObjcAppDelegate(contents);
|
95
|
+
break;
|
96
|
+
}
|
97
|
+
case 'swift': {
|
98
|
+
newContents = modifySwiftAppDelegate(contents);
|
99
|
+
break;
|
100
|
+
}
|
101
|
+
default:
|
102
|
+
throw new Error(`Cannot add Firebase code to AppDelegate of language "${language}"`);
|
70
103
|
}
|
104
|
+
await fs_1.default.promises.writeFile(path, newContents);
|
71
105
|
}
|
72
106
|
const withFirebaseAppDelegate = config => {
|
73
107
|
return (0, config_plugins_1.withDangerousMod)(config, [
|
@@ -3,17 +3,17 @@ import { AppDelegateProjectFile } from '@expo/config-plugins/build/ios/Paths';
|
|
3
3
|
import { mergeContents } from '@expo/config-plugins/build/utils/generateCode';
|
4
4
|
import fs from 'fs';
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
export function modifyObjcAppDelegate(contents: string): string {
|
7
|
+
const methodInvocationBlock = `[FIRApp configure];`;
|
8
|
+
// https://regex101.com/r/mPgaq6/1
|
9
|
+
const methodInvocationLineMatcher =
|
10
|
+
/(?:self\.moduleName\s*=\s*@\"([^"]*)\";)|(?:(self\.|_)(\w+)\s?=\s?\[\[UMModuleRegistryAdapter alloc\])|(?:RCTBridge\s?\*\s?(\w+)\s?=\s?\[(\[RCTBridge alloc\]|self\.reactDelegate))/g;
|
10
11
|
|
11
|
-
// https://regex101.com/r/nHrTa9/1/
|
12
|
-
// if the above regex fails, we can use this one as a fallback:
|
13
|
-
const fallbackInvocationLineMatcher =
|
14
|
-
|
12
|
+
// https://regex101.com/r/nHrTa9/1/
|
13
|
+
// if the above regex fails, we can use this one as a fallback:
|
14
|
+
const fallbackInvocationLineMatcher =
|
15
|
+
/-\s*\(BOOL\)\s*application:\s*\(UIApplication\s*\*\s*\)\s*\w+\s+didFinishLaunchingWithOptions:/g;
|
15
16
|
|
16
|
-
export function modifyObjcAppDelegate(contents: string): string {
|
17
17
|
// Add import
|
18
18
|
if (!contents.includes('#import <Firebase/Firebase.h>')) {
|
19
19
|
contents = contents.replace(
|
@@ -68,16 +68,63 @@ export function modifyObjcAppDelegate(contents: string): string {
|
|
68
68
|
}
|
69
69
|
}
|
70
70
|
|
71
|
+
export function modifySwiftAppDelegate(contents: string): string {
|
72
|
+
const methodInvocationBlock = `FirebaseApp.configure()`;
|
73
|
+
const methodInvocationLineMatcher = /(?:self\.moduleName\s*=\s*"([^"]*)")/g;
|
74
|
+
|
75
|
+
// Add import
|
76
|
+
if (!contents.includes('import FirebaseCore')) {
|
77
|
+
contents = contents.replace(
|
78
|
+
/import ReactAppDependencyProvider/g,
|
79
|
+
`import ReactAppDependencyProvider
|
80
|
+
import FirebaseCore`,
|
81
|
+
);
|
82
|
+
}
|
83
|
+
|
84
|
+
// To avoid potential issues with existing changes from older plugin versions
|
85
|
+
if (contents.includes(methodInvocationBlock)) {
|
86
|
+
return contents;
|
87
|
+
}
|
88
|
+
|
89
|
+
if (!methodInvocationLineMatcher.test(contents)) {
|
90
|
+
WarningAggregator.addWarningIOS(
|
91
|
+
'@react-native-firebase/app',
|
92
|
+
'Unable to determine correct Firebase insertion point in AppDelegate.swift. Skipping Firebase addition.',
|
93
|
+
);
|
94
|
+
return contents;
|
95
|
+
}
|
96
|
+
|
97
|
+
// Add invocation
|
98
|
+
return mergeContents({
|
99
|
+
tag: '@react-native-firebase/app-didFinishLaunchingWithOptions',
|
100
|
+
src: contents,
|
101
|
+
newSrc: methodInvocationBlock,
|
102
|
+
anchor: methodInvocationLineMatcher,
|
103
|
+
offset: 0, // new line will be inserted right above matched anchor
|
104
|
+
comment: '//',
|
105
|
+
}).contents;
|
106
|
+
}
|
107
|
+
|
71
108
|
export async function modifyAppDelegateAsync(appDelegateFileInfo: AppDelegateProjectFile) {
|
72
109
|
const { language, path, contents } = appDelegateFileInfo;
|
73
110
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
111
|
+
let newContents = contents;
|
112
|
+
|
113
|
+
switch (language) {
|
114
|
+
case 'objc':
|
115
|
+
case 'objcpp': {
|
116
|
+
newContents = modifyObjcAppDelegate(contents);
|
117
|
+
break;
|
118
|
+
}
|
119
|
+
case 'swift': {
|
120
|
+
newContents = modifySwiftAppDelegate(contents);
|
121
|
+
break;
|
122
|
+
}
|
123
|
+
default:
|
124
|
+
throw new Error(`Cannot add Firebase code to AppDelegate of language "${language}"`);
|
80
125
|
}
|
126
|
+
|
127
|
+
await fs.promises.writeFile(path, newContents);
|
81
128
|
}
|
82
129
|
|
83
130
|
export const withFirebaseAppDelegate: ConfigPlugin = config => {
|
@@ -1 +1 @@
|
|
1
|
-
{"root":["./src/index.ts","./src/android/
|
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"}
|
package/__tests__/app.test.ts
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
import { describe, expect, it, jest } from '@jest/globals';
|
2
|
-
import { checkV9Deprecation } from '../lib/common/unitTestUtils';
|
3
|
-
import firebase, {
|
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
|
-
|
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
|
-
});
|
96
|
-
});
|