@react-native-firebase/app 26.4.0 → 27.0.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 +48 -0
- package/README.md +10 -27
- package/RNFBApp.podspec +13 -5
- package/android/build.gradle +3 -0
- package/android/src/main/java/io/invertase/firebase/common/RNFBHandleCollisionException.kt +29 -0
- package/android/src/main/java/io/invertase/firebase/common/RNFBHandleMap.kt +146 -0
- package/android/src/main/java/io/invertase/firebase/common/TaskExecutorService.kt +156 -0
- package/android/src/main/java/io/invertase/firebase/common/UniversalFirebaseModule.kt +44 -0
- package/android/src/main/java/io/invertase/firebase/common/UniversalFirebasePreferences.kt +100 -0
- package/android/src/reactnative/java/io/invertase/firebase/app/NativeRNFBTurboApp.kt +250 -0
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseApp.kt +64 -0
- package/android/src/reactnative/java/io/invertase/firebase/app/{ReactNativeFirebaseAppInitProvider.java → ReactNativeFirebaseAppInitProvider.kt} +3 -4
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppPackage.kt +47 -0
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppRegistrar.kt +33 -0
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseVersion.java +1 -1
- package/android/src/reactnative/java/io/invertase/firebase/common/RCTConvertFirebase.kt +185 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseEvent.kt +35 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseEventEmitter.kt +662 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseJSON.kt +103 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseMeta.kt +96 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseModule.kt +140 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebasePreferences.kt +109 -0
- package/android/src/reactnative/java/io/invertase/firebase/common/SharedUtils.kt +451 -0
- package/android/src/reactnative/java/io/invertase/firebase/interfaces/{ContextProvider.java → ContextProvider.kt} +8 -8
- package/android/src/reactnative/java/io/invertase/firebase/interfaces/{NativeError.java → NativeError.kt} +8 -8
- package/android/src/reactnative/java/io/invertase/firebase/interfaces/{NativeEvent.java → NativeEvent.kt} +6 -6
- package/android/src/reactnative/java/io/invertase/firebase/utils/NativeRNFBTurboUtils.kt +219 -0
- package/android/src/test/java/expo/core/ModuleRegistry.java +9 -0
- package/android/src/test/java/io/invertase/firebase/app/NativeRNFBTurboAppTest.java +182 -59
- package/android/src/test/java/io/invertase/firebase/app/ReactNativeFirebaseAppComponentsJavaCompatibilityTest.java +70 -0
- package/android/src/test/java/io/invertase/firebase/app/ReactNativeFirebaseAppJavaCompatibilityTest.java +60 -0
- package/android/src/test/java/io/invertase/firebase/app/ReactNativeFirebaseAppPackageTest.java +165 -0
- package/android/src/test/java/io/invertase/firebase/app/ReactNativeFirebaseAppTest.kt +167 -0
- package/android/src/test/java/io/invertase/firebase/common/RCTConvertFirebaseJavaCompatibilityTest.java +112 -0
- package/android/src/test/java/io/invertase/firebase/common/RCTConvertFirebaseTest.kt +317 -0
- package/android/src/test/java/io/invertase/firebase/common/RNFBHandleMapTest.kt +309 -0
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseEventEmitterJavaCompatibilityTest.java +176 -0
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseEventEmitterTest.java +143 -12
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseEventTest.kt +61 -0
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseJSONJavaCompatibilityTest.java +85 -0
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseJSONTest.kt +296 -0
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseMetaJavaCompatibilityTest.java +67 -0
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseMetaTest.kt +246 -0
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseModuleTest.kt +254 -0
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebasePreferencesJavaCompatibilityTest.java +87 -0
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebasePreferencesTest.kt +260 -0
- package/android/src/test/java/io/invertase/firebase/common/SharedUtilsJavaCompatibilityTest.java +255 -0
- package/android/src/test/java/io/invertase/firebase/common/SharedUtilsTest.kt +674 -0
- package/android/src/test/java/io/invertase/firebase/common/TaskExecutorServiceTest.kt +290 -0
- package/android/src/test/java/io/invertase/firebase/common/UniversalFirebaseModuleJavaCompatibilityTest.java +178 -0
- package/android/src/test/java/io/invertase/firebase/common/UniversalFirebasePreferencesJavaCompatibilityTest.java +99 -0
- package/android/src/test/java/io/invertase/firebase/common/UniversalFirebasePreferencesTest.kt +217 -0
- package/android/src/test/java/io/invertase/firebase/commoncompat/ReactNativeFirebaseModuleJavaCompatibilityTest.java +176 -0
- package/android/src/test/java/io/invertase/firebase/commoncompat/ReactNativeFirebaseModuleKotlinCompatibilityTest.kt +52 -0
- package/android/src/test/java/io/invertase/firebase/interfaces/InterfacesJavaCompatibilityTest.java +144 -0
- package/android/src/test/java/io/invertase/firebase/interfaces/NativeEventTest.kt +56 -0
- package/android/src/test/java/io/invertase/firebase/utils/NativeRNFBTurboUtilsTest.java +517 -21
- package/dist/module/FirebaseApp.js +10 -0
- package/dist/module/FirebaseApp.js.map +1 -1
- package/dist/module/common/deeps.js +3 -0
- package/dist/module/common/deeps.js.map +1 -1
- package/dist/module/internal/FirebaseModule.js.map +1 -1
- package/dist/module/internal/RNFBNativeEventEmitter.js +12 -1
- package/dist/module/internal/RNFBNativeEventEmitter.js.map +1 -1
- package/dist/module/internal/SharedEventEmitter.js +3 -1
- package/dist/module/internal/SharedEventEmitter.js.map +1 -1
- package/dist/module/internal/index.js +1 -0
- package/dist/module/internal/index.js.map +1 -1
- package/dist/module/internal/registry/app.js +7 -1
- package/dist/module/internal/registry/app.js.map +1 -1
- package/dist/module/types/app.js.map +1 -1
- package/dist/module/types/internal.js +2 -0
- package/dist/module/version.js +1 -1
- package/dist/typescript/lib/FirebaseApp.d.ts +7 -0
- package/dist/typescript/lib/FirebaseApp.d.ts.map +1 -1
- package/dist/typescript/lib/common/deeps.d.ts.map +1 -1
- package/dist/typescript/lib/internal/FirebaseModule.d.ts +2 -3
- package/dist/typescript/lib/internal/FirebaseModule.d.ts.map +1 -1
- package/dist/typescript/lib/internal/NativeModules.d.ts +4 -1
- package/dist/typescript/lib/internal/NativeModules.d.ts.map +1 -1
- package/dist/typescript/lib/internal/RNFBNativeEventEmitter.d.ts +2 -2
- package/dist/typescript/lib/internal/RNFBNativeEventEmitter.d.ts.map +1 -1
- package/dist/typescript/lib/internal/SharedEventEmitter.d.ts +3 -3
- package/dist/typescript/lib/internal/SharedEventEmitter.d.ts.map +1 -1
- package/dist/typescript/lib/internal/index.d.ts +1 -0
- package/dist/typescript/lib/internal/index.d.ts.map +1 -1
- package/dist/typescript/lib/internal/registry/app.d.ts.map +1 -1
- package/dist/typescript/lib/types/app.d.ts +10 -3
- package/dist/typescript/lib/types/app.d.ts.map +1 -1
- package/dist/typescript/lib/types/internal.d.ts +12 -0
- package/dist/typescript/lib/types/internal.d.ts.map +1 -1
- package/dist/typescript/lib/version.d.ts +1 -1
- package/firebase-schema.json +4 -0
- package/firebase_spm.rb +552 -96
- package/ios/RNFBApp/RCTConvert+FIRApp.h +2 -5
- package/ios/RNFBApp/RCTConvert+FIRApp.m +11 -6
- package/ios/RNFBApp/RCTConvert+FIROptions.h +2 -5
- package/ios/RNFBApp/RCTConvert+FIROptions.m +11 -10
- package/ios/RNFBApp/RCTConvertFIRApp.swift +86 -0
- package/ios/RNFBApp/RCTConvertFIROptions.swift +259 -0
- package/ios/RNFBApp/RNFBAppCustomAuthDomains.swift +63 -0
- package/ios/RNFBApp/RNFBAppInitializeOptionsMapper.swift +113 -0
- package/ios/RNFBApp/RNFBAppLogLevelMapper.swift +53 -0
- package/ios/RNFBApp/RNFBAppModule+CustomAuthDomain.m +35 -0
- package/ios/RNFBApp/RNFBAppModule.h +6 -2
- package/ios/RNFBApp/RNFBAppModule.mm +65 -228
- package/ios/RNFBApp/RNFBAppModuleFirebase.swift +439 -0
- package/ios/RNFBApp/RNFBAppModuleImplementation.h +68 -0
- package/ios/RNFBApp/RNFBAppModuleImplementation.m +195 -0
- package/ios/RNFBApp/RNFBHandleMap.m +27 -56
- package/ios/RNFBApp/RNFBHandleMapStorage.swift +90 -0
- package/ios/RNFBApp/RNFBInitializeAppArguments.swift +82 -0
- package/ios/RNFBApp/RNFBJSON.m +22 -38
- package/ios/RNFBApp/RNFBJSONImplementation.swift +71 -0
- package/ios/RNFBApp/RNFBMeta.m +24 -26
- package/ios/RNFBApp/RNFBMetaStorage.swift +76 -0
- package/ios/RNFBApp/RNFBNullSentinelDecoding.swift +135 -0
- package/ios/RNFBApp/RNFBNullSentinelInterceptor.h +30 -3
- package/ios/RNFBApp/RNFBNullSentinelInterceptor.m +28 -5
- package/ios/RNFBApp/RNFBPreferences.m +22 -20
- package/ios/RNFBApp/RNFBPreferencesStorage.swift +101 -0
- package/ios/RNFBApp/RNFBRCTEventEmitter.m +36 -93
- package/ios/RNFBApp/RNFBRCTEventEmitterCore.swift +161 -0
- package/ios/RNFBApp/RNFBSharedUtils.h +2 -5
- package/ios/RNFBApp/RNFBSharedUtils.m +109 -198
- package/ios/RNFBApp/RNFBSharedUtilsConfig.swift +72 -0
- package/ios/RNFBApp/RNFBSharedUtilsFIRApp.swift +271 -0
- package/ios/RNFBApp/RNFBSharedUtilsFormatting.swift +59 -0
- package/ios/RNFBApp/RNFBSharedUtilsPromiseRejection.swift +88 -0
- package/ios/RNFBApp/RNFBUtilsHelpers.swift +116 -0
- package/ios/RNFBApp/RNFBUtilsModule+Foundation.m +44 -0
- package/ios/RNFBApp/RNFBUtilsModule+PhotoAssets.m +47 -0
- package/ios/RNFBApp/RNFBUtilsModule.h +11 -1
- package/ios/RNFBApp/RNFBUtilsModule.mm +10 -85
- package/ios/RNFBApp/RNFBUtilsModuleImplementation.h +32 -0
- package/ios/RNFBApp/RNFBUtilsModuleImplementation.m +56 -0
- package/ios/RNFBApp/RNFBVersion.m +1 -1
- package/ios/RNFBApp.xcodeproj/project.pbxproj +100 -0
- package/ios/RNFBAppUnitTests/HostStubs/FirebaseCore/FIRApp.m +171 -0
- package/ios/RNFBAppUnitTests/HostStubs/FirebaseCore/FirebaseCore.h +78 -0
- package/ios/RNFBAppUnitTests/HostStubs/FirebaseInstallations/FIRInstallations.m +7 -0
- package/ios/RNFBAppUnitTests/HostStubs/FirebaseInstallations/FirebaseInstallations.h +8 -0
- package/ios/RNFBAppUnitTests/HostStubs/RNFBAppModuleHostStub.m +55 -0
- package/ios/RNFBAppUnitTests/HostStubs/RNFBAppTurboModules.h +89 -0
- package/ios/RNFBAppUnitTests/HostStubs/RNFBAppTurboModules.mm +30 -0
- package/ios/RNFBAppUnitTests/HostStubs/React/RCTBridge.h +19 -0
- package/ios/RNFBAppUnitTests/HostStubs/React/RCTBridge.m +32 -0
- package/ios/RNFBAppUnitTests/HostStubs/React/RCTBridgeModule.h +19 -0
- package/ios/RNFBAppUnitTests/HostStubs/React/RCTConvert.h +28 -0
- package/ios/RNFBAppUnitTests/HostStubs/React/RCTConvert.m +23 -0
- package/ios/RNFBAppUnitTests/HostStubs/React/RCTEventEmitter.h +9 -0
- package/ios/RNFBAppUnitTests/HostStubs/React/RCTInvalidating.h +24 -0
- package/ios/RNFBAppUnitTests/HostStubs/React/RCTUtils.h +9 -0
- package/ios/RNFBAppUnitTests/HostStubs/module.modulemap +13 -0
- package/ios/RNFBAppUnitTests/RCTConvertFIRAppFacadeTests.m +61 -0
- package/ios/RNFBAppUnitTests/RCTConvertFIRAppTests.swift +73 -0
- package/ios/RNFBAppUnitTests/RCTConvertFIROptionsFacadeTests.m +57 -0
- package/ios/RNFBAppUnitTests/RCTConvertFIROptionsTests.swift +243 -0
- package/ios/RNFBAppUnitTests/RNFBAppCustomAuthDomainsFacadeTests.m +73 -0
- package/ios/RNFBAppUnitTests/RNFBAppCustomAuthDomainsTests.swift +70 -0
- package/ios/RNFBAppUnitTests/RNFBAppInitializeOptionsMapperTests.swift +190 -0
- package/ios/RNFBAppUnitTests/RNFBAppLogLevelFacadeTests.m +76 -0
- package/ios/RNFBAppUnitTests/RNFBAppLogLevelMapperTests.swift +59 -0
- package/ios/RNFBAppUnitTests/RNFBAppModuleFirebaseFacadeTests.m +215 -0
- package/ios/RNFBAppUnitTests/RNFBAppModuleFirebaseTests.swift +430 -0
- package/ios/RNFBAppUnitTests/RNFBAppModuleLifecycleTests.m +206 -0
- package/ios/RNFBAppUnitTests/RNFBAppModuleShellTests.mm +367 -0
- package/ios/RNFBAppUnitTests/RNFBAppUnitTests.xcodeproj/project.pbxproj +355 -2
- package/ios/RNFBAppUnitTests/RNFBFirebaseAppClientTests.swift +165 -0
- package/ios/RNFBAppUnitTests/RNFBHandleMapStorageTests.swift +121 -0
- package/ios/RNFBAppUnitTests/RNFBInitializeAppArgumentsTests.swift +256 -0
- package/ios/RNFBAppUnitTests/RNFBJSONImplementationTests.swift +126 -0
- package/ios/RNFBAppUnitTests/RNFBJSONTests.m +172 -0
- package/ios/RNFBAppUnitTests/RNFBMetaStorageTests.swift +106 -0
- package/ios/RNFBAppUnitTests/RNFBMetaTests.m +65 -0
- package/ios/RNFBAppUnitTests/RNFBNullSentinelDecodingTests.swift +286 -0
- package/ios/RNFBAppUnitTests/RNFBNullSentinelInterceptorTests.m +312 -0
- package/ios/RNFBAppUnitTests/RNFBPreferencesStorageTests.swift +105 -0
- package/ios/RNFBAppUnitTests/RNFBPreferencesTests.m +110 -0
- package/ios/RNFBAppUnitTests/RNFBRCTEventEmitterCoreTests.swift +163 -0
- package/ios/RNFBAppUnitTests/RNFBRCTEventEmitterFacadeTests.m +141 -0
- package/ios/RNFBAppUnitTests/RNFBSharedUtilsConfigFacadeTests.m +100 -0
- package/ios/RNFBAppUnitTests/RNFBSharedUtilsConfigTests.swift +234 -0
- package/ios/RNFBAppUnitTests/RNFBSharedUtilsFIRAppFacadeTests.m +145 -0
- package/ios/RNFBAppUnitTests/RNFBSharedUtilsFIRAppTests.swift +173 -0
- package/ios/RNFBAppUnitTests/RNFBSharedUtilsFormattingFacadeTests.m +38 -0
- package/ios/RNFBAppUnitTests/RNFBSharedUtilsFormattingTests.swift +82 -0
- package/ios/RNFBAppUnitTests/RNFBSharedUtilsNullSentinelTests.m +35 -0
- package/ios/RNFBAppUnitTests/RNFBSharedUtilsPromiseRejectionFacadeTests.m +107 -0
- package/ios/RNFBAppUnitTests/RNFBSharedUtilsPromiseRejectionTests.swift +133 -0
- package/ios/RNFBAppUnitTests/RNFBUtilsHelpersTests.swift +144 -0
- package/ios/RNFBAppUnitTests/RNFBUtilsModuleFacadeTests.m +72 -0
- package/ios/RNFBAppUnitTests/RNFBUtilsModuleShellTests.mm +282 -0
- package/ios/RNFBFirebase/Package.swift +53 -0
- package/ios/RNFBFirebase/Sources/RNFBFirebase/RNFBFirebase.swift +285 -0
- package/ios/RNFBFirebase/Sources/RNFBFirebaseBridge/Public/.gitkeep +0 -0
- package/ios/RNFBFirebase/Sources/RNFBFirebaseBridge/RNFBFirebaseBridge.m +169 -0
- package/ios/RNFBFirebase/Sources/RNFBFirebaseBridge/include/RNFBFirebaseBridge.h +52 -0
- package/ios/RNFBFirebaseUnitTests/RNFBAppDynamicFacadeTests.swift +240 -0
- package/{android/src/main/java/io/invertase/firebase/common/RNFBHandleCollisionException.java → ios/RNFBFirebaseUnitTests/RNFBFirebaseClientImport.swift} +23 -14
- package/ios/RNFBFirebaseUnitTests/RNFBFirebaseUnitTests.xcodeproj/project.pbxproj +588 -0
- package/ios/RNFBFirebaseUnitTests/RNFBFirebaseUnitTests.xcodeproj/xcshareddata/xcschemes/RNFBFirebaseUnitTests.xcscheme +83 -0
- package/ios_config.sh +50 -22
- package/lib/FirebaseApp.ts +10 -0
- package/lib/common/deeps.ts +3 -0
- package/lib/internal/FirebaseModule.ts +6 -3
- package/lib/internal/NativeModules.ts +4 -1
- package/lib/internal/RNFBNativeEventEmitter.ts +14 -5
- package/lib/internal/SharedEventEmitter.ts +5 -1
- package/lib/internal/index.ts +1 -0
- package/lib/internal/react-native-vendor-emitter.d.ts +11 -0
- package/lib/internal/registry/app.ts +7 -1
- package/lib/types/app.ts +10 -3
- package/lib/types/internal.ts +19 -0
- package/lib/version.ts +1 -1
- package/package.json +8 -8
- package/plugin/build/ios/appDelegate.js +2 -2
- package/plugin/build/ios/podfile.js +16 -16
- package/plugin/build/pluginConfig.d.ts +4 -2
- package/plugin/src/ios/appDelegate.ts +2 -2
- package/plugin/src/ios/podfile.ts +20 -23
- package/plugin/src/pluginConfig.ts +4 -2
- package/android/src/main/java/io/invertase/firebase/common/RNFBHandleMap.java +0 -150
- package/android/src/main/java/io/invertase/firebase/common/TaskExecutorService.java +0 -148
- package/android/src/main/java/io/invertase/firebase/common/UniversalFirebaseModule.java +0 -62
- package/android/src/main/java/io/invertase/firebase/common/UniversalFirebasePreferences.java +0 -91
- package/android/src/reactnative/java/io/invertase/firebase/app/NativeRNFBTurboApp.java +0 -224
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseApp.java +0 -46
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppPackage.java +0 -49
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppRegistrar.java +0 -35
- package/android/src/reactnative/java/io/invertase/firebase/common/RCTConvertFirebase.java +0 -192
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseEvent.java +0 -53
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseEventEmitter.java +0 -606
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseJSON.java +0 -109
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseMeta.java +0 -101
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseModule.java +0 -146
- package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebasePreferences.java +0 -96
- package/android/src/reactnative/java/io/invertase/firebase/common/SharedUtils.java +0 -441
- package/android/src/reactnative/java/io/invertase/firebase/utils/NativeRNFBTurboUtils.java +0 -223
- package/android/src/test/java/io/invertase/firebase/common/RNFBHandleMapTest.java +0 -275
- package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseJSONTest.java +0 -108
- package/android/src/test/java/io/invertase/firebase/common/TaskExecutorServiceTest.java +0 -97
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import FirebaseCore
|
|
18
|
+
import Foundation
|
|
19
|
+
import RNFBFirebase
|
|
20
|
+
import XCTest
|
|
21
|
+
|
|
22
|
+
private final class DynamicDomainProvider: NSObject, RNFBCustomDomainProviding {
|
|
23
|
+
var domains: [String: String] = [:]
|
|
24
|
+
|
|
25
|
+
func getCustomDomain(_ appName: String) -> String? {
|
|
26
|
+
domains[appName]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
private final class DynamicEventSender: NSObject, RNFBJSEventSending {
|
|
31
|
+
var name: String?
|
|
32
|
+
var body: NSDictionary?
|
|
33
|
+
|
|
34
|
+
func sendEvent(name: String, body: Any?) {
|
|
35
|
+
self.name = name
|
|
36
|
+
self.body = body as? NSDictionary
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/// Compiles RNFBApp with `RNFB_DYNAMIC_FIREBASE_PROBE` so the opaque facade branch is executed.
|
|
41
|
+
final class RNFBAppDynamicFacadeTests: XCTestCase {
|
|
42
|
+
override func tearDown() {
|
|
43
|
+
FirebaseApp.resetRegistryForTesting()
|
|
44
|
+
FirebaseConfiguration.resetForTesting()
|
|
45
|
+
RNFBAppModuleFirebase.resetRegisterLibraryOnceForTesting()
|
|
46
|
+
RNFBAppCustomAuthDomains.resetCustomDomainsForTesting()
|
|
47
|
+
super.tearDown()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
func testGeneratedPublicInterfaceHidesFirebaseModules() throws {
|
|
51
|
+
let products = Bundle(for: RNFBAppDynamicFacadeTests.self).bundleURL.deletingLastPathComponent()
|
|
52
|
+
let moduleDir = products.appendingPathComponent(
|
|
53
|
+
"RNFBFirebase.framework/Modules/RNFBFirebase.swiftmodule"
|
|
54
|
+
)
|
|
55
|
+
let interfaces = try FileManager.default.contentsOfDirectory(at: moduleDir, includingPropertiesForKeys: nil)
|
|
56
|
+
.filter { $0.pathExtension == "swiftinterface" }
|
|
57
|
+
XCTAssertFalse(interfaces.isEmpty, "missing swiftinterface under \(moduleDir.path)")
|
|
58
|
+
let text = try interfaces.map { try String(contentsOf: $0, encoding: .utf8) }.joined(separator: "\n")
|
|
59
|
+
let forbidden = try NSRegularExpression(
|
|
60
|
+
pattern: #"\b(?:import Firebase\w*|FirebaseCore|FirebaseInstallations|FirebaseOptions|FirebaseApp|FirebaseConfiguration|FirebaseLoggerLevel|FIROptions|FIRApp)\b"#
|
|
61
|
+
)
|
|
62
|
+
let range = NSRange(text.startIndex..<text.endIndex, in: text)
|
|
63
|
+
let match = forbidden.firstMatch(in: text, range: range)
|
|
64
|
+
XCTAssertNil(match, "public interface names a Firebase SDK type")
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
func testFacadeOptionsRoundTripNilBundleAndDeallocation() {
|
|
68
|
+
weak var released: FirebaseOptions?
|
|
69
|
+
autoreleasepool {
|
|
70
|
+
let configured = RNFBFIROptionsFactoryAdapter.shared.create(googleAppID: nil, gcmSenderID: nil)
|
|
71
|
+
let adapter = configured as! RNFBFIROptionsConfiguringAdapter
|
|
72
|
+
released = adapter.options as? FirebaseOptions
|
|
73
|
+
XCTAssertNil(adapter.options.value(forKey: "googleAppID") as? String)
|
|
74
|
+
XCTAssertNil(adapter.options.value(forKey: "GCMSenderID") as? String)
|
|
75
|
+
|
|
76
|
+
adapter.APIKey = "api-key"
|
|
77
|
+
adapter.projectID = "project-id"
|
|
78
|
+
adapter.clientID = "client-id"
|
|
79
|
+
adapter.databaseURL = "https://example.firebaseio.com"
|
|
80
|
+
adapter.storageBucket = "example.appspot.com"
|
|
81
|
+
adapter.bundleID = "com.example.app"
|
|
82
|
+
adapter.appGroupID = "group.com.example"
|
|
83
|
+
XCTAssertEqual(adapter.APIKey, "api-key")
|
|
84
|
+
XCTAssertEqual(adapter.projectID, "project-id")
|
|
85
|
+
XCTAssertEqual(adapter.clientID, "client-id")
|
|
86
|
+
XCTAssertEqual(adapter.databaseURL, "https://example.firebaseio.com")
|
|
87
|
+
XCTAssertEqual(adapter.storageBucket, "example.appspot.com")
|
|
88
|
+
XCTAssertEqual(adapter.bundleID, "com.example.app")
|
|
89
|
+
XCTAssertEqual(adapter.appGroupID, "group.com.example")
|
|
90
|
+
adapter.bundleID = nil
|
|
91
|
+
adapter.appGroupID = nil
|
|
92
|
+
XCTAssertNil(adapter.bundleID)
|
|
93
|
+
XCTAssertNil(adapter.appGroupID)
|
|
94
|
+
}
|
|
95
|
+
XCTAssertNil(released)
|
|
96
|
+
|
|
97
|
+
let moduleConfigured = RNFBAppModuleFirebase.optionsFactory().create(
|
|
98
|
+
googleAppID: "module-app",
|
|
99
|
+
gcmSenderID: "module-sender"
|
|
100
|
+
)
|
|
101
|
+
let moduleAdapter = moduleConfigured as! RNFBFIROptionsConfiguringAdapter
|
|
102
|
+
XCTAssertEqual(moduleAdapter.options.value(forKey: "googleAppID") as? String, "module-app")
|
|
103
|
+
XCTAssertEqual(moduleAdapter.options.value(forKey: "GCMSenderID") as? String, "module-sender")
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
func testConvertRawOptionsReturnsLiveOptions() {
|
|
107
|
+
let raw: NSDictionary = [
|
|
108
|
+
"appId": "app-id",
|
|
109
|
+
"messagingSenderId": "sender-id",
|
|
110
|
+
"apiKey": "api-key",
|
|
111
|
+
"projectId": "project-id",
|
|
112
|
+
"clientId": "client-id",
|
|
113
|
+
"databaseURL": "https://example.firebaseio.com",
|
|
114
|
+
"storageBucket": "example.appspot.com",
|
|
115
|
+
]
|
|
116
|
+
let result = RCTConvertFIROptions.convertRawOptions(raw) as! FirebaseOptions
|
|
117
|
+
XCTAssertEqual(result.googleAppID, "app-id")
|
|
118
|
+
XCTAssertEqual(result.gcmSenderID, "sender-id")
|
|
119
|
+
XCTAssertEqual(result.apiKey, "api-key")
|
|
120
|
+
XCTAssertEqual(result.projectID, "project-id")
|
|
121
|
+
XCTAssertEqual(result.clientID, "client-id")
|
|
122
|
+
XCTAssertEqual(result.databaseURL, "https://example.firebaseio.com")
|
|
123
|
+
XCTAssertEqual(result.storageBucket, "example.appspot.com")
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
func testAppLookupConfigureReuseAndAllApps() {
|
|
127
|
+
XCTAssertNil(RCTConvertFIRApp.firApp(fromString: "missing"))
|
|
128
|
+
XCTAssertEqual(RNFBAppModuleFirebase.allApps().count, 0)
|
|
129
|
+
|
|
130
|
+
let options = RNFBFIROptionsFactoryAdapter.shared.create(googleAppID: "app-id", gcmSenderID: "sender")
|
|
131
|
+
let missingDefault = RNFBAppInitializeNameResolution(
|
|
132
|
+
appName: nil,
|
|
133
|
+
jsAppName: "[DEFAULT]",
|
|
134
|
+
isDefaultApp: true
|
|
135
|
+
)
|
|
136
|
+
let created = RNFBAppModuleFirebase.configureOrReuseApp(
|
|
137
|
+
options: options,
|
|
138
|
+
nameResolution: missingDefault
|
|
139
|
+
)
|
|
140
|
+
XCTAssertTrue(created === FirebaseApp.app())
|
|
141
|
+
XCTAssertTrue(RCTConvertFIRApp.firApp(fromString: "[DEFAULT]") === FirebaseApp.app())
|
|
142
|
+
|
|
143
|
+
let reused = RNFBAppModuleFirebase.configureOrReuseApp(
|
|
144
|
+
options: options,
|
|
145
|
+
nameResolution: missingDefault
|
|
146
|
+
)
|
|
147
|
+
XCTAssertTrue(reused === created)
|
|
148
|
+
|
|
149
|
+
let named = RNFBAppInitializeNameResolution(
|
|
150
|
+
appName: "secondary",
|
|
151
|
+
jsAppName: "secondary",
|
|
152
|
+
isDefaultApp: false
|
|
153
|
+
)
|
|
154
|
+
let secondary = RNFBAppModuleFirebase.configureOrReuseApp(
|
|
155
|
+
options: RNFBFIROptionsFactoryAdapter.shared.create(googleAppID: "named", gcmSenderID: "named-sender"),
|
|
156
|
+
nameResolution: named
|
|
157
|
+
)
|
|
158
|
+
XCTAssertTrue(secondary === FirebaseApp.app(name: "secondary"))
|
|
159
|
+
XCTAssertTrue(RNFBAppModuleFirebase.app(forName: "secondary") === secondary)
|
|
160
|
+
XCTAssertEqual(RNFBAppModuleFirebase.allApps().count, 2)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
func testDictionaryAndEventUseFacadeSnapshot() {
|
|
164
|
+
let options = FirebaseOptions(googleAppID: "app-id", gcmSenderID: "sender-id")
|
|
165
|
+
options.apiKey = "api-key"
|
|
166
|
+
options.projectID = "project-id"
|
|
167
|
+
options.databaseURL = "https://example.firebaseio.com"
|
|
168
|
+
options.storageBucket = "example.appspot.com"
|
|
169
|
+
options.clientID = "client-id"
|
|
170
|
+
let app = FirebaseApp(name: "__FIRAPP_DEFAULT", options: options)
|
|
171
|
+
app.isDataCollectionDefaultEnabled = true
|
|
172
|
+
|
|
173
|
+
let domains = DynamicDomainProvider()
|
|
174
|
+
domains.domains["[DEFAULT]"] = "auth.example.com"
|
|
175
|
+
let result = RNFBSharedUtilsFIRApp.firAppToDictionary(fromFIRApp: app, customDomainProvider: domains)
|
|
176
|
+
let appConfig = result["appConfig"] as! NSDictionary
|
|
177
|
+
let mapped = result["options"] as! NSDictionary
|
|
178
|
+
XCTAssertEqual(appConfig["name"] as? String, "[DEFAULT]")
|
|
179
|
+
XCTAssertEqual(appConfig["automaticDataCollectionEnabled"] as? Bool, true)
|
|
180
|
+
XCTAssertEqual(mapped["apiKey"] as? String, "api-key")
|
|
181
|
+
XCTAssertEqual(mapped["appId"] as? String, "app-id")
|
|
182
|
+
XCTAssertEqual(mapped["projectId"] as? String, "project-id")
|
|
183
|
+
XCTAssertEqual(mapped["databaseURL"] as? String, "https://example.firebaseio.com")
|
|
184
|
+
XCTAssertEqual(mapped["storageBucket"] as? String, "example.appspot.com")
|
|
185
|
+
XCTAssertEqual(mapped["messagingSenderId"] as? String, "sender-id")
|
|
186
|
+
XCTAssertEqual(mapped["clientId"] as? String, "client-id")
|
|
187
|
+
XCTAssertEqual(mapped["authDomain"] as? String, "auth.example.com")
|
|
188
|
+
|
|
189
|
+
let sender = DynamicEventSender()
|
|
190
|
+
RNFBSharedUtilsFIRApp.sendJSEvent(
|
|
191
|
+
forFIRApp: app,
|
|
192
|
+
name: "app-ready",
|
|
193
|
+
body: ["ok": true],
|
|
194
|
+
eventSender: sender
|
|
195
|
+
)
|
|
196
|
+
XCTAssertEqual(sender.name, "app-ready")
|
|
197
|
+
XCTAssertEqual(sender.body?["appName"] as? String, "[DEFAULT]")
|
|
198
|
+
XCTAssertEqual(sender.body?["ok"] as? Bool, true)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
func testLoggerRegistrationDataCollectionAndDelete() {
|
|
202
|
+
RNFBAppModuleFirebase.setLoggerLevel(7)
|
|
203
|
+
XCTAssertEqual(FirebaseConfiguration.shared.loggerLevel, unsafeBitCast(7, to: FirebaseLoggerLevel.self))
|
|
204
|
+
RNFBAppModuleFirebase.setLoggerLevel(99)
|
|
205
|
+
XCTAssertEqual(FirebaseConfiguration.shared.loggerLevel, unsafeBitCast(99, to: FirebaseLoggerLevel.self))
|
|
206
|
+
|
|
207
|
+
RNFBAppModuleFirebase.registerLibraryOnce(name: "react-native-firebase", version: "9.9.9")
|
|
208
|
+
RNFBAppModuleFirebase.registerLibraryOnce(name: "react-native-firebase", version: "ignored")
|
|
209
|
+
XCTAssertEqual(FirebaseApp.lastRegisteredLibraryNameForTesting(), "react-native-firebase")
|
|
210
|
+
XCTAssertEqual(FirebaseApp.lastRegisteredLibraryVersionForTesting(), "9.9.9")
|
|
211
|
+
|
|
212
|
+
let options = FirebaseOptions(googleAppID: "app-id", gcmSenderID: "sender")
|
|
213
|
+
let app = FirebaseApp(name: "secondary", options: options)
|
|
214
|
+
FirebaseApp.register(forTesting: app)
|
|
215
|
+
RNFBAppModuleFirebase.setAutomaticDataCollectionEnabled(true, forAppName: "missing")
|
|
216
|
+
XCTAssertFalse(app.isDataCollectionDefaultEnabled)
|
|
217
|
+
RNFBAppModuleFirebase.setAutomaticDataCollectionEnabled(true, forAppName: "secondary")
|
|
218
|
+
XCTAssertTrue(app.isDataCollectionDefaultEnabled)
|
|
219
|
+
|
|
220
|
+
RNFBAppModuleFirebase.setDataCollectionDefaultEnabled(false, forApp: NSObject())
|
|
221
|
+
XCTAssertTrue(app.isDataCollectionDefaultEnabled)
|
|
222
|
+
RNFBAppModuleFirebase.setDataCollectionDefaultEnabled(false, forApp: app)
|
|
223
|
+
XCTAssertFalse(app.isDataCollectionDefaultEnabled)
|
|
224
|
+
|
|
225
|
+
let castFailure = expectation(description: "cast-failure")
|
|
226
|
+
RNFBAppModuleFirebase.deleteApp(NSObject()) { success in
|
|
227
|
+
XCTAssertFalse(success)
|
|
228
|
+
castFailure.fulfill()
|
|
229
|
+
}
|
|
230
|
+
waitForExpectations(timeout: 1)
|
|
231
|
+
|
|
232
|
+
let deleted = expectation(description: "deleted")
|
|
233
|
+
RNFBAppModuleFirebase.deleteApp(app) { success in
|
|
234
|
+
XCTAssertTrue(success)
|
|
235
|
+
deleted.fulfill()
|
|
236
|
+
}
|
|
237
|
+
waitForExpectations(timeout: 1)
|
|
238
|
+
XCTAssertNil(FirebaseApp.app(name: "secondary"))
|
|
239
|
+
}
|
|
240
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/*
|
|
1
|
+
/**
|
|
4
2
|
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
3
|
*
|
|
6
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -14,18 +12,29 @@ package io.invertase.firebase.common;
|
|
|
14
12
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
13
|
* See the License for the specific language governing permissions and
|
|
16
14
|
* limitations under the License.
|
|
17
|
-
*
|
|
18
15
|
*/
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
import Foundation
|
|
18
|
+
import RNFBFirebase
|
|
19
|
+
|
|
20
|
+
/// Client of RNFBFirebase compiled with FirebaseCore and FirebaseInstallations
|
|
21
|
+
/// absent from the module path. `import RNFBFirebase` is the dynamic-probe failure.
|
|
22
|
+
enum RNFBFirebaseClientImportCheck {
|
|
23
|
+
static func boot() {
|
|
24
|
+
RNFBFirebaseAppClient.configure()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static func snapshot() -> RNFBFirebaseAppSnapshot {
|
|
28
|
+
RNFBFirebaseAppSnapshot(
|
|
29
|
+
name: "client",
|
|
30
|
+
apiKey: nil,
|
|
31
|
+
googleAppID: nil,
|
|
32
|
+
projectID: nil,
|
|
33
|
+
databaseURL: nil,
|
|
34
|
+
storageBucket: nil,
|
|
35
|
+
gcmSenderID: nil,
|
|
36
|
+
clientID: nil,
|
|
37
|
+
isDataCollectionDefaultEnabled: false
|
|
38
|
+
)
|
|
30
39
|
}
|
|
31
40
|
}
|