@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 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
@@ -18,5 +18,5 @@ package io.invertase.firebase.app;
18
18
  */
19
19
  // generated file - do not modify or commit
20
20
  public class ReactNativeFirebaseVersion {
21
- public static String VERSION = "21.7.4";
21
+ public static String VERSION = "21.9.0";
22
22
  }
@@ -18,4 +18,4 @@
18
18
  #import <React/RCTVersion.h>
19
19
 
20
20
  // generated file - do not modify or commit
21
- NSString* const RNFBVersionString = @"21.7.4";
21
+ NSString* const RNFBVersionString = @"21.9.0";
@@ -37,24 +37,24 @@ class RNFBNativeEventEmitter extends NativeEventEmitter {
37
37
  this.ready = true;
38
38
  }
39
39
  RNFBAppModule.eventsAddListener(eventType);
40
- if (global.RNFBDebug) {
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 (global.RNFBDebug) {
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 (global.RNFBTest && !global.RNFBDebugInTestLeakDetection) {
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: "${global.RNFBDebugLastTest}".`,
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 (!global.RNFBDebug) {
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 (!global.RNFBDebug) {
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.7.4';
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.7.4",
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.2.0"
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.30"
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.7.0",
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.8.0",
86
- "firebaseCrashlyticsGradle": "3.0.2",
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.0"
90
+ "firebaseAppDistributionGradle": "5.1.1"
91
91
  }
92
92
  },
93
- "gitHead": "82c4c7391fee6597726e5363d78400f11a644e47"
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
- if (['objc', 'objcpp'].includes(language)) {
64
- const newContents = modifyObjcAppDelegate(contents);
65
- await fs_1.default.promises.writeFile(path, newContents);
66
- }
67
- else {
68
- // TODO: Support Swift
69
- throw new Error(`Cannot add Firebase code to AppDelegate of language "${language}"`);
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
- const methodInvocationBlock = `[FIRApp configure];`;
7
- // https://regex101.com/r/mPgaq6/1
8
- const methodInvocationLineMatcher =
9
- /(?:self\.moduleName\s*=\s*@\"([^"]*)\";)|(?:(self\.|_)(\w+)\s?=\s?\[\[UMModuleRegistryAdapter alloc\])|(?:RCTBridge\s?\*\s?(\w+)\s?=\s?\[(\[RCTBridge alloc\]|self\.reactDelegate))/g;
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
- /-\s*\(BOOL\)\s*application:\s*\(UIApplication\s*\*\s*\)\s*\w+\s+didFinishLaunchingWithOptions:/g;
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
- if (['objc', 'objcpp'].includes(language)) {
75
- const newContents = modifyObjcAppDelegate(contents);
76
- await fs.promises.writeFile(path, newContents);
77
- } else {
78
- // TODO: Support Swift
79
- throw new Error(`Cannot add Firebase code to AppDelegate of language "${language}"`);
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/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"}
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"}
@@ -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
- });