@react-native-firebase/app 14.0.0 → 14.0.1
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 +6 -0
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseVersion.java +1 -1
- package/ios/RNFBApp/RNFBVersion.m +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/plugin/build/ios/appDelegate.js +36 -10
- package/plugin/src/ios/appDelegate.ts +45 -11
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,12 @@
|
|
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
|
+
## [14.0.1](https://github.com/invertase/react-native-firebase/compare/v14.0.0...v14.0.1) (2021-12-15)
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
- **app, expo:** Update AppDelegate config plugin for Expo SDK 44 ([#5940](https://github.com/invertase/react-native-firebase/issues/5940)) ([185756d](https://github.com/invertase/react-native-firebase/commit/185756df6de238aa8a018007cf6b2fa810cb6055))
|
11
|
+
|
6
12
|
# [14.0.0](https://github.com/invertase/react-native-firebase/compare/v13.1.1...v14.0.0) (2021-12-14)
|
7
13
|
|
8
14
|
**Note:** Version bump only for package @react-native-firebase/app
|
package/lib/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
// generated by genversion
|
2
|
-
module.exports = '14.0.
|
2
|
+
module.exports = '14.0.1';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-native-firebase/app",
|
3
|
-
"version": "14.0.
|
3
|
+
"version": "14.0.1",
|
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",
|
@@ -79,5 +79,5 @@
|
|
79
79
|
"playServicesAuth": "20.0.0"
|
80
80
|
}
|
81
81
|
},
|
82
|
-
"gitHead": "
|
82
|
+
"gitHead": "c2f5b82e487ba3c05e10ccafaa8cc09b43cb5811"
|
83
83
|
}
|
@@ -8,8 +8,11 @@ const config_plugins_1 = require("@expo/config-plugins");
|
|
8
8
|
const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
10
10
|
const methodInvocationBlock = `[FIRApp configure];`;
|
11
|
-
// https://regex101.com/r/
|
12
|
-
const methodInvocationLineMatcher = /(?:(self\.|_)(\w+)\s?=\s?\[\[UMModuleRegistryAdapter alloc\])|(?:RCTBridge\s?\*\s?(\w+)\s?=\s?\[\[RCTBridge alloc\])/g;
|
11
|
+
// https://regex101.com/r/mPgaq6/1
|
12
|
+
const methodInvocationLineMatcher = /(?:(self\.|_)(\w+)\s?=\s?\[\[UMModuleRegistryAdapter alloc\])|(?:RCTBridge\s?\*\s?(\w+)\s?=\s?\[(\[RCTBridge alloc\]|self\.reactDelegate))/g;
|
13
|
+
// https://regex101.com/r/nHrTa9/1/
|
14
|
+
// if the above regex fails, we can use this one as a fallback:
|
15
|
+
const fallbackInvocationLineMatcher = /-\s*\(BOOL\)\s*application:\s*\(UIApplication\s*\*\s*\)\s*\w+\s+didFinishLaunchingWithOptions:/g;
|
13
16
|
function modifyObjcAppDelegate(contents) {
|
14
17
|
// Add import
|
15
18
|
if (!contents.includes('@import Firebase;')) {
|
@@ -20,15 +23,38 @@ function modifyObjcAppDelegate(contents) {
|
|
20
23
|
if (contents.includes(methodInvocationBlock)) {
|
21
24
|
return contents;
|
22
25
|
}
|
26
|
+
if (!methodInvocationLineMatcher.test(contents) &&
|
27
|
+
!fallbackInvocationLineMatcher.test(contents)) {
|
28
|
+
config_plugins_1.WarningAggregator.addWarningIOS('@react-native-firebase/app', 'Unable to determine correct Firebase insertion point in AppDelegate.m. Skipping Firebase addition.');
|
29
|
+
return contents;
|
30
|
+
}
|
23
31
|
// Add invocation
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
+
try {
|
33
|
+
return (0, generateCode_1.mergeContents)({
|
34
|
+
tag: '@react-native-firebase/app-didFinishLaunchingWithOptions',
|
35
|
+
src: contents,
|
36
|
+
newSrc: methodInvocationBlock,
|
37
|
+
anchor: methodInvocationLineMatcher,
|
38
|
+
offset: 0,
|
39
|
+
comment: '//',
|
40
|
+
}).contents;
|
41
|
+
}
|
42
|
+
catch (e) {
|
43
|
+
// tests if the opening `{` is in the new line
|
44
|
+
const multilineMatcher = new RegExp(fallbackInvocationLineMatcher.source + '.+\\n*{');
|
45
|
+
const isHeaderMultiline = multilineMatcher.test(contents);
|
46
|
+
// we fallback to another regex if the first one fails
|
47
|
+
return (0, generateCode_1.mergeContents)({
|
48
|
+
tag: '@react-native-firebase/app-didFinishLaunchingWithOptions-fallback',
|
49
|
+
src: contents,
|
50
|
+
newSrc: methodInvocationBlock,
|
51
|
+
anchor: fallbackInvocationLineMatcher,
|
52
|
+
// new line will be inserted right below matched anchor
|
53
|
+
// or two lines, if the `{` is in the new line
|
54
|
+
offset: isHeaderMultiline ? 2 : 1,
|
55
|
+
comment: '//',
|
56
|
+
}).contents;
|
57
|
+
}
|
32
58
|
}
|
33
59
|
exports.modifyObjcAppDelegate = modifyObjcAppDelegate;
|
34
60
|
const withFirebaseAppDelegate = config => {
|
@@ -1,11 +1,16 @@
|
|
1
|
-
import { ConfigPlugin, IOSConfig, withDangerousMod } from '@expo/config-plugins';
|
1
|
+
import { ConfigPlugin, IOSConfig, WarningAggregator, withDangerousMod } from '@expo/config-plugins';
|
2
2
|
import { mergeContents } from '@expo/config-plugins/build/utils/generateCode';
|
3
3
|
import fs from 'fs';
|
4
4
|
|
5
5
|
const methodInvocationBlock = `[FIRApp configure];`;
|
6
|
-
// https://regex101.com/r/
|
6
|
+
// https://regex101.com/r/mPgaq6/1
|
7
7
|
const methodInvocationLineMatcher =
|
8
|
-
/(?:(self\.|_)(\w+)\s?=\s?\[\[UMModuleRegistryAdapter alloc\])|(?:RCTBridge\s?\*\s?(\w+)\s?=\s?\[\[RCTBridge alloc\])/g;
|
8
|
+
/(?:(self\.|_)(\w+)\s?=\s?\[\[UMModuleRegistryAdapter alloc\])|(?:RCTBridge\s?\*\s?(\w+)\s?=\s?\[(\[RCTBridge alloc\]|self\.reactDelegate))/g;
|
9
|
+
|
10
|
+
// https://regex101.com/r/nHrTa9/1/
|
11
|
+
// if the above regex fails, we can use this one as a fallback:
|
12
|
+
const fallbackInvocationLineMatcher =
|
13
|
+
/-\s*\(BOOL\)\s*application:\s*\(UIApplication\s*\*\s*\)\s*\w+\s+didFinishLaunchingWithOptions:/g;
|
9
14
|
|
10
15
|
export function modifyObjcAppDelegate(contents: string): string {
|
11
16
|
// Add import
|
@@ -22,15 +27,44 @@ export function modifyObjcAppDelegate(contents: string): string {
|
|
22
27
|
return contents;
|
23
28
|
}
|
24
29
|
|
30
|
+
if (
|
31
|
+
!methodInvocationLineMatcher.test(contents) &&
|
32
|
+
!fallbackInvocationLineMatcher.test(contents)
|
33
|
+
) {
|
34
|
+
WarningAggregator.addWarningIOS(
|
35
|
+
'@react-native-firebase/app',
|
36
|
+
'Unable to determine correct Firebase insertion point in AppDelegate.m. Skipping Firebase addition.',
|
37
|
+
);
|
38
|
+
return contents;
|
39
|
+
}
|
40
|
+
|
25
41
|
// Add invocation
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
42
|
+
try {
|
43
|
+
return mergeContents({
|
44
|
+
tag: '@react-native-firebase/app-didFinishLaunchingWithOptions',
|
45
|
+
src: contents,
|
46
|
+
newSrc: methodInvocationBlock,
|
47
|
+
anchor: methodInvocationLineMatcher,
|
48
|
+
offset: 0, // new line will be inserted right above matched anchor
|
49
|
+
comment: '//',
|
50
|
+
}).contents;
|
51
|
+
} catch (e: any) {
|
52
|
+
// tests if the opening `{` is in the new line
|
53
|
+
const multilineMatcher = new RegExp(fallbackInvocationLineMatcher.source + '.+\\n*{');
|
54
|
+
const isHeaderMultiline = multilineMatcher.test(contents);
|
55
|
+
|
56
|
+
// we fallback to another regex if the first one fails
|
57
|
+
return mergeContents({
|
58
|
+
tag: '@react-native-firebase/app-didFinishLaunchingWithOptions-fallback',
|
59
|
+
src: contents,
|
60
|
+
newSrc: methodInvocationBlock,
|
61
|
+
anchor: fallbackInvocationLineMatcher,
|
62
|
+
// new line will be inserted right below matched anchor
|
63
|
+
// or two lines, if the `{` is in the new line
|
64
|
+
offset: isHeaderMultiline ? 2 : 1,
|
65
|
+
comment: '//',
|
66
|
+
}).contents;
|
67
|
+
}
|
34
68
|
}
|
35
69
|
|
36
70
|
export const withFirebaseAppDelegate: ConfigPlugin = config => {
|