@react-native-firebase/app 26.3.3 → 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 +75 -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 +208 -60
- 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 +144 -13
- 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 -23
- package/dist/module/FirebaseApp.js +10 -0
- package/dist/module/FirebaseApp.js.map +1 -1
- package/dist/module/common/Base64.js +13 -21
- package/dist/module/common/Base64.js.map +1 -1
- package/dist/module/common/deeps.js +3 -0
- package/dist/module/common/deeps.js.map +1 -1
- package/dist/module/common/index.js +17 -9
- package/dist/module/common/index.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/asyncStorage.js +7 -11
- package/dist/module/internal/asyncStorage.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/logger.js +44 -40
- package/dist/module/internal/logger.js.map +1 -1
- package/dist/module/internal/nativeModuleAndroidIos.js +2 -29
- package/dist/module/internal/nativeModuleAndroidIos.js.map +1 -1
- package/dist/module/internal/nativeModuleDebug.js +74 -0
- package/dist/module/internal/nativeModuleDebug.js.map +1 -0
- package/dist/module/internal/nativeModuleWeb.js +9 -29
- package/dist/module/internal/nativeModuleWeb.js.map +1 -1
- package/dist/module/internal/registry/app.js +8 -2
- package/dist/module/internal/registry/app.js.map +1 -1
- package/dist/module/internal/registry/modular.js +2 -2
- package/dist/module/internal/registry/modular.js.map +1 -1
- package/dist/module/internal/registry/nativeModule.js +3 -3
- package/dist/module/internal/registry/nativeModule.js.map +1 -1
- package/dist/module/internal/web/RNFBAppModule.js +16 -15
- package/dist/module/internal/web/RNFBAppModule.js.map +1 -1
- package/dist/module/internal/web/memidb/lib/FakeEventTarget.js +3 -1
- package/dist/module/internal/web/memidb/lib/FakeEventTarget.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/Base64.d.ts.map +1 -1
- package/dist/typescript/lib/common/deeps.d.ts.map +1 -1
- package/dist/typescript/lib/common/index.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/asyncStorage.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/logger.d.ts.map +1 -1
- package/dist/typescript/lib/internal/nativeModuleAndroidIos.d.ts.map +1 -1
- package/dist/typescript/lib/internal/nativeModuleDebug.d.ts +2 -0
- package/dist/typescript/lib/internal/nativeModuleDebug.d.ts.map +1 -0
- package/dist/typescript/lib/internal/nativeModuleWeb.d.ts.map +1 -1
- package/dist/typescript/lib/internal/registry/app.d.ts.map +1 -1
- package/dist/typescript/lib/internal/web/RNFBAppModule.d.ts +7 -7
- package/dist/typescript/lib/internal/web/RNFBAppModule.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 +5 -1
- 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 +67 -204
- 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.h +73 -0
- package/ios/RNFBApp/RNFBHandleMap.m +87 -0
- 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 -197
- 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 +106 -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 +590 -0
- package/ios/RNFBAppUnitTests/RNFBAppUnitTests.xcodeproj/xcshareddata/xcschemes/RNFBAppUnitTests.xcscheme +69 -0
- package/ios/RNFBAppUnitTests/RNFBFirebaseAppClientTests.swift +165 -0
- package/ios/RNFBAppUnitTests/RNFBHandleMapStorageTests.swift +121 -0
- package/ios/RNFBAppUnitTests/RNFBHandleMapTests.m +238 -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/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppRegistrar.java → ios/RNFBFirebaseUnitTests/RNFBFirebaseClientImport.swift} +22 -17
- 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/Base64.ts +10 -16
- package/lib/common/deeps.ts +3 -0
- package/lib/common/index.ts +20 -9
- 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/asyncStorage.ts +7 -11
- package/lib/internal/index.ts +1 -0
- package/lib/internal/logger.ts +53 -43
- package/lib/internal/nativeModuleAndroidIos.ts +2 -40
- package/lib/internal/nativeModuleDebug.ts +97 -0
- package/lib/internal/nativeModuleWeb.ts +10 -40
- package/lib/internal/react-native-vendor-emitter.d.ts +11 -0
- package/lib/internal/registry/app.ts +8 -2
- package/lib/internal/registry/modular.ts +2 -2
- package/lib/internal/registry/nativeModule.ts +3 -3
- package/lib/internal/web/RNFBAppModule.ts +16 -15
- package/lib/internal/web/memidb/lib/FakeEventTarget.js +3 -1
- package/lib/types/app.ts +10 -3
- package/lib/types/internal.ts +19 -0
- package/lib/version.ts +1 -1
- package/package.json +9 -8
- package/plugin/build/ios/appDelegate.js +19 -9
- package/plugin/build/ios/podfile.js +16 -16
- package/plugin/build/pluginConfig.d.ts +4 -2
- package/plugin/src/ios/appDelegate.ts +45 -15
- package/plugin/src/ios/podfile.ts +20 -23
- package/plugin/src/pluginConfig.ts +4 -2
- package/android/src/main/java/io/invertase/firebase/common/TaskExecutorService.java +0 -124
- 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 -222
- 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/common/RCTConvertFirebase.java +0 -191
- 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 -107
- 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
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
package io.invertase.firebase.common
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import com.facebook.react.bridge.Arguments
|
|
21
|
+
import com.facebook.react.bridge.WritableMap
|
|
22
|
+
import io.invertase.firebase.BuildConfig
|
|
23
|
+
import org.json.JSONException
|
|
24
|
+
import org.json.JSONObject
|
|
25
|
+
import java.util.ArrayList
|
|
26
|
+
|
|
27
|
+
class ReactNativeFirebaseJSON private constructor() {
|
|
28
|
+
private var jsonObject: JSONObject? =
|
|
29
|
+
try {
|
|
30
|
+
JSONObject(BuildConfig.FIREBASE_JSON_RAW)
|
|
31
|
+
} catch (_: JSONException) {
|
|
32
|
+
// JSON is validated as part of gradle build - should never error
|
|
33
|
+
null
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
fun contains(key: String?): Boolean = jsonObject?.has(key) ?: false
|
|
37
|
+
|
|
38
|
+
fun getBooleanValue(
|
|
39
|
+
key: String?,
|
|
40
|
+
defaultValue: Boolean,
|
|
41
|
+
): Boolean = jsonObject?.optBoolean(key, defaultValue) ?: defaultValue
|
|
42
|
+
|
|
43
|
+
fun getIntValue(
|
|
44
|
+
key: String?,
|
|
45
|
+
defaultValue: Int,
|
|
46
|
+
): Int = jsonObject?.optInt(key, defaultValue) ?: defaultValue
|
|
47
|
+
|
|
48
|
+
fun getLongValue(
|
|
49
|
+
key: String?,
|
|
50
|
+
defaultValue: Long,
|
|
51
|
+
): Long = jsonObject?.optLong(key, defaultValue) ?: defaultValue
|
|
52
|
+
|
|
53
|
+
fun getStringValue(
|
|
54
|
+
key: String?,
|
|
55
|
+
defaultValue: String?,
|
|
56
|
+
): String? {
|
|
57
|
+
val source = jsonObject ?: return defaultValue
|
|
58
|
+
return source.optString(key, defaultValue)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
fun getArrayValue(key: String?): ArrayList<String> {
|
|
62
|
+
val result = ArrayList<String>()
|
|
63
|
+
val source = jsonObject ?: return result
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
val array = source.optJSONArray(key)
|
|
67
|
+
if (array != null) {
|
|
68
|
+
for (index in 0 until array.length()) {
|
|
69
|
+
result.add(array.getString(index))
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
} catch (_: JSONException) {
|
|
73
|
+
// Do nothing.
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return result
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
fun getRawJSON(): String = BuildConfig.FIREBASE_JSON_RAW
|
|
80
|
+
|
|
81
|
+
fun getAll(): WritableMap {
|
|
82
|
+
val writableMap = Arguments.createMap()
|
|
83
|
+
val source = jsonObject ?: return writableMap
|
|
84
|
+
|
|
85
|
+
val keys = source.keys()
|
|
86
|
+
while (keys.hasNext()) {
|
|
87
|
+
try {
|
|
88
|
+
val key = keys.next()
|
|
89
|
+
SharedUtils.mapPutValue(key, source.get(key), writableMap)
|
|
90
|
+
} catch (_: JSONException) {
|
|
91
|
+
// Ignore malformed entries and continue converting the remaining values.
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return writableMap
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
companion object {
|
|
99
|
+
private val sharedInstance = ReactNativeFirebaseJSON()
|
|
100
|
+
|
|
101
|
+
@JvmStatic fun getSharedInstance(): ReactNativeFirebaseJSON = sharedInstance
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
package io.invertase.firebase.common
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import android.content.pm.ApplicationInfo
|
|
21
|
+
import android.content.pm.PackageManager
|
|
22
|
+
import android.os.Bundle
|
|
23
|
+
import com.facebook.react.bridge.Arguments
|
|
24
|
+
import com.facebook.react.bridge.WritableMap
|
|
25
|
+
import io.invertase.firebase.app.ReactNativeFirebaseApp
|
|
26
|
+
|
|
27
|
+
open class ReactNativeFirebaseMeta {
|
|
28
|
+
private fun getMetaData(): Bundle? {
|
|
29
|
+
try {
|
|
30
|
+
val context = ReactNativeFirebaseApp.getApplicationContext()
|
|
31
|
+
val packageManager = context.packageManager ?: return null
|
|
32
|
+
val applicationInfo: ApplicationInfo? =
|
|
33
|
+
packageManager.getApplicationInfo(context.packageName, PackageManager.GET_META_DATA)
|
|
34
|
+
return applicationInfo?.metaData
|
|
35
|
+
} catch (_: PackageManager.NameNotFoundException) {
|
|
36
|
+
// Do nothing.
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return null
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
open fun contains(key: String?): Boolean {
|
|
43
|
+
val metaData = getMetaData() ?: return false
|
|
44
|
+
return metaData.containsKey(META_PREFIX + key)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
open fun getBooleanValue(
|
|
48
|
+
key: String?,
|
|
49
|
+
defaultValue: Boolean,
|
|
50
|
+
): Boolean {
|
|
51
|
+
val metaData = getMetaData() ?: return defaultValue
|
|
52
|
+
return metaData.getBoolean(META_PREFIX + key, defaultValue)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
open fun getStringValue(
|
|
56
|
+
key: String?,
|
|
57
|
+
defaultValue: String?,
|
|
58
|
+
): String? {
|
|
59
|
+
val metaData = getMetaData() ?: return defaultValue
|
|
60
|
+
return metaData.getString(META_PREFIX + key, defaultValue)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
open fun getIntValue(
|
|
64
|
+
key: String?,
|
|
65
|
+
defaultValue: Int,
|
|
66
|
+
): Int {
|
|
67
|
+
val metaData = getMetaData() ?: return defaultValue
|
|
68
|
+
return metaData.getInt(META_PREFIX + key, defaultValue)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
open fun getAll(): WritableMap {
|
|
72
|
+
val metaData = getMetaData()
|
|
73
|
+
val map = Arguments.createMap()
|
|
74
|
+
if (metaData == null) return map
|
|
75
|
+
|
|
76
|
+
for (key in metaData.keySet()) {
|
|
77
|
+
if (key.startsWith(META_PREFIX)) {
|
|
78
|
+
when (val value = metaData.get(key)) {
|
|
79
|
+
null -> map.putNull(key)
|
|
80
|
+
is String -> map.putString(key, value)
|
|
81
|
+
is Boolean -> map.putBoolean(key, value)
|
|
82
|
+
is Int -> map.putInt(key, value)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return map
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
companion object {
|
|
91
|
+
private const val META_PREFIX = "rnfirebase_"
|
|
92
|
+
private val sharedInstance = ReactNativeFirebaseMeta()
|
|
93
|
+
|
|
94
|
+
@JvmStatic fun getSharedInstance(): ReactNativeFirebaseMeta = sharedInstance
|
|
95
|
+
}
|
|
96
|
+
}
|
package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseModule.kt
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
package io.invertase.firebase.common
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import android.app.Activity
|
|
21
|
+
import android.content.Context
|
|
22
|
+
import androidx.annotation.CallSuper
|
|
23
|
+
import com.facebook.react.bridge.Arguments
|
|
24
|
+
import com.facebook.react.bridge.Promise
|
|
25
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
26
|
+
import com.facebook.react.bridge.ReactContext
|
|
27
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
28
|
+
import com.facebook.react.bridge.ReadableMap
|
|
29
|
+
import io.invertase.firebase.interfaces.ContextProvider
|
|
30
|
+
import java.util.HashMap
|
|
31
|
+
import java.util.concurrent.ExecutorService
|
|
32
|
+
|
|
33
|
+
open class ReactNativeFirebaseModule(
|
|
34
|
+
reactContext: ReactApplicationContext?,
|
|
35
|
+
private var moduleName: String?,
|
|
36
|
+
) : ReactContextBaseJavaModule(reactContext),
|
|
37
|
+
ContextProvider {
|
|
38
|
+
private val executorService = TaskExecutorService(name)
|
|
39
|
+
|
|
40
|
+
@CallSuper
|
|
41
|
+
override fun initialize() {
|
|
42
|
+
super.initialize()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
override fun getContext(): ReactContext? = reactApplicationContext
|
|
46
|
+
|
|
47
|
+
fun getExecutor(): ExecutorService = executorService.getExecutor()
|
|
48
|
+
|
|
49
|
+
fun getTransactionalExecutor(): ExecutorService = executorService.getTransactionalExecutor()
|
|
50
|
+
|
|
51
|
+
fun getTransactionalExecutor(identifier: String): ExecutorService = executorService.getTransactionalExecutor(identifier)
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Kept for source and runtime compatibility with React Native versions that called this method.
|
|
55
|
+
* Dynamic dispatch is intentional: a child invalidate implementation must run before it calls
|
|
56
|
+
* back into [invalidate].
|
|
57
|
+
*/
|
|
58
|
+
@Suppress("DEPRECATION", "OVERRIDE_DEPRECATION")
|
|
59
|
+
@java.lang.Deprecated
|
|
60
|
+
@Deprecated("Use invalidate() instead.")
|
|
61
|
+
override fun onCatalystInstanceDestroy() {
|
|
62
|
+
invalidate()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Current React Native defines invalidate as an empty subclass hook. Do not call super here:
|
|
67
|
+
* older supported React Native versions delegated back to onCatalystInstanceDestroy, which
|
|
68
|
+
* would recurse through this compatibility method.
|
|
69
|
+
*/
|
|
70
|
+
@CallSuper
|
|
71
|
+
override fun invalidate() {
|
|
72
|
+
executorService.shutdown()
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
fun removeEventListeningExecutor(identifier: String) {
|
|
76
|
+
val executorName = executorService.getExecutorName(true, identifier)
|
|
77
|
+
executorService.removeExecutor(executorName)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
override fun getApplicationContext(): Context? = reactApplicationContext.applicationContext
|
|
81
|
+
|
|
82
|
+
override fun getActivity(): Activity? = reactApplicationContext.currentActivity
|
|
83
|
+
|
|
84
|
+
override fun getName(): String = "RNFB${moduleName}Module"
|
|
85
|
+
|
|
86
|
+
override fun getConstants(): MutableMap<String, Any> = HashMap()
|
|
87
|
+
|
|
88
|
+
companion object {
|
|
89
|
+
@JvmStatic
|
|
90
|
+
fun rejectPromiseWithExceptionMap(
|
|
91
|
+
promise: Promise?,
|
|
92
|
+
exception: Exception,
|
|
93
|
+
) {
|
|
94
|
+
val exceptionMap = SharedUtils.getExceptionMap(exception)
|
|
95
|
+
promise!!.reject(exception, exceptionMap)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@JvmStatic
|
|
99
|
+
fun rejectPromiseWithCodeAndMessage(
|
|
100
|
+
promise: Promise?,
|
|
101
|
+
code: String?,
|
|
102
|
+
message: String?,
|
|
103
|
+
resolver: ReadableMap?,
|
|
104
|
+
) {
|
|
105
|
+
val userInfoMap = Arguments.createMap()
|
|
106
|
+
userInfoMap.putString("code", code)
|
|
107
|
+
userInfoMap.putString("message", message)
|
|
108
|
+
if (resolver != null) {
|
|
109
|
+
userInfoMap.putMap("resolver", resolver)
|
|
110
|
+
}
|
|
111
|
+
promise!!.reject(code, message, userInfoMap)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@JvmStatic
|
|
115
|
+
fun rejectPromiseWithCodeAndMessage(
|
|
116
|
+
promise: Promise?,
|
|
117
|
+
code: String?,
|
|
118
|
+
message: String?,
|
|
119
|
+
) {
|
|
120
|
+
val userInfoMap = Arguments.createMap()
|
|
121
|
+
userInfoMap.putString("code", code)
|
|
122
|
+
userInfoMap.putString("message", message)
|
|
123
|
+
promise!!.reject(code, message, userInfoMap)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@JvmStatic
|
|
127
|
+
fun rejectPromiseWithCodeAndMessage(
|
|
128
|
+
promise: Promise?,
|
|
129
|
+
code: String?,
|
|
130
|
+
message: String?,
|
|
131
|
+
nativeErrorMessage: String?,
|
|
132
|
+
) {
|
|
133
|
+
val userInfoMap = Arguments.createMap()
|
|
134
|
+
userInfoMap.putString("code", code)
|
|
135
|
+
userInfoMap.putString("message", message)
|
|
136
|
+
userInfoMap.putString("nativeErrorMessage", nativeErrorMessage)
|
|
137
|
+
promise!!.reject(code, message, userInfoMap)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebasePreferences.kt
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
package io.invertase.firebase.common
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import android.content.Context
|
|
21
|
+
import android.content.SharedPreferences
|
|
22
|
+
import com.facebook.react.bridge.Arguments
|
|
23
|
+
import com.facebook.react.bridge.WritableMap
|
|
24
|
+
import io.invertase.firebase.app.ReactNativeFirebaseApp
|
|
25
|
+
|
|
26
|
+
open class ReactNativeFirebasePreferences {
|
|
27
|
+
private var preferences: SharedPreferences? = null
|
|
28
|
+
|
|
29
|
+
open fun contains(key: String?): Boolean = getPreferences().contains(key)
|
|
30
|
+
|
|
31
|
+
open fun setBooleanValue(
|
|
32
|
+
key: String?,
|
|
33
|
+
value: Boolean,
|
|
34
|
+
) {
|
|
35
|
+
getPreferences().edit().putBoolean(key, value).apply()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
open fun getBooleanValue(
|
|
39
|
+
key: String?,
|
|
40
|
+
defaultValue: Boolean,
|
|
41
|
+
): Boolean = getPreferences().getBoolean(key, defaultValue)
|
|
42
|
+
|
|
43
|
+
open fun setIntValue(
|
|
44
|
+
key: String?,
|
|
45
|
+
value: Int,
|
|
46
|
+
) {
|
|
47
|
+
getPreferences().edit().putInt(key, value).apply()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
open fun getIntValue(
|
|
51
|
+
key: String?,
|
|
52
|
+
defaultValue: Int,
|
|
53
|
+
): Int = getPreferences().getInt(key, defaultValue)
|
|
54
|
+
|
|
55
|
+
open fun setLongValue(
|
|
56
|
+
key: String?,
|
|
57
|
+
value: Long,
|
|
58
|
+
) {
|
|
59
|
+
getPreferences().edit().putLong(key, value).apply()
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
open fun getLongValue(
|
|
63
|
+
key: String?,
|
|
64
|
+
defaultValue: Long,
|
|
65
|
+
): Long = getPreferences().getLong(key, defaultValue)
|
|
66
|
+
|
|
67
|
+
open fun setStringValue(
|
|
68
|
+
key: String?,
|
|
69
|
+
value: String?,
|
|
70
|
+
) {
|
|
71
|
+
getPreferences().edit().putString(key, value).apply()
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
open fun getStringValue(
|
|
75
|
+
key: String?,
|
|
76
|
+
defaultValue: String?,
|
|
77
|
+
): String? = getPreferences().getString(key, defaultValue)
|
|
78
|
+
|
|
79
|
+
open fun getAll(): WritableMap {
|
|
80
|
+
val writableMap = Arguments.createMap()
|
|
81
|
+
|
|
82
|
+
for ((key, value) in getPreferences().all) {
|
|
83
|
+
SharedUtils.mapPutValue(key, value, writableMap)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return writableMap
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
open fun clearAll() {
|
|
90
|
+
getPreferences().edit().clear().apply()
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private fun getPreferences(): SharedPreferences {
|
|
94
|
+
if (preferences == null) {
|
|
95
|
+
preferences =
|
|
96
|
+
ReactNativeFirebaseApp
|
|
97
|
+
.getApplicationContext()
|
|
98
|
+
.getSharedPreferences(PREFERENCES_FILE, Context.MODE_PRIVATE)
|
|
99
|
+
}
|
|
100
|
+
return preferences!!
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
companion object {
|
|
104
|
+
private const val PREFERENCES_FILE = "io.invertase.firebase"
|
|
105
|
+
private val sharedInstance = ReactNativeFirebasePreferences()
|
|
106
|
+
|
|
107
|
+
@JvmStatic fun getSharedInstance(): ReactNativeFirebasePreferences = sharedInstance
|
|
108
|
+
}
|
|
109
|
+
}
|