@react-native-firebase/app 23.8.0 → 23.8.2
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 +1547 -0
- package/RNFBApp.podspec +49 -0
- package/android/.editorconfig +10 -0
- package/android/build.gradle +129 -0
- package/android/firebase-json.gradle +73 -0
- package/android/gradle.properties +2 -0
- package/android/lint.xml +5 -0
- package/android/settings.gradle +1 -0
- package/android/src/main/AndroidManifest.xml +24 -0
- package/android/src/main/java/io/invertase/firebase/app/.gitkeep +0 -0
- package/android/src/main/java/io/invertase/firebase/common/TaskExecutorService.java +124 -0
- package/android/src/main/java/io/invertase/firebase/common/UniversalFirebaseModule.java +62 -0
- package/android/src/main/java/io/invertase/firebase/common/UniversalFirebasePreferences.java +91 -0
- package/android/src/main/java/io/invertase/firebase/interfaces/.gitkeep +0 -0
- package/android/src/reactnative/AndroidManifest.xml +2 -0
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseApp.java +46 -0
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppInitProvider.java +22 -0
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppModule.java +186 -0
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppPackage.java +49 -0
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppRegistrar.java +35 -0
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseVersion.java +22 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/RCTConvertFirebase.java +191 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseEvent.java +53 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseEventEmitter.java +151 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseInitProvider.java +78 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseJSON.java +107 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseMeta.java +93 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseModule.java +146 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebasePreferences.java +88 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/SharedUtils.java +440 -0
- package/android/src/reactnative/java/io/invertase/firebase/interfaces/ContextProvider.java +30 -0
- package/android/src/reactnative/java/io/invertase/firebase/interfaces/NativeError.java +32 -0
- package/android/src/reactnative/java/io/invertase/firebase/interfaces/NativeEvent.java +28 -0
- package/android/src/reactnative/java/io/invertase/firebase/utils/ReactNativeFirebaseUtilsModule.java +191 -0
- package/app.plugin.js +1 -0
- package/dist/commonjs/version.js +1 -1
- package/dist/module/version.js +1 -1
- package/dist/typescript/commonjs/lib/modular.d.ts +1 -1
- package/dist/typescript/commonjs/lib/version.d.ts +1 -1
- package/dist/typescript/module/lib/modular.d.ts +1 -1
- package/dist/typescript/module/lib/version.d.ts +1 -1
- package/firebase-schema.json +149 -0
- package/firebase_json.rb +72 -0
- package/ios/RNFBApp/RCTConvert+FIRApp.h +23 -0
- package/ios/RNFBApp/RCTConvert+FIRApp.m +31 -0
- package/ios/RNFBApp/RCTConvert+FIROptions.h +23 -0
- package/ios/RNFBApp/RCTConvert+FIROptions.m +36 -0
- package/ios/RNFBApp/RNFBAppModule.h +28 -0
- package/ios/RNFBApp/RNFBAppModule.m +305 -0
- package/ios/RNFBApp/RNFBJSON.h +36 -0
- package/ios/RNFBApp/RNFBJSON.m +99 -0
- package/ios/RNFBApp/RNFBMeta.h +30 -0
- package/ios/RNFBApp/RNFBMeta.m +61 -0
- package/ios/RNFBApp/RNFBNullSentinelInterceptor.h +47 -0
- package/ios/RNFBApp/RNFBNullSentinelInterceptor.m +74 -0
- package/ios/RNFBApp/RNFBPreferences.h +44 -0
- package/ios/RNFBApp/RNFBPreferences.m +94 -0
- package/ios/RNFBApp/RNFBRCTEventEmitter.h +73 -0
- package/ios/RNFBApp/RNFBRCTEventEmitter.m +151 -0
- package/ios/RNFBApp/RNFBSharedUtils.h +67 -0
- package/ios/RNFBApp/RNFBSharedUtils.m +285 -0
- package/ios/RNFBApp/RNFBUtilsModule.h +30 -0
- package/ios/RNFBApp/RNFBUtilsModule.m +100 -0
- package/ios/RNFBApp/RNFBVersion.h +20 -0
- package/ios/RNFBApp/RNFBVersion.m +21 -0
- package/ios/RNFBApp.xcodeproj/project.pbxproj +411 -0
- package/ios/RNFBApp.xcodeproj/xcshareddata/IDETemplateMacros.plist +24 -0
- package/ios_config.sh +269 -0
- package/lib/version.ts +1 -1
- package/package.json +4 -11
- package/plugin/build/android/applyPlugin.d.ts +6 -0
- package/plugin/build/android/applyPlugin.js +29 -0
- package/plugin/build/android/buildscriptDependency.d.ts +6 -0
- package/plugin/build/android/buildscriptDependency.js +31 -0
- package/plugin/build/android/constants.d.ts +4 -0
- package/plugin/build/android/constants.js +8 -0
- package/plugin/build/android/copyGoogleServices.d.ts +5 -0
- package/plugin/build/android/copyGoogleServices.js +33 -0
- package/plugin/build/android/index.d.ts +4 -0
- package/plugin/build/android/index.js +9 -0
- package/plugin/build/index.d.ts +3 -0
- package/plugin/build/index.js +21 -0
- package/plugin/build/ios/appDelegate.d.ts +6 -0
- package/plugin/build/ios/appDelegate.js +116 -0
- package/plugin/build/ios/googleServicesPlist.d.ts +7 -0
- package/plugin/build/ios/googleServicesPlist.js +42 -0
- package/plugin/build/ios/index.d.ts +3 -0
- package/plugin/build/ios/index.js +7 -0
- package/plugin/src/android/applyPlugin.ts +30 -0
- package/plugin/src/android/buildscriptDependency.ts +33 -0
- package/plugin/src/android/constants.ts +7 -0
- package/plugin/src/android/copyGoogleServices.ts +36 -0
- package/plugin/src/android/index.ts +5 -0
- package/plugin/src/index.ts +27 -0
- package/plugin/src/ios/appDelegate.ts +140 -0
- package/plugin/src/ios/googleServicesPlist.ts +55 -0
- package/plugin/src/ios/index.ts +4 -0
- package/plugin/tsconfig.json +9 -0
- package/plugin/tsconfig.tsbuildinfo +1 -0
- package/react-native.config.js +19 -0
- package/tsconfig.json +10 -0
package/ios_config.sh
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2016-present Invertase Limited & Contributors
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this library except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
##########################################################################
|
|
19
|
+
##########################################################################
|
|
20
|
+
#
|
|
21
|
+
# NOTE THAT IF YOU CHANGE THIS FILE YOU MUST RUN pod install AFTERWARDS
|
|
22
|
+
#
|
|
23
|
+
# This file is installed as an Xcode build script in the project file
|
|
24
|
+
# by cocoapods, and you will not see your changes until you pod install
|
|
25
|
+
#
|
|
26
|
+
##########################################################################
|
|
27
|
+
##########################################################################
|
|
28
|
+
|
|
29
|
+
set -e
|
|
30
|
+
|
|
31
|
+
_MAX_LOOKUPS=2;
|
|
32
|
+
_SEARCH_RESULT=''
|
|
33
|
+
_RN_ROOT_EXISTS=''
|
|
34
|
+
_CURRENT_LOOKUPS=1
|
|
35
|
+
_JSON_ROOT="'react-native'"
|
|
36
|
+
_JSON_FILE_NAME='firebase.json'
|
|
37
|
+
_JSON_OUTPUT_BASE64='e30=' # { }
|
|
38
|
+
_CURRENT_SEARCH_DIR=${PROJECT_DIR}
|
|
39
|
+
_PLIST_BUDDY=/usr/libexec/PlistBuddy
|
|
40
|
+
_TARGET_PLIST="${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}"
|
|
41
|
+
_DSYM_PLIST="${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist"
|
|
42
|
+
|
|
43
|
+
# plist arrays
|
|
44
|
+
_PLIST_ENTRY_KEYS=()
|
|
45
|
+
_PLIST_ENTRY_TYPES=()
|
|
46
|
+
_PLIST_ENTRY_VALUES=()
|
|
47
|
+
|
|
48
|
+
function setPlistValue {
|
|
49
|
+
echo "note: setting plist entry '$1' of type '$2' in file '$4'"
|
|
50
|
+
${_PLIST_BUDDY} -c "Add :$1 $2 '$3'" $4 || echo "note: '$1' already exists"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function getFirebaseJsonKeyValue () {
|
|
54
|
+
if [[ ${_RN_ROOT_EXISTS} ]]; then
|
|
55
|
+
ruby -Ku -e "require 'rubygems';require 'json'; output=JSON.parse('$1'); puts output[$_JSON_ROOT]['$2']"
|
|
56
|
+
else
|
|
57
|
+
echo ""
|
|
58
|
+
fi;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function jsonBoolToYesNo () {
|
|
62
|
+
if [[ $1 == "false" ]]; then
|
|
63
|
+
echo "NO"
|
|
64
|
+
elif [[ $1 == "true" ]]; then
|
|
65
|
+
echo "YES"
|
|
66
|
+
else echo "NO"
|
|
67
|
+
fi
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
echo "note: -> RNFB build script started"
|
|
71
|
+
echo "note: 1) Locating ${_JSON_FILE_NAME} file:"
|
|
72
|
+
|
|
73
|
+
if [[ -z ${_CURRENT_SEARCH_DIR} ]]; then
|
|
74
|
+
_CURRENT_SEARCH_DIR=$(pwd)
|
|
75
|
+
fi;
|
|
76
|
+
|
|
77
|
+
while true; do
|
|
78
|
+
_CURRENT_SEARCH_DIR=$(dirname "$_CURRENT_SEARCH_DIR")
|
|
79
|
+
if [[ "$_CURRENT_SEARCH_DIR" == "/" ]] || [[ ${_CURRENT_LOOKUPS} -gt ${_MAX_LOOKUPS} ]]; then break; fi;
|
|
80
|
+
echo "note: ($_CURRENT_LOOKUPS of $_MAX_LOOKUPS) Searching in '$_CURRENT_SEARCH_DIR' for a ${_JSON_FILE_NAME} file."
|
|
81
|
+
_SEARCH_RESULT=$(find "$_CURRENT_SEARCH_DIR" -maxdepth 2 -name ${_JSON_FILE_NAME} -print | /usr/bin/head -n 1)
|
|
82
|
+
if [[ ${_SEARCH_RESULT} ]]; then
|
|
83
|
+
echo "note: ${_JSON_FILE_NAME} found at $_SEARCH_RESULT"
|
|
84
|
+
break;
|
|
85
|
+
fi;
|
|
86
|
+
_CURRENT_LOOKUPS=$((_CURRENT_LOOKUPS+1))
|
|
87
|
+
done
|
|
88
|
+
|
|
89
|
+
if [[ ${_SEARCH_RESULT} ]]; then
|
|
90
|
+
_JSON_OUTPUT_RAW=$(cat "${_SEARCH_RESULT}")
|
|
91
|
+
if ! _RN_ROOT_EXISTS=$(ruby -Ku -e "require 'json'; output=JSON.parse('$_JSON_OUTPUT_RAW'); puts output[$_JSON_ROOT]"); then
|
|
92
|
+
echo "error: Failed to parse firebase.json, check for syntax errors."
|
|
93
|
+
exit 1
|
|
94
|
+
fi
|
|
95
|
+
|
|
96
|
+
if [[ ${_RN_ROOT_EXISTS} ]]; then
|
|
97
|
+
if ! python3 --version >/dev/null 2>&1; then echo "error: python3 not found, firebase.json file processing error." && exit 1; fi
|
|
98
|
+
_JSON_OUTPUT_BASE64=$(python3 -c 'import json,sys,base64;print(base64.b64encode(bytes(json.dumps(json.loads(open('"'${_SEARCH_RESULT}'"', '"'rb'"').read())['${_JSON_ROOT}']), '"'utf-8'"')).decode())' || echo "e30=")
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
_PLIST_ENTRY_KEYS+=("firebase_json_raw")
|
|
102
|
+
_PLIST_ENTRY_TYPES+=("string")
|
|
103
|
+
_PLIST_ENTRY_VALUES+=("$_JSON_OUTPUT_BASE64")
|
|
104
|
+
|
|
105
|
+
# config.app_data_collection_default_enabled
|
|
106
|
+
_APP_DATA_COLLECTION_ENABLED=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "app_data_collection_default_enabled")
|
|
107
|
+
if [[ $_APP_DATA_COLLECTION_ENABLED ]]; then
|
|
108
|
+
_PLIST_ENTRY_KEYS+=("FirebaseDataCollectionDefaultEnabled")
|
|
109
|
+
_PLIST_ENTRY_TYPES+=("bool")
|
|
110
|
+
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_APP_DATA_COLLECTION_ENABLED")")
|
|
111
|
+
fi
|
|
112
|
+
|
|
113
|
+
# config.analytics_auto_collection_enabled
|
|
114
|
+
_ANALYTICS_AUTO_COLLECTION=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "analytics_auto_collection_enabled")
|
|
115
|
+
if [[ $_ANALYTICS_AUTO_COLLECTION ]]; then
|
|
116
|
+
_PLIST_ENTRY_KEYS+=("FIREBASE_ANALYTICS_COLLECTION_ENABLED")
|
|
117
|
+
_PLIST_ENTRY_TYPES+=("bool")
|
|
118
|
+
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_ANALYTICS_AUTO_COLLECTION")")
|
|
119
|
+
fi
|
|
120
|
+
|
|
121
|
+
# config.analytics_collection_deactivated
|
|
122
|
+
_ANALYTICS_DEACTIVATED=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "analytics_collection_deactivated")
|
|
123
|
+
if [[ $_ANALYTICS_DEACTIVATED ]]; then
|
|
124
|
+
_PLIST_ENTRY_KEYS+=("FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED")
|
|
125
|
+
_PLIST_ENTRY_TYPES+=("bool")
|
|
126
|
+
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_ANALYTICS_DEACTIVATED")")
|
|
127
|
+
fi
|
|
128
|
+
|
|
129
|
+
# config.analytics_idfv_collection_enabled
|
|
130
|
+
_ANALYTICS_IDFV_COLLECTION=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "analytics_idfv_collection_enabled")
|
|
131
|
+
if [[ $_ANALYTICS_IDFV_COLLECTION ]]; then
|
|
132
|
+
_PLIST_ENTRY_KEYS+=("GOOGLE_ANALYTICS_IDFV_COLLECTION_ENABLED")
|
|
133
|
+
_PLIST_ENTRY_TYPES+=("bool")
|
|
134
|
+
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_ANALYTICS_IDFV_COLLECTION")")
|
|
135
|
+
fi
|
|
136
|
+
|
|
137
|
+
# config.analytics_default_allow_analytics_storage
|
|
138
|
+
_ANALYTICS_STORAGE=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "analytics_default_allow_analytics_storage")
|
|
139
|
+
if [[ $_ANALYTICS_STORAGE ]]; then
|
|
140
|
+
_PLIST_ENTRY_KEYS+=("GOOGLE_ANALYTICS_DEFAULT_ALLOW_ANALYTICS_STORAGE")
|
|
141
|
+
_PLIST_ENTRY_TYPES+=("bool")
|
|
142
|
+
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_ANALYTICS_STORAGE")")
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
# config.analytics_default_allow_ad_storage
|
|
146
|
+
_ANALYTICS_AD_STORAGE=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "analytics_default_allow_ad_storage")
|
|
147
|
+
if [[ $_ANALYTICS_AD_STORAGE ]]; then
|
|
148
|
+
_PLIST_ENTRY_KEYS+=("GOOGLE_ANALYTICS_DEFAULT_ALLOW_AD_STORAGE")
|
|
149
|
+
_PLIST_ENTRY_TYPES+=("bool")
|
|
150
|
+
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_ANALYTICS_AD_STORAGE")")
|
|
151
|
+
fi
|
|
152
|
+
|
|
153
|
+
# config.analytics_default_allow_ad_user_data
|
|
154
|
+
_ANALYTICS_AD_USER_DATA=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "analytics_default_allow_ad_user_data")
|
|
155
|
+
if [[ $_ANALYTICS_AD_USER_DATA ]]; then
|
|
156
|
+
_PLIST_ENTRY_KEYS+=("GOOGLE_ANALYTICS_DEFAULT_ALLOW_AD_USER_DATA")
|
|
157
|
+
_PLIST_ENTRY_TYPES+=("bool")
|
|
158
|
+
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_ANALYTICS_AD_USER_DATA")")
|
|
159
|
+
fi
|
|
160
|
+
|
|
161
|
+
# config.analytics_default_allow_ad_personalization_signals
|
|
162
|
+
_ANALYTICS_PERSONALIZATION=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "analytics_default_allow_ad_personalization_signals")
|
|
163
|
+
if [[ $_ANALYTICS_PERSONALIZATION ]]; then
|
|
164
|
+
_PLIST_ENTRY_KEYS+=("GOOGLE_ANALYTICS_DEFAULT_ALLOW_AD_PERSONALIZATION_SIGNALS")
|
|
165
|
+
_PLIST_ENTRY_TYPES+=("bool")
|
|
166
|
+
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_ANALYTICS_PERSONALIZATION")")
|
|
167
|
+
fi
|
|
168
|
+
|
|
169
|
+
# config.analytics_registration_with_ad_network_enabled
|
|
170
|
+
_ANALYTICS_REGISTRATION_WITH_AD_NETWORK=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "google_analytics_registration_with_ad_network_enabled")
|
|
171
|
+
if [[ $_ANALYTICS_REGISTRATION_WITH_AD_NETWORK ]]; then
|
|
172
|
+
_PLIST_ENTRY_KEYS+=("GOOGLE_ANALYTICS_REGISTRATION_WITH_AD_NETWORK_ENABLED")
|
|
173
|
+
_PLIST_ENTRY_TYPES+=("bool")
|
|
174
|
+
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_ANALYTICS_REGISTRATION_WITH_AD_NETWORK")")
|
|
175
|
+
fi
|
|
176
|
+
|
|
177
|
+
# config.google_analytics_automatic_screen_reporting_enabled
|
|
178
|
+
_ANALYTICS_AUTO_SCREEN_REPORTING=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "google_analytics_automatic_screen_reporting_enabled")
|
|
179
|
+
if [[ $_ANALYTICS_AUTO_SCREEN_REPORTING ]]; then
|
|
180
|
+
_PLIST_ENTRY_KEYS+=("FirebaseAutomaticScreenReportingEnabled")
|
|
181
|
+
_PLIST_ENTRY_TYPES+=("bool")
|
|
182
|
+
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_ANALYTICS_AUTO_SCREEN_REPORTING")")
|
|
183
|
+
fi
|
|
184
|
+
|
|
185
|
+
# config.perf_auto_collection_enabled
|
|
186
|
+
_PERF_AUTO_COLLECTION=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "perf_auto_collection_enabled")
|
|
187
|
+
if [[ $_PERF_AUTO_COLLECTION ]]; then
|
|
188
|
+
_PLIST_ENTRY_KEYS+=("firebase_performance_collection_enabled")
|
|
189
|
+
_PLIST_ENTRY_TYPES+=("bool")
|
|
190
|
+
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_PERF_AUTO_COLLECTION")")
|
|
191
|
+
fi
|
|
192
|
+
|
|
193
|
+
# config.perf_collection_deactivated
|
|
194
|
+
_PERF_DEACTIVATED=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "perf_collection_deactivated")
|
|
195
|
+
if [[ $_PERF_DEACTIVATED ]]; then
|
|
196
|
+
_PLIST_ENTRY_KEYS+=("firebase_performance_collection_deactivated")
|
|
197
|
+
_PLIST_ENTRY_TYPES+=("bool")
|
|
198
|
+
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_PERF_DEACTIVATED")")
|
|
199
|
+
fi
|
|
200
|
+
|
|
201
|
+
# config.messaging_auto_init_enabled
|
|
202
|
+
_MESSAGING_AUTO_INIT=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "messaging_auto_init_enabled")
|
|
203
|
+
if [[ $_MESSAGING_AUTO_INIT ]]; then
|
|
204
|
+
_PLIST_ENTRY_KEYS+=("FirebaseMessagingAutoInitEnabled")
|
|
205
|
+
_PLIST_ENTRY_TYPES+=("bool")
|
|
206
|
+
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_MESSAGING_AUTO_INIT")")
|
|
207
|
+
fi
|
|
208
|
+
|
|
209
|
+
# config.in_app_messaging_auto_colllection_enabled
|
|
210
|
+
_FIAM_AUTO_INIT=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "in_app_messaging_auto_collection_enabled")
|
|
211
|
+
if [[ $_FIAM_AUTO_INIT ]]; then
|
|
212
|
+
_PLIST_ENTRY_KEYS+=("FirebaseInAppMessagingAutomaticDataCollectionEnabled")
|
|
213
|
+
_PLIST_ENTRY_TYPES+=("bool")
|
|
214
|
+
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_FIAM_AUTO_INIT")")
|
|
215
|
+
fi
|
|
216
|
+
|
|
217
|
+
# config.app_check_token_auto_refresh
|
|
218
|
+
_APP_CHECK_TOKEN_AUTO_REFRESH=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "app_check_token_auto_refresh")
|
|
219
|
+
if [[ $_APP_CHECK_TOKEN_AUTO_REFRESH ]]; then
|
|
220
|
+
_PLIST_ENTRY_KEYS+=("FirebaseAppCheckTokenAutoRefreshEnabled")
|
|
221
|
+
_PLIST_ENTRY_TYPES+=("bool")
|
|
222
|
+
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_APP_CHECK_TOKEN_AUTO_REFRESH")")
|
|
223
|
+
fi
|
|
224
|
+
|
|
225
|
+
# config.crashlytics_disable_auto_disabler - undocumented for now - mainly for debugging, document if becomes useful
|
|
226
|
+
_CRASHLYTICS_AUTO_DISABLE_ENABLED=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "crashlytics_disable_auto_disabler")
|
|
227
|
+
if [[ $_CRASHLYTICS_AUTO_DISABLE_ENABLED == "true" ]]; then
|
|
228
|
+
echo "Disabled Crashlytics auto disabler." # do nothing
|
|
229
|
+
else
|
|
230
|
+
_PLIST_ENTRY_KEYS+=("FirebaseCrashlyticsCollectionEnabled")
|
|
231
|
+
_PLIST_ENTRY_TYPES+=("bool")
|
|
232
|
+
_PLIST_ENTRY_VALUES+=("NO")
|
|
233
|
+
fi
|
|
234
|
+
else
|
|
235
|
+
_PLIST_ENTRY_KEYS+=("firebase_json_raw")
|
|
236
|
+
_PLIST_ENTRY_TYPES+=("string")
|
|
237
|
+
_PLIST_ENTRY_VALUES+=("$_JSON_OUTPUT_BASE64")
|
|
238
|
+
echo "warning: A firebase.json file was not found, whilst this file is optional it is recommended to include it to configure firebase services in React Native Firebase."
|
|
239
|
+
fi;
|
|
240
|
+
|
|
241
|
+
echo "note: 2) Injecting Info.plist entries: "
|
|
242
|
+
|
|
243
|
+
# Log out the keys we're adding
|
|
244
|
+
for i in "${!_PLIST_ENTRY_KEYS[@]}"; do
|
|
245
|
+
echo " -> $i) ${_PLIST_ENTRY_KEYS[$i]}" "${_PLIST_ENTRY_TYPES[$i]}" "${_PLIST_ENTRY_VALUES[$i]}"
|
|
246
|
+
done
|
|
247
|
+
|
|
248
|
+
for plist in "${_TARGET_PLIST}" "${_DSYM_PLIST}" ; do
|
|
249
|
+
if [[ -f "${plist}" ]]; then
|
|
250
|
+
|
|
251
|
+
# paths with spaces break the call to setPlistValue. temporarily modify
|
|
252
|
+
# the shell internal field separator variable (IFS), which normally
|
|
253
|
+
# includes spaces, to consist only of line breaks
|
|
254
|
+
oldifs=$IFS
|
|
255
|
+
IFS="
|
|
256
|
+
"
|
|
257
|
+
|
|
258
|
+
for i in "${!_PLIST_ENTRY_KEYS[@]}"; do
|
|
259
|
+
setPlistValue "${_PLIST_ENTRY_KEYS[$i]}" "${_PLIST_ENTRY_TYPES[$i]}" "${_PLIST_ENTRY_VALUES[$i]}" "${plist}"
|
|
260
|
+
done
|
|
261
|
+
|
|
262
|
+
# restore the original internal field separator value
|
|
263
|
+
IFS=$oldifs
|
|
264
|
+
else
|
|
265
|
+
echo "warning: A Info.plist build output file was not found (${plist})"
|
|
266
|
+
fi
|
|
267
|
+
done
|
|
268
|
+
|
|
269
|
+
echo "note: <- RNFB build script finished"
|
package/lib/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '23.8.
|
|
2
|
+
export const version = '23.8.2';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-firebase/app",
|
|
3
|
-
"version": "23.8.
|
|
3
|
+
"version": "23.8.2",
|
|
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": "./dist/commonjs/index.js",
|
|
@@ -111,13 +111,6 @@
|
|
|
111
111
|
},
|
|
112
112
|
"./package.json": "./package.json"
|
|
113
113
|
},
|
|
114
|
-
"files": [
|
|
115
|
-
"lib",
|
|
116
|
-
"dist",
|
|
117
|
-
"!**/__tests__",
|
|
118
|
-
"!**/__fixtures__",
|
|
119
|
-
"!**/__mocks__"
|
|
120
|
-
],
|
|
121
114
|
"peerDependencies": {
|
|
122
115
|
"expo": ">=47.0.0",
|
|
123
116
|
"react": "*",
|
|
@@ -129,7 +122,7 @@
|
|
|
129
122
|
"devDependencies": {
|
|
130
123
|
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
131
124
|
"expo": "^54.0.27",
|
|
132
|
-
"react-native-builder-bob": "^0.40.
|
|
125
|
+
"react-native-builder-bob": "^0.40.17"
|
|
133
126
|
},
|
|
134
127
|
"peerDependenciesMeta": {
|
|
135
128
|
"expo": {
|
|
@@ -142,7 +135,7 @@
|
|
|
142
135
|
},
|
|
143
136
|
"sdkVersions": {
|
|
144
137
|
"ios": {
|
|
145
|
-
"firebase": "12.
|
|
138
|
+
"firebase": "12.8.0",
|
|
146
139
|
"iosTarget": "15.0",
|
|
147
140
|
"macosTarget": "10.15",
|
|
148
141
|
"tvosTarget": "15.0"
|
|
@@ -188,5 +181,5 @@
|
|
|
188
181
|
"node_modules/",
|
|
189
182
|
"dist/"
|
|
190
183
|
],
|
|
191
|
-
"gitHead": "
|
|
184
|
+
"gitHead": "578c1573d9bcb9a83848f34a08be40c7b5722d9b"
|
|
192
185
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withApplyGoogleServicesPlugin = void 0;
|
|
4
|
+
exports.applyPlugin = applyPlugin;
|
|
5
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
/**
|
|
8
|
+
* Update `app/build.gradle` by applying google-services plugin
|
|
9
|
+
*/
|
|
10
|
+
const withApplyGoogleServicesPlugin = config => {
|
|
11
|
+
return (0, config_plugins_1.withAppBuildGradle)(config, config => {
|
|
12
|
+
if (config.modResults.language === 'groovy') {
|
|
13
|
+
config.modResults.contents = applyPlugin(config.modResults.contents);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
config_plugins_1.WarningAggregator.addWarningAndroid('react-native-firebase-app', `Cannot automatically configure app build.gradle if it's not groovy`);
|
|
17
|
+
}
|
|
18
|
+
return config;
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
exports.withApplyGoogleServicesPlugin = withApplyGoogleServicesPlugin;
|
|
22
|
+
function applyPlugin(appBuildGradle) {
|
|
23
|
+
// Make sure the project does not have the plugin already
|
|
24
|
+
const pattern = new RegExp(`apply\\s+plugin:\\s+['"]${constants_1.googleServicesPlugin}['"]`);
|
|
25
|
+
if (!appBuildGradle.match(pattern)) {
|
|
26
|
+
return appBuildGradle + `\napply plugin: '${constants_1.googleServicesPlugin}'`;
|
|
27
|
+
}
|
|
28
|
+
return appBuildGradle;
|
|
29
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
/**
|
|
3
|
+
* Update `<project>/build.gradle` by adding google-services dependency to buildscript
|
|
4
|
+
*/
|
|
5
|
+
export declare const withBuildscriptDependency: ConfigPlugin;
|
|
6
|
+
export declare function setBuildscriptDependency(buildGradle: string): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withBuildscriptDependency = void 0;
|
|
4
|
+
exports.setBuildscriptDependency = setBuildscriptDependency;
|
|
5
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
/**
|
|
8
|
+
* Update `<project>/build.gradle` by adding google-services dependency to buildscript
|
|
9
|
+
*/
|
|
10
|
+
const withBuildscriptDependency = config => {
|
|
11
|
+
return (0, config_plugins_1.withProjectBuildGradle)(config, config => {
|
|
12
|
+
if (config.modResults.language === 'groovy') {
|
|
13
|
+
config.modResults.contents = setBuildscriptDependency(config.modResults.contents);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
config_plugins_1.WarningAggregator.addWarningAndroid('react-native-firebase-app', `Cannot automatically configure project build.gradle if it's not groovy`);
|
|
17
|
+
}
|
|
18
|
+
return config;
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
exports.withBuildscriptDependency = withBuildscriptDependency;
|
|
22
|
+
function setBuildscriptDependency(buildGradle) {
|
|
23
|
+
if (!buildGradle.includes(constants_1.googleServicesClassPath)) {
|
|
24
|
+
// TODO: Find a more stable solution for this
|
|
25
|
+
return buildGradle.replace(/dependencies\s?{/, `dependencies {
|
|
26
|
+
classpath '${constants_1.googleServicesClassPath}:${constants_1.googleServicesVersion}'`);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return buildGradle;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const DEFAULT_TARGET_PATH = "app/google-services.json";
|
|
2
|
+
export declare const googleServicesClassPath = "com.google.gms:google-services";
|
|
3
|
+
export declare const googleServicesPlugin = "com.google.gms.google-services";
|
|
4
|
+
export declare const googleServicesVersion: any;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.googleServicesVersion = exports.googleServicesPlugin = exports.googleServicesClassPath = exports.DEFAULT_TARGET_PATH = void 0;
|
|
4
|
+
const appPackageJson = require('@react-native-firebase/app/package.json');
|
|
5
|
+
exports.DEFAULT_TARGET_PATH = 'app/google-services.json';
|
|
6
|
+
exports.googleServicesClassPath = 'com.google.gms:google-services';
|
|
7
|
+
exports.googleServicesPlugin = 'com.google.gms.google-services';
|
|
8
|
+
exports.googleServicesVersion = appPackageJson.sdkVersions.android.gmsGoogleServicesGradle;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.withCopyAndroidGoogleServices = void 0;
|
|
7
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const fs_1 = __importDefault(require("fs"));
|
|
11
|
+
/**
|
|
12
|
+
* Copy `google-services.json`
|
|
13
|
+
*/
|
|
14
|
+
const withCopyAndroidGoogleServices = config => {
|
|
15
|
+
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
16
|
+
'android',
|
|
17
|
+
async (config) => {
|
|
18
|
+
if (!config.android?.googleServicesFile) {
|
|
19
|
+
throw new Error('Path to google-services.json is not defined. Please specify the `expo.android.googleServicesFile` field in app.json.');
|
|
20
|
+
}
|
|
21
|
+
const srcPath = path_1.default.resolve(config.modRequest.projectRoot, config.android.googleServicesFile);
|
|
22
|
+
const destPath = path_1.default.resolve(config.modRequest.platformProjectRoot, constants_1.DEFAULT_TARGET_PATH);
|
|
23
|
+
try {
|
|
24
|
+
await fs_1.default.promises.copyFile(srcPath, destPath);
|
|
25
|
+
}
|
|
26
|
+
catch (_) {
|
|
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
|
+
}
|
|
29
|
+
return config;
|
|
30
|
+
},
|
|
31
|
+
]);
|
|
32
|
+
};
|
|
33
|
+
exports.withCopyAndroidGoogleServices = withCopyAndroidGoogleServices;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { withApplyGoogleServicesPlugin } from './applyPlugin';
|
|
2
|
+
import { withBuildscriptDependency } from './buildscriptDependency';
|
|
3
|
+
import { withCopyAndroidGoogleServices } from './copyGoogleServices';
|
|
4
|
+
export { withBuildscriptDependency, withApplyGoogleServicesPlugin, withCopyAndroidGoogleServices };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withCopyAndroidGoogleServices = exports.withApplyGoogleServicesPlugin = exports.withBuildscriptDependency = void 0;
|
|
4
|
+
const applyPlugin_1 = require("./applyPlugin");
|
|
5
|
+
Object.defineProperty(exports, "withApplyGoogleServicesPlugin", { enumerable: true, get: function () { return applyPlugin_1.withApplyGoogleServicesPlugin; } });
|
|
6
|
+
const buildscriptDependency_1 = require("./buildscriptDependency");
|
|
7
|
+
Object.defineProperty(exports, "withBuildscriptDependency", { enumerable: true, get: function () { return buildscriptDependency_1.withBuildscriptDependency; } });
|
|
8
|
+
const copyGoogleServices_1 = require("./copyGoogleServices");
|
|
9
|
+
Object.defineProperty(exports, "withCopyAndroidGoogleServices", { enumerable: true, get: function () { return copyGoogleServices_1.withCopyAndroidGoogleServices; } });
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
4
|
+
const android_1 = require("./android");
|
|
5
|
+
const ios_1 = require("./ios");
|
|
6
|
+
/**
|
|
7
|
+
* A config plugin for configuring `@react-native-firebase/app`
|
|
8
|
+
*/
|
|
9
|
+
const withRnFirebaseApp = config => {
|
|
10
|
+
return (0, config_plugins_1.withPlugins)(config, [
|
|
11
|
+
// iOS
|
|
12
|
+
ios_1.withFirebaseAppDelegate,
|
|
13
|
+
ios_1.withIosGoogleServicesFile,
|
|
14
|
+
// Android
|
|
15
|
+
android_1.withBuildscriptDependency,
|
|
16
|
+
android_1.withApplyGoogleServicesPlugin,
|
|
17
|
+
android_1.withCopyAndroidGoogleServices,
|
|
18
|
+
]);
|
|
19
|
+
};
|
|
20
|
+
const pak = require('@react-native-firebase/app/package.json');
|
|
21
|
+
exports.default = (0, config_plugins_1.createRunOncePlugin)(withRnFirebaseApp, pak.name, pak.version);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
import { AppDelegateProjectFile } from '@expo/config-plugins/build/ios/Paths';
|
|
3
|
+
export declare function modifyObjcAppDelegate(contents: string): string;
|
|
4
|
+
export declare function modifySwiftAppDelegate(contents: string): string;
|
|
5
|
+
export declare function modifyAppDelegateAsync(appDelegateFileInfo: AppDelegateProjectFile): Promise<void>;
|
|
6
|
+
export declare const withFirebaseAppDelegate: ConfigPlugin;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.withFirebaseAppDelegate = void 0;
|
|
7
|
+
exports.modifyObjcAppDelegate = modifyObjcAppDelegate;
|
|
8
|
+
exports.modifySwiftAppDelegate = modifySwiftAppDelegate;
|
|
9
|
+
exports.modifyAppDelegateAsync = modifyAppDelegateAsync;
|
|
10
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
11
|
+
const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
|
|
12
|
+
const fs_1 = __importDefault(require("fs"));
|
|
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;
|
|
20
|
+
// Add import
|
|
21
|
+
if (!contents.includes('#import <Firebase/Firebase.h>')) {
|
|
22
|
+
contents = contents.replace(/#import "AppDelegate.h"/g, `#import "AppDelegate.h"
|
|
23
|
+
#import <Firebase/Firebase.h>`);
|
|
24
|
+
}
|
|
25
|
+
// To avoid potential issues with existing changes from older plugin versions
|
|
26
|
+
if (contents.includes(methodInvocationBlock)) {
|
|
27
|
+
return contents;
|
|
28
|
+
}
|
|
29
|
+
if (!methodInvocationLineMatcher.test(contents) &&
|
|
30
|
+
!fallbackInvocationLineMatcher.test(contents)) {
|
|
31
|
+
config_plugins_1.WarningAggregator.addWarningIOS('@react-native-firebase/app', 'Unable to determine correct Firebase insertion point in AppDelegate.m. Skipping Firebase addition.');
|
|
32
|
+
return contents;
|
|
33
|
+
}
|
|
34
|
+
// Add invocation
|
|
35
|
+
try {
|
|
36
|
+
return (0, generateCode_1.mergeContents)({
|
|
37
|
+
tag: '@react-native-firebase/app-didFinishLaunchingWithOptions',
|
|
38
|
+
src: contents,
|
|
39
|
+
newSrc: methodInvocationBlock,
|
|
40
|
+
anchor: methodInvocationLineMatcher,
|
|
41
|
+
offset: 0, // new line will be inserted right above matched anchor
|
|
42
|
+
comment: '//',
|
|
43
|
+
}).contents;
|
|
44
|
+
}
|
|
45
|
+
catch (_) {
|
|
46
|
+
// tests if the opening `{` is in the new line
|
|
47
|
+
const multilineMatcher = new RegExp(fallbackInvocationLineMatcher.source + '.+\\n*{');
|
|
48
|
+
const isHeaderMultiline = multilineMatcher.test(contents);
|
|
49
|
+
// we fallback to another regex if the first one fails
|
|
50
|
+
return (0, generateCode_1.mergeContents)({
|
|
51
|
+
tag: '@react-native-firebase/app-didFinishLaunchingWithOptions-fallback',
|
|
52
|
+
src: contents,
|
|
53
|
+
newSrc: methodInvocationBlock,
|
|
54
|
+
anchor: fallbackInvocationLineMatcher,
|
|
55
|
+
// new line will be inserted right below matched anchor
|
|
56
|
+
// or two lines, if the `{` is in the new line
|
|
57
|
+
offset: isHeaderMultiline ? 2 : 1,
|
|
58
|
+
comment: '//',
|
|
59
|
+
}).contents;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function modifySwiftAppDelegate(contents) {
|
|
63
|
+
const methodInvocationBlock = `FirebaseApp.configure()`;
|
|
64
|
+
const methodInvocationLineMatcher = /(?:self\.moduleName\s*=\s*"([^"]*)")|(?:factory\.startReactNative\()/;
|
|
65
|
+
// Add import
|
|
66
|
+
if (!contents.includes('import FirebaseCore')) {
|
|
67
|
+
contents = contents.replace(/import Expo/g, `import Expo
|
|
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
|
+
}
|
|
88
|
+
async function modifyAppDelegateAsync(appDelegateFileInfo) {
|
|
89
|
+
const { language, path, contents } = appDelegateFileInfo;
|
|
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}"`);
|
|
103
|
+
}
|
|
104
|
+
await fs_1.default.promises.writeFile(path, newContents);
|
|
105
|
+
}
|
|
106
|
+
const withFirebaseAppDelegate = config => {
|
|
107
|
+
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
108
|
+
'ios',
|
|
109
|
+
async (config) => {
|
|
110
|
+
const fileInfo = config_plugins_1.IOSConfig.Paths.getAppDelegate(config.modRequest.projectRoot);
|
|
111
|
+
await modifyAppDelegateAsync(fileInfo);
|
|
112
|
+
return config;
|
|
113
|
+
},
|
|
114
|
+
]);
|
|
115
|
+
};
|
|
116
|
+
exports.withFirebaseAppDelegate = withFirebaseAppDelegate;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ConfigPlugin, XcodeProject } from '@expo/config-plugins';
|
|
2
|
+
export declare const withIosGoogleServicesFile: ConfigPlugin;
|
|
3
|
+
export declare function setGoogleServicesFile({ projectRoot, project, googleServicesFileRelativePath, }: {
|
|
4
|
+
project: XcodeProject;
|
|
5
|
+
projectRoot: string;
|
|
6
|
+
googleServicesFileRelativePath: string;
|
|
7
|
+
}): XcodeProject;
|