@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,451 @@
|
|
|
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
|
+
import android.annotation.SuppressLint
|
|
20
|
+
import android.app.ActivityManager
|
|
21
|
+
import android.content.Context
|
|
22
|
+
import android.graphics.Point
|
|
23
|
+
import android.graphics.Rect
|
|
24
|
+
import android.net.Uri
|
|
25
|
+
import android.os.Build
|
|
26
|
+
import android.util.Log
|
|
27
|
+
import com.facebook.react.bridge.Arguments
|
|
28
|
+
import com.facebook.react.bridge.ReactContext
|
|
29
|
+
import com.facebook.react.bridge.ReadableMap
|
|
30
|
+
import com.facebook.react.bridge.WritableArray
|
|
31
|
+
import com.facebook.react.bridge.WritableMap
|
|
32
|
+
import com.facebook.react.common.LifecycleState
|
|
33
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
34
|
+
import org.json.JSONArray
|
|
35
|
+
import org.json.JSONException
|
|
36
|
+
import org.json.JSONObject
|
|
37
|
+
import java.io.File
|
|
38
|
+
import java.text.SimpleDateFormat
|
|
39
|
+
import java.util.Locale
|
|
40
|
+
import java.util.TimeZone
|
|
41
|
+
import javax.annotation.Nullable
|
|
42
|
+
|
|
43
|
+
@Suppress("unused", "KDocUnresolvedReference", "MemberVisibilityCanBePrivate", "PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
|
44
|
+
@SuppressLint("KotlinNullnessAnnotation")
|
|
45
|
+
open class SharedUtils {
|
|
46
|
+
companion object {
|
|
47
|
+
private const val TAG = "Utils"
|
|
48
|
+
private const val RN_DEVSUPPORT_CLASS = "DevSupportManagerImpl"
|
|
49
|
+
private const val RN_DEVSUPPORT_PACKAGE = "com.facebook.react.devsupport"
|
|
50
|
+
|
|
51
|
+
private const val EXPO_REGISTRY_CLASS = "ModuleRegistry"
|
|
52
|
+
private const val EXPO_CORE_PACKAGE = "expo.core"
|
|
53
|
+
|
|
54
|
+
private const val FLUTTER_REGISTRY_CLASS = "PluginRegistry"
|
|
55
|
+
private const val FLUTTER_CORE_PACKAGE = "io.flutter.plugin.common"
|
|
56
|
+
|
|
57
|
+
private const val REACT_NATIVE_REGISTRY_CLASS = "NativeModuleRegistry"
|
|
58
|
+
private const val REACT_NATIVE_CORE_PACKAGE = "com.facebook.react.bridge"
|
|
59
|
+
|
|
60
|
+
@JvmStatic
|
|
61
|
+
fun rectToIntArray(
|
|
62
|
+
@Nullable rect: Rect?,
|
|
63
|
+
): IntArray {
|
|
64
|
+
if (rect == null || rect.isEmpty) return intArrayOf()
|
|
65
|
+
return intArrayOf(rect.left, rect.top, rect.right, rect.bottom)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@JvmStatic
|
|
69
|
+
fun pointToIntArray(
|
|
70
|
+
@Nullable point: Point?,
|
|
71
|
+
): IntArray {
|
|
72
|
+
if (point == null) return intArrayOf()
|
|
73
|
+
return intArrayOf(point.x, point.y)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@JvmStatic
|
|
77
|
+
fun pointsToIntsList(
|
|
78
|
+
@Nullable points: Array<Point?>?,
|
|
79
|
+
): List<IntArray> {
|
|
80
|
+
if (points == null) return ArrayList()
|
|
81
|
+
|
|
82
|
+
val pointsList = ArrayList<IntArray>(points.size)
|
|
83
|
+
for (point in points) {
|
|
84
|
+
pointsList.add(pointToIntArray(point))
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return pointsList
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Create a Uri from the path, defaulting to file when there is no supplied scheme. */
|
|
91
|
+
@JvmStatic
|
|
92
|
+
fun getUri(uri: String?): Uri {
|
|
93
|
+
val parsed = Uri.parse(uri)
|
|
94
|
+
|
|
95
|
+
if (parsed.scheme == null || platform(parsed.scheme).isEmpty()) {
|
|
96
|
+
return Uri.fromFile(File(platform(uri)))
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return parsed
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@JvmStatic
|
|
103
|
+
fun getExceptionMap(exception: Exception?): WritableMap {
|
|
104
|
+
val source: Exception = platform(exception)
|
|
105
|
+
val exceptionMap = Arguments.createMap()
|
|
106
|
+
val code = "unknown"
|
|
107
|
+
val message = source.message
|
|
108
|
+
exceptionMap.putString("code", code)
|
|
109
|
+
exceptionMap.putString("nativeErrorCode", code)
|
|
110
|
+
exceptionMap.putString("message", message)
|
|
111
|
+
exceptionMap.putString("nativeErrorMessage", message)
|
|
112
|
+
return exceptionMap
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@JvmStatic
|
|
116
|
+
fun timestampToUTC(timestamp: Long): String {
|
|
117
|
+
val millisTimestamp = timestamp * 1000
|
|
118
|
+
val format = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.ROOT)
|
|
119
|
+
format.timeZone = TimeZone.getTimeZone("UTC")
|
|
120
|
+
return format.format(millisTimestamp)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Send a JS event. */
|
|
124
|
+
@JvmStatic
|
|
125
|
+
fun sendEvent(
|
|
126
|
+
context: ReactContext?,
|
|
127
|
+
eventName: String?,
|
|
128
|
+
body: Any?,
|
|
129
|
+
) {
|
|
130
|
+
if (context != null) {
|
|
131
|
+
context
|
|
132
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
133
|
+
.emit(platform(eventName), body)
|
|
134
|
+
} else {
|
|
135
|
+
Log.d(TAG, "Missing context - cannot send event!")
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* We need to check if app is in foreground otherwise the app will crash.
|
|
141
|
+
* http://stackoverflow.com/questions/8489993/check-android-application-is-in-foreground-or-not
|
|
142
|
+
*
|
|
143
|
+
* @param context Context
|
|
144
|
+
* @return boolean
|
|
145
|
+
*/
|
|
146
|
+
@JvmStatic
|
|
147
|
+
fun isAppInForeground(context: Context?): Boolean {
|
|
148
|
+
val sourceContext: Context = platform(context)
|
|
149
|
+
val activityManager =
|
|
150
|
+
sourceContext.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager?
|
|
151
|
+
?: return false
|
|
152
|
+
|
|
153
|
+
val appProcesses = activityManager.runningAppProcesses ?: return false
|
|
154
|
+
|
|
155
|
+
// Check if current activity is a background activity.
|
|
156
|
+
val json = ReactNativeFirebaseJSON.getSharedInstance()
|
|
157
|
+
if (json.contains("android_background_activity_names")) {
|
|
158
|
+
val backgroundActivities = json.getArrayValue("android_background_activity_names")
|
|
159
|
+
|
|
160
|
+
if (backgroundActivities.size != 0) {
|
|
161
|
+
var currentActivity = ""
|
|
162
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
163
|
+
val taskInfo = activityManager.appTasks
|
|
164
|
+
if (taskInfo.size > 0) {
|
|
165
|
+
// SDK 37+ annotates RecentTaskInfo as nullable; skip rather than NPE.
|
|
166
|
+
val task = taskInfo[0].taskInfo
|
|
167
|
+
if (task != null) {
|
|
168
|
+
currentActivity =
|
|
169
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
170
|
+
val baseActivity = task.baseActivity
|
|
171
|
+
if (baseActivity != null) platform(baseActivity).shortClassName else ""
|
|
172
|
+
} else {
|
|
173
|
+
val origActivity = task.origActivity
|
|
174
|
+
if (origActivity != null) {
|
|
175
|
+
platform(origActivity).shortClassName
|
|
176
|
+
} else {
|
|
177
|
+
val component = task.baseIntent.component
|
|
178
|
+
platform(component).shortClassName
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
} else {
|
|
184
|
+
val taskInfo = activityManager.getRunningTasks(1)
|
|
185
|
+
if (taskInfo.size > 0) {
|
|
186
|
+
currentActivity = platform(taskInfo[0].topActivity).shortClassName
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (currentActivity != "" && backgroundActivities.contains(currentActivity)) {
|
|
191
|
+
return false
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
val packageName = sourceContext.packageName
|
|
197
|
+
for (appProcess in appProcesses) {
|
|
198
|
+
if (
|
|
199
|
+
appProcess.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND &&
|
|
200
|
+
appProcess.processName.equals(packageName)
|
|
201
|
+
) {
|
|
202
|
+
val reactContext: ReactContext
|
|
203
|
+
|
|
204
|
+
try {
|
|
205
|
+
reactContext = sourceContext as ReactContext
|
|
206
|
+
} catch (_: ClassCastException) {
|
|
207
|
+
// Not react context so default to true.
|
|
208
|
+
return true
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return reactContext.lifecycleState == LifecycleState.RESUMED
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return false
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
@SuppressLint("DiscouragedApi")
|
|
219
|
+
@JvmStatic
|
|
220
|
+
fun getResId(
|
|
221
|
+
ctx: Context?,
|
|
222
|
+
resName: String?,
|
|
223
|
+
): Int {
|
|
224
|
+
val sourceContext: Context = platform(ctx)
|
|
225
|
+
val resourceId =
|
|
226
|
+
sourceContext.resources.getIdentifier(resName, "string", sourceContext.packageName)
|
|
227
|
+
|
|
228
|
+
if (resourceId == 0) {
|
|
229
|
+
Log.e(TAG, "resource $resName could not be found")
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return resourceId
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Checks for dev support availability - so we can ignore in release builds for example.
|
|
237
|
+
*
|
|
238
|
+
* @return Boolean
|
|
239
|
+
*/
|
|
240
|
+
@JvmStatic
|
|
241
|
+
fun reactNativeHasDevSupport(): java.lang.Boolean = hasPackageClass(RN_DEVSUPPORT_PACKAGE, RN_DEVSUPPORT_CLASS)
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Is the build platform Expo?
|
|
245
|
+
*
|
|
246
|
+
* @return Boolean
|
|
247
|
+
*/
|
|
248
|
+
@JvmStatic
|
|
249
|
+
fun isExpo(): java.lang.Boolean = hasPackageClass(EXPO_CORE_PACKAGE, EXPO_REGISTRY_CLASS)
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Is the build platform Flutter?
|
|
253
|
+
*
|
|
254
|
+
* @return Boolean
|
|
255
|
+
*/
|
|
256
|
+
@JvmStatic
|
|
257
|
+
fun isFlutter(): java.lang.Boolean = hasPackageClass(FLUTTER_CORE_PACKAGE, FLUTTER_REGISTRY_CLASS)
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Is the build platform React Native?
|
|
261
|
+
*
|
|
262
|
+
* @return Boolean
|
|
263
|
+
*/
|
|
264
|
+
@JvmStatic
|
|
265
|
+
fun isReactNative(): java.lang.Boolean =
|
|
266
|
+
(
|
|
267
|
+
java.lang.Boolean.valueOf(
|
|
268
|
+
!isExpo().booleanValue() &&
|
|
269
|
+
hasPackageClass(REACT_NATIVE_CORE_PACKAGE, REACT_NATIVE_REGISTRY_CLASS).booleanValue(),
|
|
270
|
+
) as java.lang.Boolean
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Returns true/false if a class for a package exists in the app class bundle.
|
|
275
|
+
*
|
|
276
|
+
* @param packageName
|
|
277
|
+
* @param className
|
|
278
|
+
* @return
|
|
279
|
+
*/
|
|
280
|
+
@Suppress("ReplaceStringBuilderWithString")
|
|
281
|
+
@JvmStatic
|
|
282
|
+
fun hasPackageClass(
|
|
283
|
+
packageName: String?,
|
|
284
|
+
className: String?,
|
|
285
|
+
): java.lang.Boolean {
|
|
286
|
+
// ProGuard is surprisingly smart in this case and will keep a class if it detects a call to
|
|
287
|
+
// Class.forName() with a static string. Generate a quasi-dynamic string to confuse it.
|
|
288
|
+
val fullName =
|
|
289
|
+
java.lang
|
|
290
|
+
.StringBuilder(platform(packageName))
|
|
291
|
+
.append(".")
|
|
292
|
+
.append(className)
|
|
293
|
+
.toString()
|
|
294
|
+
|
|
295
|
+
return try {
|
|
296
|
+
Class.forName(fullName)
|
|
297
|
+
java.lang.Boolean.TRUE as java.lang.Boolean
|
|
298
|
+
} catch (_: Exception) {
|
|
299
|
+
java.lang.Boolean.FALSE as java.lang.Boolean
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
@Throws(JSONException::class)
|
|
304
|
+
@JvmStatic
|
|
305
|
+
fun jsonObjectToWritableMap(jsonObject: JSONObject?): WritableMap {
|
|
306
|
+
val source: JSONObject = platform(jsonObject)
|
|
307
|
+
val iterator = source.keys()
|
|
308
|
+
val writableMap = Arguments.createMap()
|
|
309
|
+
|
|
310
|
+
while (iterator.hasNext()) {
|
|
311
|
+
val key = iterator.next()
|
|
312
|
+
val value = source.get(key)
|
|
313
|
+
when {
|
|
314
|
+
value is Float || value is Double -> writableMap.putDouble(key, source.getDouble(key))
|
|
315
|
+
value is Number -> writableMap.putInt(key, source.getInt(key))
|
|
316
|
+
value is String -> writableMap.putString(key, source.getString(key))
|
|
317
|
+
value is JSONObject -> writableMap.putMap(key, jsonObjectToWritableMap(source.getJSONObject(key)))
|
|
318
|
+
value is JSONArray -> writableMap.putArray(key, jsonArrayToWritableArray(source.getJSONArray(key)))
|
|
319
|
+
value === JSONObject.NULL -> writableMap.putNull(key)
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
return writableMap
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
@Throws(JSONException::class)
|
|
327
|
+
@JvmStatic
|
|
328
|
+
fun jsonArrayToWritableArray(jsonArray: JSONArray?): WritableArray {
|
|
329
|
+
val source: JSONArray = platform(jsonArray)
|
|
330
|
+
val writableArray = Arguments.createArray()
|
|
331
|
+
|
|
332
|
+
for (index in 0 until source.length()) {
|
|
333
|
+
val value = source.get(index)
|
|
334
|
+
when {
|
|
335
|
+
value is Float || value is Double -> writableArray.pushDouble(source.getDouble(index))
|
|
336
|
+
value is Number -> writableArray.pushInt(source.getInt(index))
|
|
337
|
+
value is String -> writableArray.pushString(source.getString(index))
|
|
338
|
+
value is JSONObject -> writableArray.pushMap(jsonObjectToWritableMap(source.getJSONObject(index)))
|
|
339
|
+
value is JSONArray -> writableArray.pushArray(jsonArrayToWritableArray(source.getJSONArray(index)))
|
|
340
|
+
value === JSONObject.NULL -> writableArray.pushNull()
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return writableArray
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
@JvmStatic
|
|
347
|
+
fun mapToWritableMap(value: Map<String, @JvmSuppressWildcards Any?>?): WritableMap {
|
|
348
|
+
val source: Map<String, @JvmSuppressWildcards Any?> = platform(value)
|
|
349
|
+
val writableMap = Arguments.createMap()
|
|
350
|
+
|
|
351
|
+
for ((key, entryValue) in source) {
|
|
352
|
+
mapPutValue(key, entryValue, writableMap)
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
return writableMap
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
private fun listToWritableArray(objects: List<Any?>?): WritableArray {
|
|
359
|
+
val source: List<Any?> = platform(objects)
|
|
360
|
+
val writableArray = Arguments.createArray()
|
|
361
|
+
for (value in source) {
|
|
362
|
+
arrayPushValue(value, writableArray)
|
|
363
|
+
}
|
|
364
|
+
return writableArray
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
@Suppress("UNCHECKED_CAST")
|
|
368
|
+
@JvmStatic
|
|
369
|
+
fun arrayPushValue(
|
|
370
|
+
@Nullable value: Any?,
|
|
371
|
+
array: WritableArray?,
|
|
372
|
+
) {
|
|
373
|
+
val target: WritableArray = platform(array)
|
|
374
|
+
if (value == null || value === JSONObject.NULL) {
|
|
375
|
+
target.pushNull()
|
|
376
|
+
return
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
val type = value.javaClass.name
|
|
380
|
+
when (type) {
|
|
381
|
+
"java.lang.Boolean" -> target.pushBoolean(value as Boolean)
|
|
382
|
+
"java.lang.Long" -> target.pushDouble((value as Long).toDouble())
|
|
383
|
+
"java.lang.Float" -> target.pushDouble((value as Float).toDouble())
|
|
384
|
+
"java.lang.Double" -> target.pushDouble(value as Double)
|
|
385
|
+
"java.lang.Integer" -> target.pushInt(value as Int)
|
|
386
|
+
"java.lang.String" -> target.pushString(value as String)
|
|
387
|
+
else -> {
|
|
388
|
+
if (List::class.java.isAssignableFrom(value.javaClass)) {
|
|
389
|
+
target.pushArray(listToWritableArray(value as List<Any?>))
|
|
390
|
+
} else if (Map::class.java.isAssignableFrom(value.javaClass)) {
|
|
391
|
+
target.pushMap(mapToWritableMap(value as Map<String, Any?>))
|
|
392
|
+
} else {
|
|
393
|
+
Log.d(TAG, "utils:arrayPushValue:unknownType:$type")
|
|
394
|
+
target.pushNull()
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
@Suppress("UNCHECKED_CAST")
|
|
401
|
+
@JvmStatic
|
|
402
|
+
fun mapPutValue(
|
|
403
|
+
key: String?,
|
|
404
|
+
@Nullable value: Any?,
|
|
405
|
+
map: WritableMap?,
|
|
406
|
+
) {
|
|
407
|
+
val target: WritableMap = platform(map)
|
|
408
|
+
val targetKey: String = platform(key)
|
|
409
|
+
if (value == null || value === JSONObject.NULL) {
|
|
410
|
+
target.putNull(targetKey)
|
|
411
|
+
return
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
val type = value.javaClass.name
|
|
415
|
+
when (type) {
|
|
416
|
+
"java.lang.Boolean" -> target.putBoolean(targetKey, value as Boolean)
|
|
417
|
+
"java.lang.Long" -> target.putDouble(targetKey, (value as Long).toDouble())
|
|
418
|
+
"java.lang.Float" -> target.putDouble(targetKey, (value as Float).toDouble())
|
|
419
|
+
"java.lang.Double" -> target.putDouble(targetKey, value as Double)
|
|
420
|
+
"java.lang.Integer" -> target.putInt(targetKey, value as Int)
|
|
421
|
+
"java.lang.String" -> target.putString(targetKey, value as String)
|
|
422
|
+
else -> {
|
|
423
|
+
if (List::class.java.isAssignableFrom(value.javaClass)) {
|
|
424
|
+
target.putArray(targetKey, listToWritableArray(value as List<Any?>))
|
|
425
|
+
} else if (Map::class.java.isAssignableFrom(value.javaClass)) {
|
|
426
|
+
target.putMap(targetKey, mapToWritableMap(value as Map<String, Any?>))
|
|
427
|
+
} else {
|
|
428
|
+
Log.d(TAG, "utils:mapPutValue:unknownType:$type")
|
|
429
|
+
target.putNull(targetKey)
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Convert a ReadableMap to a WritableMap for the purposes of re-sending back to JS.
|
|
437
|
+
*
|
|
438
|
+
* @param map ReadableMap
|
|
439
|
+
* @return WritableMap
|
|
440
|
+
*/
|
|
441
|
+
@JvmStatic
|
|
442
|
+
fun readableMapToWritableMap(map: ReadableMap?): WritableMap {
|
|
443
|
+
val writableMap = Arguments.createMap()
|
|
444
|
+
writableMap.merge(platform(map))
|
|
445
|
+
return writableMap
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
@Suppress("UNCHECKED_CAST")
|
|
449
|
+
private fun <T> platform(value: T?): T = value as T
|
|
450
|
+
}
|
|
451
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package io.invertase.firebase.interfaces
|
|
1
|
+
package io.invertase.firebase.interfaces
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
@@ -17,14 +17,14 @@ package io.invertase.firebase.interfaces;
|
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import android.app.Activity
|
|
21
|
-
import android.content.Context
|
|
22
|
-
import com.facebook.react.bridge.ReactContext
|
|
20
|
+
import android.app.Activity
|
|
21
|
+
import android.content.Context
|
|
22
|
+
import com.facebook.react.bridge.ReactContext
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
interface ContextProvider {
|
|
25
|
+
fun getActivity(): Activity?
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
fun getContext(): ReactContext?
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
fun getApplicationContext(): Context?
|
|
30
30
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package io.invertase.firebase.interfaces
|
|
1
|
+
package io.invertase.firebase.interfaces
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
@@ -17,16 +17,16 @@ package io.invertase.firebase.interfaces;
|
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import com.facebook.react.bridge.WritableMap
|
|
20
|
+
import com.facebook.react.bridge.WritableMap
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
interface NativeError {
|
|
23
|
+
fun getErrorCode(): String?
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
fun getErrorMessage(): String?
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
fun getFirebaseAppName(): String?
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
fun getFirebaseServiceName(): String?
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
fun getUserInfo(): WritableMap?
|
|
32
32
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package io.invertase.firebase.interfaces
|
|
1
|
+
package io.invertase.firebase.interfaces
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
@@ -17,12 +17,12 @@ package io.invertase.firebase.interfaces;
|
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import com.facebook.react.bridge.WritableMap
|
|
20
|
+
import com.facebook.react.bridge.WritableMap
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
interface NativeEvent {
|
|
23
|
+
fun getEventName(): String
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
fun getEventBody(): WritableMap
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
fun getFirebaseAppName(): String?
|
|
28
28
|
}
|