@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.
Files changed (283) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/README.md +10 -27
  3. package/RNFBApp.podspec +13 -5
  4. package/android/build.gradle +3 -0
  5. package/android/src/main/java/io/invertase/firebase/common/RNFBHandleCollisionException.kt +29 -0
  6. package/android/src/main/java/io/invertase/firebase/common/RNFBHandleMap.kt +146 -0
  7. package/android/src/main/java/io/invertase/firebase/common/TaskExecutorService.kt +156 -0
  8. package/android/src/main/java/io/invertase/firebase/common/UniversalFirebaseModule.kt +44 -0
  9. package/android/src/main/java/io/invertase/firebase/common/UniversalFirebasePreferences.kt +100 -0
  10. package/android/src/reactnative/java/io/invertase/firebase/app/NativeRNFBTurboApp.kt +250 -0
  11. package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseApp.kt +64 -0
  12. package/android/src/reactnative/java/io/invertase/firebase/app/{ReactNativeFirebaseAppInitProvider.java → ReactNativeFirebaseAppInitProvider.kt} +3 -4
  13. package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppPackage.kt +47 -0
  14. package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppRegistrar.kt +33 -0
  15. package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseVersion.java +1 -1
  16. package/android/src/reactnative/java/io/invertase/firebase/common/RCTConvertFirebase.kt +185 -0
  17. package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseEvent.kt +35 -0
  18. package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseEventEmitter.kt +662 -0
  19. package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseJSON.kt +103 -0
  20. package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseMeta.kt +96 -0
  21. package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseModule.kt +140 -0
  22. package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebasePreferences.kt +109 -0
  23. package/android/src/reactnative/java/io/invertase/firebase/common/SharedUtils.kt +451 -0
  24. package/android/src/reactnative/java/io/invertase/firebase/interfaces/{ContextProvider.java → ContextProvider.kt} +8 -8
  25. package/android/src/reactnative/java/io/invertase/firebase/interfaces/{NativeError.java → NativeError.kt} +8 -8
  26. package/android/src/reactnative/java/io/invertase/firebase/interfaces/{NativeEvent.java → NativeEvent.kt} +6 -6
  27. package/android/src/reactnative/java/io/invertase/firebase/utils/NativeRNFBTurboUtils.kt +219 -0
  28. package/android/src/test/java/expo/core/ModuleRegistry.java +9 -0
  29. package/android/src/test/java/io/invertase/firebase/app/NativeRNFBTurboAppTest.java +208 -60
  30. package/android/src/test/java/io/invertase/firebase/app/ReactNativeFirebaseAppComponentsJavaCompatibilityTest.java +70 -0
  31. package/android/src/test/java/io/invertase/firebase/app/ReactNativeFirebaseAppJavaCompatibilityTest.java +60 -0
  32. package/android/src/test/java/io/invertase/firebase/app/ReactNativeFirebaseAppPackageTest.java +165 -0
  33. package/android/src/test/java/io/invertase/firebase/app/ReactNativeFirebaseAppTest.kt +167 -0
  34. package/android/src/test/java/io/invertase/firebase/common/RCTConvertFirebaseJavaCompatibilityTest.java +112 -0
  35. package/android/src/test/java/io/invertase/firebase/common/RCTConvertFirebaseTest.kt +317 -0
  36. package/android/src/test/java/io/invertase/firebase/common/RNFBHandleMapTest.kt +309 -0
  37. package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseEventEmitterJavaCompatibilityTest.java +176 -0
  38. package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseEventEmitterTest.java +144 -13
  39. package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseEventTest.kt +61 -0
  40. package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseJSONJavaCompatibilityTest.java +85 -0
  41. package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseJSONTest.kt +296 -0
  42. package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseMetaJavaCompatibilityTest.java +67 -0
  43. package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseMetaTest.kt +246 -0
  44. package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebaseModuleTest.kt +254 -0
  45. package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebasePreferencesJavaCompatibilityTest.java +87 -0
  46. package/android/src/test/java/io/invertase/firebase/common/ReactNativeFirebasePreferencesTest.kt +260 -0
  47. package/android/src/test/java/io/invertase/firebase/common/SharedUtilsJavaCompatibilityTest.java +255 -0
  48. package/android/src/test/java/io/invertase/firebase/common/SharedUtilsTest.kt +674 -0
  49. package/android/src/test/java/io/invertase/firebase/common/TaskExecutorServiceTest.kt +290 -0
  50. package/android/src/test/java/io/invertase/firebase/common/UniversalFirebaseModuleJavaCompatibilityTest.java +178 -0
  51. package/android/src/test/java/io/invertase/firebase/common/UniversalFirebasePreferencesJavaCompatibilityTest.java +99 -0
  52. package/android/src/test/java/io/invertase/firebase/common/UniversalFirebasePreferencesTest.kt +217 -0
  53. package/android/src/test/java/io/invertase/firebase/commoncompat/ReactNativeFirebaseModuleJavaCompatibilityTest.java +176 -0
  54. package/android/src/test/java/io/invertase/firebase/commoncompat/ReactNativeFirebaseModuleKotlinCompatibilityTest.kt +52 -0
  55. package/android/src/test/java/io/invertase/firebase/interfaces/InterfacesJavaCompatibilityTest.java +144 -0
  56. package/android/src/test/java/io/invertase/firebase/interfaces/NativeEventTest.kt +56 -0
  57. package/android/src/test/java/io/invertase/firebase/utils/NativeRNFBTurboUtilsTest.java +517 -23
  58. package/dist/module/FirebaseApp.js +10 -0
  59. package/dist/module/FirebaseApp.js.map +1 -1
  60. package/dist/module/common/Base64.js +13 -21
  61. package/dist/module/common/Base64.js.map +1 -1
  62. package/dist/module/common/deeps.js +3 -0
  63. package/dist/module/common/deeps.js.map +1 -1
  64. package/dist/module/common/index.js +17 -9
  65. package/dist/module/common/index.js.map +1 -1
  66. package/dist/module/internal/FirebaseModule.js.map +1 -1
  67. package/dist/module/internal/RNFBNativeEventEmitter.js +12 -1
  68. package/dist/module/internal/RNFBNativeEventEmitter.js.map +1 -1
  69. package/dist/module/internal/SharedEventEmitter.js +3 -1
  70. package/dist/module/internal/SharedEventEmitter.js.map +1 -1
  71. package/dist/module/internal/asyncStorage.js +7 -11
  72. package/dist/module/internal/asyncStorage.js.map +1 -1
  73. package/dist/module/internal/index.js +1 -0
  74. package/dist/module/internal/index.js.map +1 -1
  75. package/dist/module/internal/logger.js +44 -40
  76. package/dist/module/internal/logger.js.map +1 -1
  77. package/dist/module/internal/nativeModuleAndroidIos.js +2 -29
  78. package/dist/module/internal/nativeModuleAndroidIos.js.map +1 -1
  79. package/dist/module/internal/nativeModuleDebug.js +74 -0
  80. package/dist/module/internal/nativeModuleDebug.js.map +1 -0
  81. package/dist/module/internal/nativeModuleWeb.js +9 -29
  82. package/dist/module/internal/nativeModuleWeb.js.map +1 -1
  83. package/dist/module/internal/registry/app.js +8 -2
  84. package/dist/module/internal/registry/app.js.map +1 -1
  85. package/dist/module/internal/registry/modular.js +2 -2
  86. package/dist/module/internal/registry/modular.js.map +1 -1
  87. package/dist/module/internal/registry/nativeModule.js +3 -3
  88. package/dist/module/internal/registry/nativeModule.js.map +1 -1
  89. package/dist/module/internal/web/RNFBAppModule.js +16 -15
  90. package/dist/module/internal/web/RNFBAppModule.js.map +1 -1
  91. package/dist/module/internal/web/memidb/lib/FakeEventTarget.js +3 -1
  92. package/dist/module/internal/web/memidb/lib/FakeEventTarget.js.map +1 -1
  93. package/dist/module/types/app.js.map +1 -1
  94. package/dist/module/types/internal.js +2 -0
  95. package/dist/module/version.js +1 -1
  96. package/dist/typescript/lib/FirebaseApp.d.ts +7 -0
  97. package/dist/typescript/lib/FirebaseApp.d.ts.map +1 -1
  98. package/dist/typescript/lib/common/Base64.d.ts.map +1 -1
  99. package/dist/typescript/lib/common/deeps.d.ts.map +1 -1
  100. package/dist/typescript/lib/common/index.d.ts.map +1 -1
  101. package/dist/typescript/lib/internal/FirebaseModule.d.ts +2 -3
  102. package/dist/typescript/lib/internal/FirebaseModule.d.ts.map +1 -1
  103. package/dist/typescript/lib/internal/NativeModules.d.ts +4 -1
  104. package/dist/typescript/lib/internal/NativeModules.d.ts.map +1 -1
  105. package/dist/typescript/lib/internal/RNFBNativeEventEmitter.d.ts +2 -2
  106. package/dist/typescript/lib/internal/RNFBNativeEventEmitter.d.ts.map +1 -1
  107. package/dist/typescript/lib/internal/SharedEventEmitter.d.ts +3 -3
  108. package/dist/typescript/lib/internal/SharedEventEmitter.d.ts.map +1 -1
  109. package/dist/typescript/lib/internal/asyncStorage.d.ts.map +1 -1
  110. package/dist/typescript/lib/internal/index.d.ts +1 -0
  111. package/dist/typescript/lib/internal/index.d.ts.map +1 -1
  112. package/dist/typescript/lib/internal/logger.d.ts.map +1 -1
  113. package/dist/typescript/lib/internal/nativeModuleAndroidIos.d.ts.map +1 -1
  114. package/dist/typescript/lib/internal/nativeModuleDebug.d.ts +2 -0
  115. package/dist/typescript/lib/internal/nativeModuleDebug.d.ts.map +1 -0
  116. package/dist/typescript/lib/internal/nativeModuleWeb.d.ts.map +1 -1
  117. package/dist/typescript/lib/internal/registry/app.d.ts.map +1 -1
  118. package/dist/typescript/lib/internal/web/RNFBAppModule.d.ts +7 -7
  119. package/dist/typescript/lib/internal/web/RNFBAppModule.d.ts.map +1 -1
  120. package/dist/typescript/lib/types/app.d.ts +10 -3
  121. package/dist/typescript/lib/types/app.d.ts.map +1 -1
  122. package/dist/typescript/lib/types/internal.d.ts +12 -0
  123. package/dist/typescript/lib/types/internal.d.ts.map +1 -1
  124. package/dist/typescript/lib/version.d.ts +1 -1
  125. package/firebase-schema.json +5 -1
  126. package/firebase_spm.rb +552 -96
  127. package/ios/RNFBApp/RCTConvert+FIRApp.h +2 -5
  128. package/ios/RNFBApp/RCTConvert+FIRApp.m +11 -6
  129. package/ios/RNFBApp/RCTConvert+FIROptions.h +2 -5
  130. package/ios/RNFBApp/RCTConvert+FIROptions.m +11 -10
  131. package/ios/RNFBApp/RCTConvertFIRApp.swift +86 -0
  132. package/ios/RNFBApp/RCTConvertFIROptions.swift +259 -0
  133. package/ios/RNFBApp/RNFBAppCustomAuthDomains.swift +63 -0
  134. package/ios/RNFBApp/RNFBAppInitializeOptionsMapper.swift +113 -0
  135. package/ios/RNFBApp/RNFBAppLogLevelMapper.swift +53 -0
  136. package/ios/RNFBApp/RNFBAppModule+CustomAuthDomain.m +35 -0
  137. package/ios/RNFBApp/RNFBAppModule.h +6 -2
  138. package/ios/RNFBApp/RNFBAppModule.mm +67 -204
  139. package/ios/RNFBApp/RNFBAppModuleFirebase.swift +439 -0
  140. package/ios/RNFBApp/RNFBAppModuleImplementation.h +68 -0
  141. package/ios/RNFBApp/RNFBAppModuleImplementation.m +195 -0
  142. package/ios/RNFBApp/RNFBHandleMap.h +73 -0
  143. package/ios/RNFBApp/RNFBHandleMap.m +87 -0
  144. package/ios/RNFBApp/RNFBHandleMapStorage.swift +90 -0
  145. package/ios/RNFBApp/RNFBInitializeAppArguments.swift +82 -0
  146. package/ios/RNFBApp/RNFBJSON.m +22 -38
  147. package/ios/RNFBApp/RNFBJSONImplementation.swift +71 -0
  148. package/ios/RNFBApp/RNFBMeta.m +24 -26
  149. package/ios/RNFBApp/RNFBMetaStorage.swift +76 -0
  150. package/ios/RNFBApp/RNFBNullSentinelDecoding.swift +135 -0
  151. package/ios/RNFBApp/RNFBNullSentinelInterceptor.h +30 -3
  152. package/ios/RNFBApp/RNFBNullSentinelInterceptor.m +28 -5
  153. package/ios/RNFBApp/RNFBPreferences.m +22 -20
  154. package/ios/RNFBApp/RNFBPreferencesStorage.swift +101 -0
  155. package/ios/RNFBApp/RNFBRCTEventEmitter.m +36 -93
  156. package/ios/RNFBApp/RNFBRCTEventEmitterCore.swift +161 -0
  157. package/ios/RNFBApp/RNFBSharedUtils.h +2 -5
  158. package/ios/RNFBApp/RNFBSharedUtils.m +109 -197
  159. package/ios/RNFBApp/RNFBSharedUtilsConfig.swift +72 -0
  160. package/ios/RNFBApp/RNFBSharedUtilsFIRApp.swift +271 -0
  161. package/ios/RNFBApp/RNFBSharedUtilsFormatting.swift +59 -0
  162. package/ios/RNFBApp/RNFBSharedUtilsPromiseRejection.swift +88 -0
  163. package/ios/RNFBApp/RNFBUtilsHelpers.swift +116 -0
  164. package/ios/RNFBApp/RNFBUtilsModule+Foundation.m +44 -0
  165. package/ios/RNFBApp/RNFBUtilsModule+PhotoAssets.m +47 -0
  166. package/ios/RNFBApp/RNFBUtilsModule.h +11 -1
  167. package/ios/RNFBApp/RNFBUtilsModule.mm +10 -85
  168. package/ios/RNFBApp/RNFBUtilsModuleImplementation.h +32 -0
  169. package/ios/RNFBApp/RNFBUtilsModuleImplementation.m +56 -0
  170. package/ios/RNFBApp/RNFBVersion.m +1 -1
  171. package/ios/RNFBApp.xcodeproj/project.pbxproj +106 -0
  172. package/ios/RNFBAppUnitTests/HostStubs/FirebaseCore/FIRApp.m +171 -0
  173. package/ios/RNFBAppUnitTests/HostStubs/FirebaseCore/FirebaseCore.h +78 -0
  174. package/ios/RNFBAppUnitTests/HostStubs/FirebaseInstallations/FIRInstallations.m +7 -0
  175. package/ios/RNFBAppUnitTests/HostStubs/FirebaseInstallations/FirebaseInstallations.h +8 -0
  176. package/ios/RNFBAppUnitTests/HostStubs/RNFBAppModuleHostStub.m +55 -0
  177. package/ios/RNFBAppUnitTests/HostStubs/RNFBAppTurboModules.h +89 -0
  178. package/ios/RNFBAppUnitTests/HostStubs/RNFBAppTurboModules.mm +30 -0
  179. package/ios/RNFBAppUnitTests/HostStubs/React/RCTBridge.h +19 -0
  180. package/ios/RNFBAppUnitTests/HostStubs/React/RCTBridge.m +32 -0
  181. package/ios/RNFBAppUnitTests/HostStubs/React/RCTBridgeModule.h +19 -0
  182. package/ios/RNFBAppUnitTests/HostStubs/React/RCTConvert.h +28 -0
  183. package/ios/RNFBAppUnitTests/HostStubs/React/RCTConvert.m +23 -0
  184. package/ios/RNFBAppUnitTests/HostStubs/React/RCTEventEmitter.h +9 -0
  185. package/ios/RNFBAppUnitTests/HostStubs/React/RCTInvalidating.h +24 -0
  186. package/ios/RNFBAppUnitTests/HostStubs/React/RCTUtils.h +9 -0
  187. package/ios/RNFBAppUnitTests/HostStubs/module.modulemap +13 -0
  188. package/ios/RNFBAppUnitTests/RCTConvertFIRAppFacadeTests.m +61 -0
  189. package/ios/RNFBAppUnitTests/RCTConvertFIRAppTests.swift +73 -0
  190. package/ios/RNFBAppUnitTests/RCTConvertFIROptionsFacadeTests.m +57 -0
  191. package/ios/RNFBAppUnitTests/RCTConvertFIROptionsTests.swift +243 -0
  192. package/ios/RNFBAppUnitTests/RNFBAppCustomAuthDomainsFacadeTests.m +73 -0
  193. package/ios/RNFBAppUnitTests/RNFBAppCustomAuthDomainsTests.swift +70 -0
  194. package/ios/RNFBAppUnitTests/RNFBAppInitializeOptionsMapperTests.swift +190 -0
  195. package/ios/RNFBAppUnitTests/RNFBAppLogLevelFacadeTests.m +76 -0
  196. package/ios/RNFBAppUnitTests/RNFBAppLogLevelMapperTests.swift +59 -0
  197. package/ios/RNFBAppUnitTests/RNFBAppModuleFirebaseFacadeTests.m +215 -0
  198. package/ios/RNFBAppUnitTests/RNFBAppModuleFirebaseTests.swift +430 -0
  199. package/ios/RNFBAppUnitTests/RNFBAppModuleLifecycleTests.m +206 -0
  200. package/ios/RNFBAppUnitTests/RNFBAppModuleShellTests.mm +367 -0
  201. package/ios/RNFBAppUnitTests/RNFBAppUnitTests.xcodeproj/project.pbxproj +590 -0
  202. package/ios/RNFBAppUnitTests/RNFBAppUnitTests.xcodeproj/xcshareddata/xcschemes/RNFBAppUnitTests.xcscheme +69 -0
  203. package/ios/RNFBAppUnitTests/RNFBFirebaseAppClientTests.swift +165 -0
  204. package/ios/RNFBAppUnitTests/RNFBHandleMapStorageTests.swift +121 -0
  205. package/ios/RNFBAppUnitTests/RNFBHandleMapTests.m +238 -0
  206. package/ios/RNFBAppUnitTests/RNFBInitializeAppArgumentsTests.swift +256 -0
  207. package/ios/RNFBAppUnitTests/RNFBJSONImplementationTests.swift +126 -0
  208. package/ios/RNFBAppUnitTests/RNFBJSONTests.m +172 -0
  209. package/ios/RNFBAppUnitTests/RNFBMetaStorageTests.swift +106 -0
  210. package/ios/RNFBAppUnitTests/RNFBMetaTests.m +65 -0
  211. package/ios/RNFBAppUnitTests/RNFBNullSentinelDecodingTests.swift +286 -0
  212. package/ios/RNFBAppUnitTests/RNFBNullSentinelInterceptorTests.m +312 -0
  213. package/ios/RNFBAppUnitTests/RNFBPreferencesStorageTests.swift +105 -0
  214. package/ios/RNFBAppUnitTests/RNFBPreferencesTests.m +110 -0
  215. package/ios/RNFBAppUnitTests/RNFBRCTEventEmitterCoreTests.swift +163 -0
  216. package/ios/RNFBAppUnitTests/RNFBRCTEventEmitterFacadeTests.m +141 -0
  217. package/ios/RNFBAppUnitTests/RNFBSharedUtilsConfigFacadeTests.m +100 -0
  218. package/ios/RNFBAppUnitTests/RNFBSharedUtilsConfigTests.swift +234 -0
  219. package/ios/RNFBAppUnitTests/RNFBSharedUtilsFIRAppFacadeTests.m +145 -0
  220. package/ios/RNFBAppUnitTests/RNFBSharedUtilsFIRAppTests.swift +173 -0
  221. package/ios/RNFBAppUnitTests/RNFBSharedUtilsFormattingFacadeTests.m +38 -0
  222. package/ios/RNFBAppUnitTests/RNFBSharedUtilsFormattingTests.swift +82 -0
  223. package/ios/RNFBAppUnitTests/RNFBSharedUtilsNullSentinelTests.m +35 -0
  224. package/ios/RNFBAppUnitTests/RNFBSharedUtilsPromiseRejectionFacadeTests.m +107 -0
  225. package/ios/RNFBAppUnitTests/RNFBSharedUtilsPromiseRejectionTests.swift +133 -0
  226. package/ios/RNFBAppUnitTests/RNFBUtilsHelpersTests.swift +144 -0
  227. package/ios/RNFBAppUnitTests/RNFBUtilsModuleFacadeTests.m +72 -0
  228. package/ios/RNFBAppUnitTests/RNFBUtilsModuleShellTests.mm +282 -0
  229. package/ios/RNFBFirebase/Package.swift +53 -0
  230. package/ios/RNFBFirebase/Sources/RNFBFirebase/RNFBFirebase.swift +285 -0
  231. package/ios/RNFBFirebase/Sources/RNFBFirebaseBridge/Public/.gitkeep +0 -0
  232. package/ios/RNFBFirebase/Sources/RNFBFirebaseBridge/RNFBFirebaseBridge.m +169 -0
  233. package/ios/RNFBFirebase/Sources/RNFBFirebaseBridge/include/RNFBFirebaseBridge.h +52 -0
  234. package/ios/RNFBFirebaseUnitTests/RNFBAppDynamicFacadeTests.swift +240 -0
  235. package/{android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppRegistrar.java → ios/RNFBFirebaseUnitTests/RNFBFirebaseClientImport.swift} +22 -17
  236. package/ios/RNFBFirebaseUnitTests/RNFBFirebaseUnitTests.xcodeproj/project.pbxproj +588 -0
  237. package/ios/RNFBFirebaseUnitTests/RNFBFirebaseUnitTests.xcodeproj/xcshareddata/xcschemes/RNFBFirebaseUnitTests.xcscheme +83 -0
  238. package/ios_config.sh +50 -22
  239. package/lib/FirebaseApp.ts +10 -0
  240. package/lib/common/Base64.ts +10 -16
  241. package/lib/common/deeps.ts +3 -0
  242. package/lib/common/index.ts +20 -9
  243. package/lib/internal/FirebaseModule.ts +6 -3
  244. package/lib/internal/NativeModules.ts +4 -1
  245. package/lib/internal/RNFBNativeEventEmitter.ts +14 -5
  246. package/lib/internal/SharedEventEmitter.ts +5 -1
  247. package/lib/internal/asyncStorage.ts +7 -11
  248. package/lib/internal/index.ts +1 -0
  249. package/lib/internal/logger.ts +53 -43
  250. package/lib/internal/nativeModuleAndroidIos.ts +2 -40
  251. package/lib/internal/nativeModuleDebug.ts +97 -0
  252. package/lib/internal/nativeModuleWeb.ts +10 -40
  253. package/lib/internal/react-native-vendor-emitter.d.ts +11 -0
  254. package/lib/internal/registry/app.ts +8 -2
  255. package/lib/internal/registry/modular.ts +2 -2
  256. package/lib/internal/registry/nativeModule.ts +3 -3
  257. package/lib/internal/web/RNFBAppModule.ts +16 -15
  258. package/lib/internal/web/memidb/lib/FakeEventTarget.js +3 -1
  259. package/lib/types/app.ts +10 -3
  260. package/lib/types/internal.ts +19 -0
  261. package/lib/version.ts +1 -1
  262. package/package.json +9 -8
  263. package/plugin/build/ios/appDelegate.js +19 -9
  264. package/plugin/build/ios/podfile.js +16 -16
  265. package/plugin/build/pluginConfig.d.ts +4 -2
  266. package/plugin/src/ios/appDelegate.ts +45 -15
  267. package/plugin/src/ios/podfile.ts +20 -23
  268. package/plugin/src/pluginConfig.ts +4 -2
  269. package/android/src/main/java/io/invertase/firebase/common/TaskExecutorService.java +0 -124
  270. package/android/src/main/java/io/invertase/firebase/common/UniversalFirebaseModule.java +0 -62
  271. package/android/src/main/java/io/invertase/firebase/common/UniversalFirebasePreferences.java +0 -91
  272. package/android/src/reactnative/java/io/invertase/firebase/app/NativeRNFBTurboApp.java +0 -222
  273. package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseApp.java +0 -46
  274. package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseAppPackage.java +0 -49
  275. package/android/src/reactnative/java/io/invertase/firebase/common/RCTConvertFirebase.java +0 -191
  276. package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseEvent.java +0 -53
  277. package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseEventEmitter.java +0 -606
  278. package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseJSON.java +0 -107
  279. package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseMeta.java +0 -101
  280. package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebaseModule.java +0 -146
  281. package/android/src/reactnative/java/io/invertase/firebase/common/ReactNativeFirebasePreferences.java +0 -96
  282. package/android/src/reactnative/java/io/invertase/firebase/common/SharedUtils.java +0 -441
  283. package/android/src/reactnative/java/io/invertase/firebase/utils/NativeRNFBTurboUtils.java +0 -223
@@ -3,6 +3,36 @@ import { AppDelegateProjectFile } from '@expo/config-plugins/build/ios/Paths';
3
3
  import { mergeContents } from '@expo/config-plugins/build/utils/generateCode';
4
4
  import fs from 'fs';
5
5
 
6
+ function addImport(
7
+ contents: string,
8
+ importLine: string,
9
+ existingImportMatcher: RegExp,
10
+ preferredAnchorMatcher: RegExp,
11
+ anyImportMatcher: RegExp,
12
+ ): string {
13
+ if (existingImportMatcher.test(contents)) {
14
+ return contents;
15
+ }
16
+
17
+ const newline = contents.includes('\r\n') ? '\r\n' : '\n';
18
+ const preferredAnchor = preferredAnchorMatcher.exec(contents);
19
+ if (preferredAnchor?.index !== undefined) {
20
+ const insertionPoint = preferredAnchor.index + preferredAnchor[0].length;
21
+ return `${contents.slice(0, insertionPoint)}${newline}${importLine}${contents.slice(
22
+ insertionPoint,
23
+ )}`;
24
+ }
25
+
26
+ const firstImport = anyImportMatcher.exec(contents);
27
+ if (firstImport?.index !== undefined) {
28
+ return `${contents.slice(0, firstImport.index)}${importLine}${newline}${contents.slice(
29
+ firstImport.index,
30
+ )}`;
31
+ }
32
+
33
+ return `${importLine}${newline}${contents}`;
34
+ }
35
+
6
36
  export function modifyObjcAppDelegate(contents: string): string {
7
37
  const methodInvocationBlock = `[FIRApp configure];`;
8
38
  // https://regex101.com/r/mPgaq6/1
@@ -15,13 +45,13 @@ export function modifyObjcAppDelegate(contents: string): string {
15
45
  /-\s*\(BOOL\)\s*application:\s*\(UIApplication\s*\*\s*\)\s*\w+\s+didFinishLaunchingWithOptions:/g;
16
46
 
17
47
  // Add import
18
- if (!contents.includes('#import <Firebase/Firebase.h>')) {
19
- contents = contents.replace(
20
- /#import "AppDelegate.h"/g,
21
- `#import "AppDelegate.h"
22
- #import <Firebase/Firebase.h>`,
23
- );
24
- }
48
+ contents = addImport(
49
+ contents,
50
+ '#import <Firebase/Firebase.h>',
51
+ /^[ \t]*#import\s+<Firebase\/Firebase\.h>[ \t]*$/m,
52
+ /^[ \t]*#import\s+"AppDelegate\.h"[ \t]*$/m,
53
+ /^[ \t]*#import\b[^\r\n]*$/m,
54
+ );
25
55
 
26
56
  // To avoid potential issues with existing changes from older plugin versions
27
57
  if (contents.includes(methodInvocationBlock)) {
@@ -71,16 +101,16 @@ export function modifyObjcAppDelegate(contents: string): string {
71
101
  export function modifySwiftAppDelegate(contents: string): string {
72
102
  const methodInvocationBlock = `FirebaseApp.configure()`;
73
103
  const methodInvocationLineMatcher =
74
- /(?:self\.moduleName\s*=\s*"([^"]*)")|(?:factory\.startReactNative\()/;
104
+ /(?:self\.moduleName\s*=\s*"([^"]*)")|(?:factory\.startReactNative\()|(?:return\s+super\.application\(\s*application\s*,\s*didFinishLaunchingWithOptions:\s*launchOptions\s*\))/;
75
105
 
76
106
  // Add import
77
- if (!contents.includes('import FirebaseCore')) {
78
- contents = contents.replace(
79
- /import Expo/g,
80
- `import Expo
81
- import FirebaseCore`,
82
- );
83
- }
107
+ contents = addImport(
108
+ contents,
109
+ 'import FirebaseCore',
110
+ /^[ \t]*import\s+FirebaseCore[ \t]*$/m,
111
+ /^[ \t]*(?:internal\s+)?import\s+Expo[ \t]*$/m,
112
+ /^[ \t]*import\b[^\r\n]*$/m,
113
+ );
84
114
 
85
115
  // To avoid potential issues with existing changes from older plugin versions
86
116
  if (contents.includes(methodInvocationBlock)) {
@@ -1,39 +1,36 @@
1
1
  import { ConfigPlugin, withPodfile } from '@expo/config-plugins';
2
- import {
3
- mergeContents,
4
- removeGeneratedContents,
5
- } from '@expo/config-plugins/build/utils/generateCode';
2
+ import { removeGeneratedContents } from '@expo/config-plugins/build/utils/generateCode';
6
3
 
7
4
  import { PluginConfigType } from '../pluginConfig';
8
5
 
9
6
  const TAG = '@react-native-firebase/app-disableSPM';
10
- const ANCHOR = /prepare_react_native_project!/;
11
- const FLAG = '$RNFirebaseDisableSPM = true';
12
7
 
13
- // The flag must be defined before any target block so firebase_spm.rb sees it
14
- // when pods are declared - anchoring just after `prepare_react_native_project!`
15
- // guarantees that in the Podfile Expo generates.
8
+ const DISABLE_SPM_UNSUPPORTED =
9
+ '[react-native-firebase] ios.disableSPM is no longer supported. ' +
10
+ 'Firebase Apple SDK 13+ is distributed only through Swift Package Manager. ' +
11
+ 'Remove `disableSPM` from the `@react-native-firebase/app` config plugin and ' +
12
+ 'use dynamic frameworks (`expo-build-properties` ios.useFrameworks: "dynamic"). ' +
13
+ 'See https://rnfirebase.io/ios-spm';
14
+
15
+ // Historically injected `$RNFirebaseDisableSPM = true` before target blocks.
16
+ // Firebase 13+ is SPM-only: enabling this option must fail loudly, and any
17
+ // leftover generated flag is stripped on prebuild.
16
18
  export function setAppPodfileDisableSPM(src: string, enabled: boolean = false): string {
17
- if (!enabled) {
18
- return removeGeneratedContents(src, TAG) ?? src;
19
+ if (enabled) {
20
+ throw new Error(DISABLE_SPM_UNSUPPORTED);
19
21
  }
20
22
 
21
- return mergeContents({
22
- src,
23
- newSrc: FLAG,
24
- tag: TAG,
25
- anchor: ANCHOR,
26
- offset: 1,
27
- comment: '#',
28
- }).contents;
23
+ return removeGeneratedContents(src, TAG) ?? src;
29
24
  }
30
25
 
31
26
  export const withIosDisableSPM: ConfigPlugin<PluginConfigType> = (config, props) => {
27
+ if (props?.ios?.disableSPM === true) {
28
+ throw new Error(DISABLE_SPM_UNSUPPORTED);
29
+ }
30
+
32
31
  return withPodfile(config, config => {
33
- config.modResults.contents = setAppPodfileDisableSPM(
34
- config.modResults.contents,
35
- props?.ios?.disableSPM === true,
36
- );
32
+ // Strip a leftover DisableSPM flag from older prebuilds; never re-add it.
33
+ config.modResults.contents = setAppPodfileDisableSPM(config.modResults.contents, false);
37
34
 
38
35
  return config;
39
36
  });
@@ -4,8 +4,10 @@ export interface PluginConfigType {
4
4
 
5
5
  export interface PluginConfigTypeIos {
6
6
  /**
7
- * Sets `$RNFirebaseDisableSPM = true` in the Podfile, forcing Firebase
8
- * dependencies to be installed with CocoaPods instead of Swift Package Manager.
7
+ * @deprecated Firebase Apple SDK 13+ is SPM-only. Setting this to `true`
8
+ * fails Expo prebuild / `pod install` — CocoaPods no longer distributes Firebase.
9
+ * Remove this option and use `use_frameworks! :linkage => :dynamic` (via
10
+ * `expo-build-properties` `ios.useFrameworks: "dynamic"`).
9
11
  *
10
12
  * @platform ios iOS
11
13
  */
@@ -1,124 +0,0 @@
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 java.util.ArrayList;
21
- import java.util.HashMap;
22
- import java.util.List;
23
- import java.util.Map;
24
- import java.util.concurrent.ExecutorService;
25
- import java.util.concurrent.Executors;
26
- import java.util.concurrent.RejectedExecutionHandler;
27
- import java.util.concurrent.SynchronousQueue;
28
- import java.util.concurrent.ThreadPoolExecutor;
29
- import java.util.concurrent.TimeUnit;
30
-
31
- public class TaskExecutorService {
32
- private static final String MAXIMUM_POOL_SIZE_KEY = "android_task_executor_maximum_pool_size";
33
- private static final String KEEP_ALIVE_SECONDS_KEY = "android_task_executor_keep_alive_seconds";
34
-
35
- private final String name;
36
- private final int maximumPoolSize;
37
- private final int keepAliveSeconds;
38
- private static final Map<String, ExecutorService> executors = new HashMap<>();
39
-
40
- public TaskExecutorService(String name) {
41
- this.name = name;
42
- ReactNativeFirebaseJSON json = ReactNativeFirebaseJSON.getSharedInstance();
43
- this.maximumPoolSize = json.getIntValue(MAXIMUM_POOL_SIZE_KEY, 1);
44
- this.keepAliveSeconds = json.getIntValue(KEEP_ALIVE_SECONDS_KEY, 3);
45
- }
46
-
47
- public ExecutorService getExecutor() {
48
- boolean isTransactional = maximumPoolSize <= 1;
49
- return getExecutor(isTransactional, "");
50
- }
51
-
52
- public ExecutorService getTransactionalExecutor() {
53
- return getExecutor(true, "");
54
- }
55
-
56
- public ExecutorService getTransactionalExecutor(String identifier) {
57
- String executorIdentifier = maximumPoolSize != 0 ? identifier : "";
58
- return getExecutor(true, executorIdentifier);
59
- }
60
-
61
- public ExecutorService getExecutor(boolean isTransactional, String identifier) {
62
- String executorName = getExecutorName(isTransactional, identifier);
63
- synchronized (executors) {
64
- ExecutorService existingExecutor = executors.get(executorName);
65
- if (existingExecutor == null) {
66
- ExecutorService newExecutor = getNewExecutor(isTransactional);
67
- executors.put(executorName, newExecutor);
68
- return newExecutor;
69
- }
70
- return existingExecutor;
71
- }
72
- }
73
-
74
- private ExecutorService getNewExecutor(boolean isTransactional) {
75
- if (isTransactional) {
76
- return Executors.newSingleThreadExecutor();
77
- } else {
78
- ThreadPoolExecutor threadPoolExecutor =
79
- new ThreadPoolExecutor(
80
- 0, maximumPoolSize, keepAliveSeconds, TimeUnit.SECONDS, new SynchronousQueue<>());
81
- threadPoolExecutor.setRejectedExecutionHandler(executeInFallback);
82
- return threadPoolExecutor;
83
- }
84
- }
85
-
86
- private final RejectedExecutionHandler executeInFallback =
87
- (r, executor) -> {
88
- if (executor.isShutdown() || executor.isTerminated() || executor.isTerminating()) {
89
- return;
90
- }
91
- ExecutorService fallbackExecutor = getTransactionalExecutor();
92
- fallbackExecutor.execute(r);
93
- };
94
-
95
- public String getExecutorName(boolean isTransactional, String identifier) {
96
- if (isTransactional) {
97
- return name + "TransactionalExecutor" + identifier;
98
- }
99
- return name + "Executor" + identifier;
100
- }
101
-
102
- public void shutdown() {
103
- synchronized (executors) {
104
- List<String> existingExecutorNames = new ArrayList<>(executors.keySet());
105
- for (String executorName : existingExecutorNames) {
106
- if (!executorName.startsWith(name)) {
107
- executors.remove(executorName);
108
- } else {
109
- removeExecutor(executorName);
110
- }
111
- }
112
- }
113
- }
114
-
115
- public void removeExecutor(String executorName) {
116
- synchronized (executors) {
117
- ExecutorService existingExecutor = executors.get(executorName);
118
- if (existingExecutor != null) {
119
- existingExecutor.shutdownNow();
120
- executors.remove(executorName);
121
- }
122
- }
123
- }
124
- }
@@ -1,62 +0,0 @@
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 java.util.HashMap;
22
- import java.util.Map;
23
- import java.util.concurrent.ExecutorService;
24
- import javax.annotation.OverridingMethodsMustInvokeSuper;
25
-
26
- public class UniversalFirebaseModule {
27
- private final TaskExecutorService executorService;
28
-
29
- private final Context context;
30
- private final String serviceName;
31
-
32
- public UniversalFirebaseModule(Context context, String serviceName) {
33
- this.context = context;
34
- this.serviceName = serviceName;
35
- this.executorService = new TaskExecutorService(getName());
36
- }
37
-
38
- public Context getContext() {
39
- return context;
40
- }
41
-
42
- public Context getApplicationContext() {
43
- return getContext().getApplicationContext();
44
- }
45
-
46
- public ExecutorService getExecutor() {
47
- return executorService.getExecutor();
48
- }
49
-
50
- public String getName() {
51
- return "Universal" + serviceName + "Module";
52
- }
53
-
54
- @OverridingMethodsMustInvokeSuper
55
- public void onTearDown() {
56
- executorService.shutdown();
57
- }
58
-
59
- public Map<String, Object> getConstants() {
60
- return new HashMap<>();
61
- }
62
- }
@@ -1,91 +0,0 @@
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 io.invertase.firebase.app.ReactNativeFirebaseApp;
23
-
24
- public class UniversalFirebasePreferences {
25
- private static final String PREFERENCES_FILE = "io.invertase.firebase";
26
- private static UniversalFirebasePreferences sharedInstance = new UniversalFirebasePreferences();
27
- private SharedPreferences preferences;
28
-
29
- public static UniversalFirebasePreferences getSharedInstance() {
30
- return sharedInstance;
31
- }
32
-
33
- public boolean contains(String key) {
34
- return getPreferences().contains(key);
35
- }
36
-
37
- // Boolean
38
- public void setBooleanValue(String key, boolean value) {
39
- getPreferences().edit().putBoolean(key, value).apply();
40
- }
41
-
42
- public boolean getBooleanValue(String key, boolean defaultValue) {
43
- return getPreferences().getBoolean(key, defaultValue);
44
- }
45
-
46
- // Int
47
- public void setIntValue(String key, int value) {
48
- getPreferences().edit().putInt(key, value).apply();
49
- }
50
-
51
- public int getIntValue(String key, int defaultValue) {
52
- return getPreferences().getInt(key, defaultValue);
53
- }
54
-
55
- // Long
56
- public void setLongValue(String key, long value) {
57
- getPreferences().edit().putLong(key, value).apply();
58
- }
59
-
60
- public long getLongValue(String key, long defaultValue) {
61
- return getPreferences().getLong(key, defaultValue);
62
- }
63
-
64
- // String
65
- public void setStringValue(String key, String value) {
66
- getPreferences().edit().putString(key, value).apply();
67
- }
68
-
69
- public String getStringValue(String key, String defaultValue) {
70
- return getPreferences().getString(key, defaultValue);
71
- }
72
-
73
- public void clearAll() {
74
- getPreferences().edit().clear().apply();
75
- }
76
-
77
- // Note the caller is responsible for calling apply() or commit() on the
78
- // returned SharedPreferences.Editor object for the remove to take affect
79
- public SharedPreferences.Editor remove(String key) {
80
- return getPreferences().edit().remove(key);
81
- }
82
-
83
- private SharedPreferences getPreferences() {
84
- if (preferences == null) {
85
- preferences =
86
- ReactNativeFirebaseApp.getApplicationContext()
87
- .getSharedPreferences(PREFERENCES_FILE, Context.MODE_PRIVATE);
88
- }
89
- return preferences;
90
- }
91
- }
@@ -1,222 +0,0 @@
1
- package io.invertase.firebase.app;
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.util.Log;
21
- import com.facebook.fbreact.specs.NativeRNFBTurboAppSpec;
22
- import com.facebook.react.bridge.LifecycleEventListener;
23
- import com.facebook.react.bridge.Promise;
24
- import com.facebook.react.bridge.ReactApplicationContext;
25
- import com.facebook.react.bridge.ReadableMap;
26
- import com.facebook.react.bridge.WritableMap;
27
- import com.google.firebase.FirebaseApp;
28
- import io.invertase.firebase.common.RCTConvertFirebase;
29
- import io.invertase.firebase.common.ReactNativeFirebaseEvent;
30
- import io.invertase.firebase.common.ReactNativeFirebaseEventEmitter;
31
- import io.invertase.firebase.common.ReactNativeFirebaseJSON;
32
- import io.invertase.firebase.common.ReactNativeFirebaseMeta;
33
- import io.invertase.firebase.common.ReactNativeFirebasePreferences;
34
- import java.util.ArrayList;
35
- import java.util.HashMap;
36
- import java.util.List;
37
- import java.util.Map;
38
-
39
- public class NativeRNFBTurboApp extends NativeRNFBTurboAppSpec implements LifecycleEventListener {
40
- private static final String TAG = "App";
41
-
42
- public static Map<String, String> authDomains = new HashMap<>();
43
-
44
- NativeRNFBTurboApp(ReactApplicationContext reactContext) {
45
- super(reactContext);
46
- }
47
-
48
- @Override
49
- public void initialize() {
50
- super.initialize();
51
- ReactApplicationContext reactContext = getReactApplicationContext();
52
- // Register unconditionally. When the host is already RESUMED, addLifecycleEventListener
53
- // posts onHostResume onto the UI queue asynchronously (it is not a synchronous call), so
54
- // the explicit attach below is the primary path; resume remains best-effort convergence
55
- // for later host flips. Stale-generation attaches are rejected or held pending by
56
- // attachReactContext's fail-closed current-context arbitration.
57
- reactContext.addLifecycleEventListener(this);
58
- ReactNativeFirebaseEventEmitter.getSharedInstance().attachReactContext(reactContext);
59
- }
60
-
61
- @Override
62
- public void invalidate() {
63
- ReactApplicationContext reactContext = getReactApplicationContext();
64
- reactContext.removeLifecycleEventListener(this);
65
- // Identity-guarded inside the emitter: only clears state belonging to this dying context,
66
- // never state a replacement runtime has already installed.
67
- ReactNativeFirebaseEventEmitter.getSharedInstance().detachReactContext(reactContext);
68
- super.invalidate();
69
- }
70
-
71
- @Override
72
- public void onHostResume() {
73
- // Re-attaching also flushes any events queued while no runtime was able to receive them.
74
- ReactNativeFirebaseEventEmitter.getSharedInstance()
75
- .attachReactContext(getReactApplicationContext());
76
- }
77
-
78
- @Override
79
- public void onHostPause() {
80
- // no-op, required by LifecycleEventListener
81
- }
82
-
83
- @Override
84
- public void onHostDestroy() {
85
- // no-op, required by LifecycleEventListener
86
- }
87
-
88
- @Override
89
- protected Map<String, Object> getTypedExportedConstants() {
90
- Map<String, Object> constants = new HashMap<>();
91
- List<Map<String, Object>> appsList = new ArrayList<>();
92
- List<FirebaseApp> firebaseApps = FirebaseApp.getApps(getReactApplicationContext());
93
-
94
- for (FirebaseApp app : firebaseApps) {
95
- appsList.add(RCTConvertFirebase.firebaseAppToMap(app));
96
- }
97
-
98
- constants.put("NATIVE_FIREBASE_APPS", appsList);
99
- constants.put("FIREBASE_RAW_JSON", ReactNativeFirebaseJSON.getSharedInstance().getRawJSON());
100
-
101
- return constants;
102
- }
103
-
104
- @Override
105
- public void initializeApp(ReadableMap options, ReadableMap appConfig, Promise promise) {
106
- FirebaseApp firebaseApp =
107
- RCTConvertFirebase.readableMapToFirebaseApp(
108
- options, appConfig, getReactApplicationContext());
109
- NativeRNFBTurboApp.configureAuthDomain(
110
- appConfig.getString("name"), options.getString("authDomain"));
111
-
112
- WritableMap firebaseAppMap = RCTConvertFirebase.firebaseAppToWritableMap(firebaseApp);
113
- promise.resolve(firebaseAppMap);
114
- }
115
-
116
- public static void configureAuthDomain(String name, String authDomain) {
117
- if (authDomain != null) {
118
- Log.d(TAG, name + " custom authDomain " + authDomain);
119
- authDomains.put(name, authDomain);
120
- } else {
121
- authDomains.remove(name);
122
- }
123
- }
124
-
125
- @Override
126
- public void setAutomaticDataCollectionEnabled(String appName, boolean enabled) {
127
- FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
128
- firebaseApp.setDataCollectionDefaultEnabled(enabled);
129
- }
130
-
131
- @Override
132
- public void deleteApp(String appName, Promise promise) {
133
- FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
134
-
135
- if (firebaseApp != null) {
136
- firebaseApp.delete();
137
- }
138
-
139
- promise.resolve(null);
140
- }
141
-
142
- @Override
143
- public void eventsNotifyReady(boolean ready) {
144
- ReactNativeFirebaseEventEmitter emitter = ReactNativeFirebaseEventEmitter.getSharedInstance();
145
- emitter.notifyJsReady(ready);
146
- }
147
-
148
- @Override
149
- public void eventsGetListeners(Promise promise) {
150
- ReactNativeFirebaseEventEmitter emitter = ReactNativeFirebaseEventEmitter.getSharedInstance();
151
- promise.resolve(emitter.getListenersMap());
152
- }
153
-
154
- @Override
155
- public void eventsPing(String eventName, ReadableMap eventBody, Promise promise) {
156
- ReactNativeFirebaseEventEmitter emitter = ReactNativeFirebaseEventEmitter.getSharedInstance();
157
- emitter.sendEvent(
158
- new ReactNativeFirebaseEvent(
159
- eventName, RCTConvertFirebase.readableMapToWritableMap(eventBody)));
160
- promise.resolve(RCTConvertFirebase.readableMapToWritableMap(eventBody));
161
- }
162
-
163
- @Override
164
- public void eventsAddListener(String eventName) {
165
- ReactNativeFirebaseEventEmitter emitter = ReactNativeFirebaseEventEmitter.getSharedInstance();
166
- emitter.addListener(eventName);
167
- }
168
-
169
- @Override
170
- public void eventsRemoveListener(String eventName, boolean all) {
171
- ReactNativeFirebaseEventEmitter emitter = ReactNativeFirebaseEventEmitter.getSharedInstance();
172
- emitter.removeListener(eventName, all);
173
- }
174
-
175
- @Override
176
- public void addListener(String eventName) {
177
- // Keep: Required for RN built in Event Emitter Calls.
178
- }
179
-
180
- @Override
181
- public void removeListeners(double count) {
182
- // Keep: Required for RN built in Event Emitter Calls.
183
- }
184
-
185
- @Override
186
- public void metaGetAll(Promise promise) {
187
- promise.resolve(ReactNativeFirebaseMeta.getSharedInstance().getAll());
188
- }
189
-
190
- @Override
191
- public void jsonGetAll(Promise promise) {
192
- promise.resolve(ReactNativeFirebaseJSON.getSharedInstance().getAll());
193
- }
194
-
195
- @Override
196
- public void preferencesSetBool(String key, boolean value, Promise promise) {
197
- ReactNativeFirebasePreferences.getSharedInstance().setBooleanValue(key, value);
198
- promise.resolve(null);
199
- }
200
-
201
- @Override
202
- public void preferencesSetString(String key, String value, Promise promise) {
203
- ReactNativeFirebasePreferences.getSharedInstance().setStringValue(key, value);
204
- promise.resolve(null);
205
- }
206
-
207
- @Override
208
- public void preferencesGetAll(Promise promise) {
209
- promise.resolve(ReactNativeFirebasePreferences.getSharedInstance().getAll());
210
- }
211
-
212
- @Override
213
- public void preferencesClearAll(Promise promise) {
214
- ReactNativeFirebasePreferences.getSharedInstance().clearAll();
215
- promise.resolve(null);
216
- }
217
-
218
- @Override
219
- public void setLogLevel(String logLevel) {
220
- // Android uses Firebase SDK log level via manifest; no-op at runtime.
221
- }
222
- }