@metarouter/react-native-sdk 0.1.16 → 0.1.17
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/README.md +49 -22
- package/lib/MetaRouter.d.ts +2 -24
- package/lib/MetaRouter.d.ts.map +1 -1
- package/lib/MetaRouter.js +5 -52
- package/lib/analytics/IdentityManager.d.ts +14 -0
- package/lib/analytics/IdentityManager.d.ts.map +1 -0
- package/lib/analytics/IdentityManager.js +38 -0
- package/lib/analytics/MetaRouterAnalyticsClient.d.ts +45 -0
- package/lib/analytics/MetaRouterAnalyticsClient.d.ts.map +1 -0
- package/lib/analytics/MetaRouterAnalyticsClient.js +127 -0
- package/lib/analytics/enrichEvent.d.ts +3 -0
- package/lib/analytics/enrichEvent.d.ts.map +1 -0
- package/lib/analytics/enrichEvent.js +14 -0
- package/lib/analytics/init.d.ts +5 -0
- package/lib/analytics/init.d.ts.map +1 -0
- package/lib/analytics/init.js +32 -0
- package/lib/analytics/proxy/proxyClient.d.ts +4 -0
- package/lib/analytics/proxy/proxyClient.d.ts.map +1 -0
- package/lib/{proxyClient.js → analytics/proxy/proxyClient.js} +3 -4
- package/lib/analytics/types.d.ts +52 -0
- package/lib/analytics/types.d.ts.map +1 -0
- package/lib/analytics/types.js +1 -0
- package/lib/analytics/utils/anonymousId.d.ts +2 -0
- package/lib/analytics/utils/anonymousId.d.ts.map +1 -0
- package/lib/analytics/utils/anonymousId.js +11 -0
- package/lib/analytics/utils/contextInfo.d.ts +19 -0
- package/lib/analytics/utils/contextInfo.d.ts.map +1 -0
- package/lib/analytics/utils/contextInfo.js +35 -0
- package/lib/analytics/utils/logger.d.ts +4 -0
- package/lib/analytics/utils/logger.d.ts.map +1 -0
- package/lib/analytics/utils/logger.js +12 -0
- package/lib/analytics/utils/retry.d.ts +2 -0
- package/lib/analytics/utils/retry.d.ts.map +1 -0
- package/lib/analytics/utils/retry.js +17 -0
- package/lib/analytics/utils/timezone.d.ts +2 -0
- package/lib/analytics/utils/timezone.d.ts.map +1 -0
- package/lib/analytics/utils/timezone.js +8 -0
- package/lib/index.d.ts +6 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -2
- package/lib/react/context.d.ts +9 -0
- package/lib/react/context.d.ts.map +1 -0
- package/lib/react/context.js +12 -0
- package/lib/react/useMetaRouter.d.ts +3 -0
- package/lib/react/useMetaRouter.d.ts.map +1 -0
- package/lib/react/useMetaRouter.js +8 -0
- package/lib/types.d.ts +9 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +1 -0
- package/package.json +11 -12
- package/MetaRouterReactNativeSDK.podspec +0 -26
- package/android/build/generated/ksp/debug/java/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl.java +0 -244
- package/android/build/generated/ksp/debug/java/com/reactnativecommunity/asyncstorage/next/StorageDb_Impl.java +0 -165
- package/android/build/generated/source/buildConfig/debug/com/metarouter/reactnativesdk/BuildConfig.java +0 -10
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +0 -7
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +0 -18
- package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +0 -6
- package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +0 -1
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -1
- package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/metarouter/reactnativesdk/BuildConfig.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/metarouter/reactnativesdk/MetaRouterReactNativeSDKPackage.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncLocalStorageUtil.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageErrorUtil.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageExpoMigration.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule$1.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule$2.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule$3.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule$4.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule$5.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule$6.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStoragePackage$1.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/BuildConfig.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/NativeAsyncStorageModuleSpec.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/ReactDatabaseSupplier.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/SerialExecutor$1.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/SerialExecutor.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$1.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$2.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$3.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$4.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$5.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$6.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$7.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDb_Impl$1.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDb_Impl.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/linusu/RNGetRandomValuesModule.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/linusu/RNGetRandomValuesPackage.class +0 -0
- package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +0 -2
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +0 -7
- package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +0 -7
- package/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +0 -1
- package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +0 -1
- package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +0 -1
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +0 -2
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -16
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build/tmp/kotlin-classes/debug/META-INF/metarouter_react-native-sdk_debug.kotlin_module +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/ArgumentHelpersKt.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/AsyncStorageAccess.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/AsyncStorageError$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/AsyncStorageError.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/Entry.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/ErrorHelpersKt$createExceptionHandler$$inlined$CoroutineExceptionHandler$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/ErrorHelpersKt.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/MIGRATION_TO_NEXT.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageDao$DefaultImpls.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageDao$mergeValues$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageDao.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageDb$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageDb.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$clear$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$getAllKeys$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$multiGet$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$multiMerge$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$multiRemove$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$multiSet$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageSupplier$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageSupplier.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageSupplierKt.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/segmentanalyticsreactnative/AnalyticsReactNativeModule$onInitialized$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/segmentanalyticsreactnative/AnalyticsReactNativeModule$toHexString$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/segmentanalyticsreactnative/AnalyticsReactNativeModule.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/segmentanalyticsreactnative/AnalyticsReactNativePackage$createNativeModules$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/segmentanalyticsreactnative/AnalyticsReactNativePackage.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/segmentanalyticsreactnative/ConnectionType.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/sovranreactnative/Sovran$Action.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/sovranreactnative/Sovran$createNativeModules$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/sovranreactnative/Sovran.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/sovranreactnative/SovranModule$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/sovranreactnative/SovranModule$onInitialized$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/sovranreactnative/SovranModule.class +0 -0
- package/android/build.gradle +0 -55
- package/android/consumer-rules.pro +0 -0
- package/android/src/main/java/com/metarouter/reactnativesdk/MetaRouterReactNativeSDKPackage.java +0 -54
- package/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncLocalStorageUtil.java +0 -178
- package/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageErrorUtil.java +0 -45
- package/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageExpoMigration.java +0 -154
- package/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java +0 -410
- package/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java +0 -93
- package/android/src/main/java/com/reactnativecommunity/asyncstorage/BuildConfig.java +0 -8
- package/android/src/main/java/com/reactnativecommunity/asyncstorage/NativeAsyncStorageModuleSpec.java +0 -47
- package/android/src/main/java/com/reactnativecommunity/asyncstorage/ReactDatabaseSupplier.java +0 -163
- package/android/src/main/java/com/reactnativecommunity/asyncstorage/SerialExecutor.java +0 -40
- package/android/src/main/java/com/reactnativecommunity/asyncstorage/build.gradle +0 -122
- package/android/src/main/java/com/reactnativecommunity/asyncstorage/config.gradle +0 -125
- package/android/src/main/java/com/reactnativecommunity/asyncstorage/next/ArgumentHelpers.kt +0 -86
- package/android/src/main/java/com/reactnativecommunity/asyncstorage/next/ErrorHelpers.kt +0 -39
- package/android/src/main/java/com/reactnativecommunity/asyncstorage/next/StorageModule.kt +0 -94
- package/android/src/main/java/com/reactnativecommunity/asyncstorage/next/StorageSupplier.kt +0 -161
- package/android/src/main/java/com/segmentanalyticsreactnative/AnalyticsReactNativeModule.kt +0 -267
- package/android/src/main/java/com/segmentanalyticsreactnative/AnalyticsReactNativePackage.kt +0 -43
- package/android/src/main/java/com/sovranreactnative/Sovran.kt +0 -45
- package/android/src/main/java/com/sovranreactnative/SovranModule.kt +0 -55
- package/android/src/main/java/org/linusu/RNGetRandomValuesModule.java +0 -36
- package/android/src/main/java/org/linusu/RNGetRandomValuesPackage.java +0 -28
- package/lib/MetaRouterPlugin.d.ts +0 -10
- package/lib/MetaRouterPlugin.d.ts.map +0 -1
- package/lib/MetaRouterPlugin.js +0 -23
- package/lib/context.d.ts +0 -8
- package/lib/context.d.ts.map +0 -1
- package/lib/context.js +0 -9
- package/lib/createMetaRouterClient.d.ts +0 -3
- package/lib/createMetaRouterClient.d.ts.map +0 -1
- package/lib/createMetaRouterClient.js +0 -7
- package/lib/proxyClient.d.ts +0 -4
- package/lib/proxyClient.d.ts.map +0 -1
- package/react-native.config.js +0 -37
package/android/src/main/java/com/reactnativecommunity/asyncstorage/ReactDatabaseSupplier.java
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
package com.reactnativecommunity.asyncstorage;
|
|
9
|
-
|
|
10
|
-
import android.content.Context;
|
|
11
|
-
import android.database.sqlite.SQLiteDatabase;
|
|
12
|
-
import android.database.sqlite.SQLiteException;
|
|
13
|
-
import android.database.sqlite.SQLiteOpenHelper;
|
|
14
|
-
import com.facebook.common.logging.FLog;
|
|
15
|
-
import com.facebook.react.common.ReactConstants;
|
|
16
|
-
import javax.annotation.Nullable;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Database supplier of the database used by react native. This creates, opens and deletes the
|
|
20
|
-
* database as necessary.
|
|
21
|
-
*/
|
|
22
|
-
public class ReactDatabaseSupplier extends SQLiteOpenHelper {
|
|
23
|
-
|
|
24
|
-
// VisibleForTesting
|
|
25
|
-
public static final String DATABASE_NAME = "RKStorage";
|
|
26
|
-
|
|
27
|
-
private static final int DATABASE_VERSION = 1;
|
|
28
|
-
private static final int SLEEP_TIME_MS = 30;
|
|
29
|
-
|
|
30
|
-
static final String TABLE_CATALYST = "catalystLocalStorage";
|
|
31
|
-
static final String KEY_COLUMN = "key";
|
|
32
|
-
static final String VALUE_COLUMN = "value";
|
|
33
|
-
|
|
34
|
-
static final String VERSION_TABLE_CREATE =
|
|
35
|
-
"CREATE TABLE " + TABLE_CATALYST + " (" +
|
|
36
|
-
KEY_COLUMN + " TEXT PRIMARY KEY, " +
|
|
37
|
-
VALUE_COLUMN + " TEXT NOT NULL" +
|
|
38
|
-
")";
|
|
39
|
-
|
|
40
|
-
private static @Nullable ReactDatabaseSupplier sReactDatabaseSupplierInstance;
|
|
41
|
-
|
|
42
|
-
private Context mContext;
|
|
43
|
-
private @Nullable SQLiteDatabase mDb;
|
|
44
|
-
private long mMaximumDatabaseSize = BuildConfig.AsyncStorage_db_size * 1024L * 1024L;
|
|
45
|
-
|
|
46
|
-
private ReactDatabaseSupplier(Context context) {
|
|
47
|
-
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
|
48
|
-
mContext = context;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public static ReactDatabaseSupplier getInstance(Context context) {
|
|
52
|
-
if (sReactDatabaseSupplierInstance == null) {
|
|
53
|
-
sReactDatabaseSupplierInstance = new ReactDatabaseSupplier(context.getApplicationContext());
|
|
54
|
-
}
|
|
55
|
-
return sReactDatabaseSupplierInstance;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
@Override
|
|
59
|
-
public void onCreate(SQLiteDatabase db) {
|
|
60
|
-
db.execSQL(VERSION_TABLE_CREATE);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
@Override
|
|
64
|
-
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
|
65
|
-
if (oldVersion != newVersion) {
|
|
66
|
-
deleteDatabase();
|
|
67
|
-
onCreate(db);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Verify the database exists and is open.
|
|
73
|
-
*/
|
|
74
|
-
/* package */ synchronized boolean ensureDatabase() {
|
|
75
|
-
if (mDb != null && mDb.isOpen()) {
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
// Sometimes retrieving the database fails. We do 2 retries: first without database deletion
|
|
79
|
-
// and then with deletion.
|
|
80
|
-
SQLiteException lastSQLiteException = null;
|
|
81
|
-
for (int tries = 0; tries < 2; tries++) {
|
|
82
|
-
try {
|
|
83
|
-
if (tries > 0) {
|
|
84
|
-
deleteDatabase();
|
|
85
|
-
}
|
|
86
|
-
mDb = getWritableDatabase();
|
|
87
|
-
break;
|
|
88
|
-
} catch (SQLiteException e) {
|
|
89
|
-
lastSQLiteException = e;
|
|
90
|
-
}
|
|
91
|
-
// Wait before retrying.
|
|
92
|
-
try {
|
|
93
|
-
Thread.sleep(SLEEP_TIME_MS);
|
|
94
|
-
} catch (InterruptedException ie) {
|
|
95
|
-
Thread.currentThread().interrupt();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (mDb == null) {
|
|
99
|
-
throw lastSQLiteException;
|
|
100
|
-
}
|
|
101
|
-
// This is a sane limit to protect the user from the app storing too much data in the database.
|
|
102
|
-
// This also protects the database from filling up the disk cache and becoming malformed
|
|
103
|
-
// (endTransaction() calls will throw an exception, not rollback, and leave the db malformed).
|
|
104
|
-
mDb.setMaximumSize(mMaximumDatabaseSize);
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Create and/or open the database.
|
|
110
|
-
*/
|
|
111
|
-
public synchronized SQLiteDatabase get() {
|
|
112
|
-
ensureDatabase();
|
|
113
|
-
return mDb;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
public synchronized void clearAndCloseDatabase() throws RuntimeException {
|
|
117
|
-
try {
|
|
118
|
-
clear();
|
|
119
|
-
closeDatabase();
|
|
120
|
-
FLog.d(ReactConstants.TAG, "Cleaned " + DATABASE_NAME);
|
|
121
|
-
} catch (Exception e) {
|
|
122
|
-
// Clearing the database has failed, delete it instead.
|
|
123
|
-
if (deleteDatabase()) {
|
|
124
|
-
FLog.d(ReactConstants.TAG, "Deleted Local Database " + DATABASE_NAME);
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
// Everything failed, throw
|
|
128
|
-
throw new RuntimeException("Clearing and deleting database " + DATABASE_NAME + " failed");
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/* package */ synchronized void clear() {
|
|
133
|
-
get().delete(TABLE_CATALYST, null, null);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Sets the maximum size the database will grow to. The maximum size cannot
|
|
138
|
-
* be set below the current size.
|
|
139
|
-
*/
|
|
140
|
-
public synchronized void setMaximumSize(long size) {
|
|
141
|
-
mMaximumDatabaseSize = size;
|
|
142
|
-
if (mDb != null) {
|
|
143
|
-
mDb.setMaximumSize(mMaximumDatabaseSize);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
private synchronized boolean deleteDatabase() {
|
|
148
|
-
closeDatabase();
|
|
149
|
-
return mContext.deleteDatabase(DATABASE_NAME);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
public synchronized void closeDatabase() {
|
|
153
|
-
if (mDb != null && mDb.isOpen()) {
|
|
154
|
-
mDb.close();
|
|
155
|
-
mDb = null;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// For testing purposes only!
|
|
160
|
-
public static void deleteInstance() {
|
|
161
|
-
sReactDatabaseSupplierInstance = null;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
package com.reactnativecommunity.asyncstorage;
|
|
2
|
-
|
|
3
|
-
import java.util.ArrayDeque;
|
|
4
|
-
import java.util.concurrent.Executor;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Detox is using this implementation detail in its environment setup,
|
|
8
|
-
* so in order for Next storage to work, this class has been made public
|
|
9
|
-
*
|
|
10
|
-
* Adapted from https://android.googlesource.com/platform/frameworks/base.git/+/1488a3a19d4681a41fb45570c15e14d99db1cb66/core/java/android/os/AsyncTask.java#237
|
|
11
|
-
*/
|
|
12
|
-
public class SerialExecutor implements Executor {
|
|
13
|
-
private final ArrayDeque<Runnable> mTasks = new ArrayDeque<Runnable>();
|
|
14
|
-
private Runnable mActive;
|
|
15
|
-
private final Executor executor;
|
|
16
|
-
|
|
17
|
-
public SerialExecutor(Executor executor) {
|
|
18
|
-
this.executor = executor;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public synchronized void execute(final Runnable r) {
|
|
22
|
-
mTasks.offer(new Runnable() {
|
|
23
|
-
public void run() {
|
|
24
|
-
try {
|
|
25
|
-
r.run();
|
|
26
|
-
} finally {
|
|
27
|
-
scheduleNext();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
if (mActive == null) {
|
|
32
|
-
scheduleNext();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
synchronized void scheduleNext() {
|
|
36
|
-
if ((mActive = mTasks.poll()) != null) {
|
|
37
|
-
executor.execute(mActive);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
configurations {
|
|
2
|
-
compileClasspath
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
buildscript {
|
|
6
|
-
apply from: "config.gradle"
|
|
7
|
-
def kotlinVersion = ext.AsyncStorageConfig.kotlinVersion
|
|
8
|
-
def kspVersion = ext.AsyncStorageConfig.kspVersion
|
|
9
|
-
|
|
10
|
-
repositories {
|
|
11
|
-
mavenCentral()
|
|
12
|
-
google()
|
|
13
|
-
}
|
|
14
|
-
dependencies {
|
|
15
|
-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
|
16
|
-
classpath "com.google.devtools.ksp:symbol-processing-gradle-plugin:$kspVersion"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
apply plugin: 'com.android.library'
|
|
22
|
-
apply from: 'config.gradle'
|
|
23
|
-
|
|
24
|
-
boolean isNewArchitectureEnabled = ext.AsyncStorageConfig.isNewArchitectureEnabled
|
|
25
|
-
boolean useNextStorage = ext.AsyncStorageConfig.useNextStorage
|
|
26
|
-
|
|
27
|
-
logger.info("[AsyncStorage] Config used: {}", ext.AsyncStorageConfig)
|
|
28
|
-
|
|
29
|
-
if (useNextStorage) {
|
|
30
|
-
apply plugin: 'com.google.devtools.ksp'
|
|
31
|
-
apply plugin: 'kotlin-android'
|
|
32
|
-
apply from: './testresults.gradle'
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (isNewArchitectureEnabled) {
|
|
36
|
-
apply plugin: "com.facebook.react"
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
android {
|
|
40
|
-
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
|
|
41
|
-
namespace "com.reactnativecommunity.asyncstorage"
|
|
42
|
-
buildFeatures {
|
|
43
|
-
buildConfig true
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
compileSdkVersion project.ext.AsyncStorageConfig.compileSdkVersion
|
|
47
|
-
// Used to override the NDK path/version by allowing users to customize
|
|
48
|
-
// the NDK path/version from their root project (e.g. for M1 support)
|
|
49
|
-
if (rootProject.hasProperty("ndkPath")) {
|
|
50
|
-
ndkPath rootProject.ext.ndkPath
|
|
51
|
-
}
|
|
52
|
-
if (rootProject.hasProperty("ndkVersion")) {
|
|
53
|
-
ndkVersion rootProject.ext.ndkVersion
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
defaultConfig {
|
|
58
|
-
minSdkVersion project.ext.AsyncStorageConfig.minSdkVersion
|
|
59
|
-
targetSdkVersion project.ext.AsyncStorageConfig.targetSdkVersion
|
|
60
|
-
buildConfigField "Long", "AsyncStorage_db_size", "${project.ext.AsyncStorageConfig.databaseSizeMB}L"
|
|
61
|
-
buildConfigField "boolean", "AsyncStorage_useDedicatedExecutor", "${project.ext.AsyncStorageConfig.useDedicatedExecutor}"
|
|
62
|
-
buildConfigField "boolean", "AsyncStorage_useNextStorage", "${useNextStorage}"
|
|
63
|
-
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", "${isNewArchitectureEnabled}"
|
|
64
|
-
}
|
|
65
|
-
lintOptions {
|
|
66
|
-
abortOnError false
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (useNextStorage) {
|
|
70
|
-
testOptions {
|
|
71
|
-
unitTests {
|
|
72
|
-
returnDefaultValues = true
|
|
73
|
-
includeAndroidResources = true
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
sourceSets.main {
|
|
79
|
-
java {
|
|
80
|
-
if (useNextStorage) {
|
|
81
|
-
srcDirs += 'src/kotlinPackage/java'
|
|
82
|
-
} else {
|
|
83
|
-
srcDirs += 'src/javaPackage/java'
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (!isNewArchitectureEnabled) {
|
|
87
|
-
srcDirs += 'src/oldarch/java'
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
repositories {
|
|
94
|
-
maven {
|
|
95
|
-
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
96
|
-
url "${project.ext.resolveModulePath("react-native")}/android"
|
|
97
|
-
}
|
|
98
|
-
google()
|
|
99
|
-
mavenCentral()
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
dependencies {
|
|
103
|
-
if (useNextStorage) {
|
|
104
|
-
def room_version = project.ext.AsyncStorageConfig.roomVersion
|
|
105
|
-
|
|
106
|
-
implementation "androidx.room:room-runtime:$room_version"
|
|
107
|
-
implementation "androidx.room:room-ktx:$room_version"
|
|
108
|
-
ksp "androidx.room:room-compiler:$room_version"
|
|
109
|
-
|
|
110
|
-
implementation project.ext.AsyncStorageLibs.coroutines
|
|
111
|
-
|
|
112
|
-
testImplementation project.ext.AsyncStorageLibs.testCoroutines
|
|
113
|
-
testImplementation project.ext.AsyncStorageLibs.testJunit
|
|
114
|
-
testImplementation project.ext.AsyncStorageLibs.testExtJunit
|
|
115
|
-
testImplementation project.ext.AsyncStorageLibs.testRunner
|
|
116
|
-
testImplementation project.ext.AsyncStorageLibs.testRules
|
|
117
|
-
testImplementation project.ext.AsyncStorageLibs.testRobolectric
|
|
118
|
-
testImplementation project.ext.AsyncStorageLibs.testTruth
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
implementation 'com.facebook.react:react-native:+' // from node_modules
|
|
122
|
-
}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import java.nio.file.Paths
|
|
2
|
-
|
|
3
|
-
def DEFAULT_KOTLIN_VERSION = "1.9.24"
|
|
4
|
-
def DEFAULT_ROOM_VERSION = "2.6.1"
|
|
5
|
-
|
|
6
|
-
def kotlinVersion = getKotlinVersion(DEFAULT_KOTLIN_VERSION)
|
|
7
|
-
|
|
8
|
-
project.ext.AsyncStorageConfig = [
|
|
9
|
-
kotlinVersion : kotlinVersion,
|
|
10
|
-
kspVersion : getKspVersion(kotlinVersion),
|
|
11
|
-
roomVersion : getPropertyOfDefault('AsyncStorage_next_roomVersion', DEFAULT_ROOM_VERSION),
|
|
12
|
-
minSdkVersion : safeExtGet('minSdkVersion', 23),
|
|
13
|
-
targetSdkVersion : safeExtGet('targetSdkVersion', 32),
|
|
14
|
-
compileSdkVersion : safeExtGet('compileSdkVersion', 32),
|
|
15
|
-
useNextStorage : getFlagOrDefault("AsyncStorage_useNextStorage", false),
|
|
16
|
-
databaseSizeMB : getDatabaseSize(),
|
|
17
|
-
isNewArchitectureEnabled: isNewArchitectureEnabled(),
|
|
18
|
-
useDedicatedExecutor : getFlagOrDefault('AsyncStorage_dedicatedExecutor', false),
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
project.ext.AsyncStorageLibs = [
|
|
22
|
-
coroutines : "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0",
|
|
23
|
-
testCoroutines : "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.0",
|
|
24
|
-
testJunit : "junit:junit:4.13.2",
|
|
25
|
-
testRunner : "androidx.test:runner:1.4.0",
|
|
26
|
-
testRules : "androidx.test:rules:1.4.0",
|
|
27
|
-
testExtJunit : "androidx.test.ext:junit:1.1.3",
|
|
28
|
-
testRobolectric: "org.robolectric:robolectric:4.11.1",
|
|
29
|
-
testTruth : "com.google.truth:truth:1.1.3",
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def getKotlinVersion(String defaultVersion) {
|
|
34
|
-
return rootProject.ext.has('kotlinVersion')
|
|
35
|
-
? rootProject.ext['kotlinVersion']
|
|
36
|
-
: rootProject.hasProperty('AsyncStorage_kotlinVersion')
|
|
37
|
-
? rootProject.properties['AsyncStorage_kotlinVersion']
|
|
38
|
-
: defaultVersion
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
def isNewArchitectureEnabled() {
|
|
42
|
-
// To opt-in for the New Architecture, you can either:
|
|
43
|
-
// - Set `newArchEnabled` to true inside the `gradle.properties` file
|
|
44
|
-
// - Invoke gradle with `-newArchEnabled=true`
|
|
45
|
-
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
|
|
46
|
-
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
String getKspVersion(String kotlinVersion) {
|
|
50
|
-
|
|
51
|
-
String overriddenKspVersion = getPropertyOfDefault("AsyncStorage_next_kspVersion", null)
|
|
52
|
-
if (overriddenKspVersion != null) {
|
|
53
|
-
return overriddenKspVersion
|
|
54
|
-
}
|
|
55
|
-
// https://github.com/google/ksp/releases
|
|
56
|
-
def kspVersions = [
|
|
57
|
-
"1.9.24-1.0.20",
|
|
58
|
-
"1.9.23-1.0.20",
|
|
59
|
-
"1.9.22-1.0.17",
|
|
60
|
-
"1.9.21-1.0.16",
|
|
61
|
-
"1.9.20-1.0.14",
|
|
62
|
-
"1.9.10-1.0.13",
|
|
63
|
-
"1.9.0-1.0.13",
|
|
64
|
-
"1.8.22-1.0.11",
|
|
65
|
-
"1.8.21-1.0.11",
|
|
66
|
-
"1.8.20-1.0.11",
|
|
67
|
-
"1.8.10-1.0.9",
|
|
68
|
-
"1.8.0-1.0.9",
|
|
69
|
-
"1.7.22-1.0.8",
|
|
70
|
-
"1.7.21-1.0.8",
|
|
71
|
-
"1.7.20-1.0.8",
|
|
72
|
-
"1.7.10-1.0.6",
|
|
73
|
-
"1.7.0-1.0.6",
|
|
74
|
-
"1.6.21-1.0.6",
|
|
75
|
-
"1.6.20-1.0.5",
|
|
76
|
-
"1.6.10-1.0.4",
|
|
77
|
-
"1.6.0-1.0.2",
|
|
78
|
-
"1.5.31-1.0.1",
|
|
79
|
-
"1.5.30-1.0.0",
|
|
80
|
-
]
|
|
81
|
-
|
|
82
|
-
return kspVersions.find { it.startsWith(kotlinVersion) } ?: kspVersions.first()
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// AsyncStorage has default size of 6MB.
|
|
86
|
-
// This is a sane limit to protect the user from the app storing too much data in the database.
|
|
87
|
-
// This also protects the database from filling up the disk cache and becoming malformed.
|
|
88
|
-
// If you really need bigger size, please keep in mind the potential consequences.
|
|
89
|
-
long getDatabaseSize() {
|
|
90
|
-
long dbSizeInMB = 6L
|
|
91
|
-
def newDbSize = getPropertyOfDefault('AsyncStorage_db_size_in_MB', null)
|
|
92
|
-
if (newDbSize != null && newDbSize.isLong()) {
|
|
93
|
-
dbSizeInMB = newDbSize.toLong()
|
|
94
|
-
}
|
|
95
|
-
return dbSizeInMB
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
def safeExtGet(prop, fallback) {
|
|
99
|
-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
def getFlagOrDefault(flagName, defaultValue) {
|
|
103
|
-
rootProject.hasProperty(flagName) ? rootProject.properties[flagName] == "true" : defaultValue
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
def getPropertyOfDefault(String flagName, String defaultVersion) {
|
|
107
|
-
rootProject.hasProperty(flagName) ? rootProject.properties[flagName] : defaultVersion
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
ext.resolveModulePath = { packageName ->
|
|
111
|
-
def basePath = rootDir.toPath().normalize()
|
|
112
|
-
|
|
113
|
-
// Node's module resolution algorithm searches up to the root directory,
|
|
114
|
-
// after which the base path will be null
|
|
115
|
-
while (basePath) {
|
|
116
|
-
def candidatePath = Paths.get(basePath.toString(), 'node_modules', packageName)
|
|
117
|
-
if (candidatePath.toFile().exists()) {
|
|
118
|
-
return candidatePath.toString()
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
basePath = basePath.getParent()
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return null
|
|
125
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
package com.reactnativecommunity.asyncstorage.next
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.bridge.Arguments
|
|
4
|
-
import com.facebook.react.bridge.ReadableArray
|
|
5
|
-
import org.json.JSONException
|
|
6
|
-
import org.json.JSONObject
|
|
7
|
-
|
|
8
|
-
fun ReadableArray.toEntryList(): List<Entry> {
|
|
9
|
-
val list = mutableListOf<Entry>()
|
|
10
|
-
for (keyValue in this.toArrayList()) {
|
|
11
|
-
if (keyValue !is ArrayList<*> || keyValue.size != 2) {
|
|
12
|
-
throw AsyncStorageError.invalidKeyValueFormat()
|
|
13
|
-
}
|
|
14
|
-
val key = keyValue[0]
|
|
15
|
-
val value = keyValue[1]
|
|
16
|
-
|
|
17
|
-
if (key !is String) {
|
|
18
|
-
when (key) {
|
|
19
|
-
null -> throw AsyncStorageError.keyIsNull()
|
|
20
|
-
else -> throw AsyncStorageError.keyNotString()
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (value !is String) {
|
|
25
|
-
throw AsyncStorageError.valueNotString(key)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
list.add(Entry(key, value))
|
|
29
|
-
}
|
|
30
|
-
return list
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
fun ReadableArray.toKeyList(): List<String> {
|
|
34
|
-
val list = this.toArrayList()
|
|
35
|
-
|
|
36
|
-
for (item in list) {
|
|
37
|
-
if (item !is String) {
|
|
38
|
-
throw AsyncStorageError.keyNotString()
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return list as List<String>
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
fun List<Entry>.toKeyValueArgument(): ReadableArray {
|
|
45
|
-
val args = Arguments.createArray()
|
|
46
|
-
|
|
47
|
-
for (entry in this) {
|
|
48
|
-
val keyValue = Arguments.createArray()
|
|
49
|
-
keyValue.pushString(entry.key)
|
|
50
|
-
keyValue.pushString(entry.value)
|
|
51
|
-
args.pushArray(keyValue)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return args
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
fun String?.isValidJson(): Boolean {
|
|
58
|
-
if (this == null) return false
|
|
59
|
-
|
|
60
|
-
return try {
|
|
61
|
-
JSONObject(this)
|
|
62
|
-
true
|
|
63
|
-
} catch (e: JSONException) {
|
|
64
|
-
false
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
fun JSONObject.mergeWith(newObject: JSONObject): JSONObject {
|
|
69
|
-
|
|
70
|
-
val keys = newObject.keys()
|
|
71
|
-
val mergedObject = JSONObject(this.toString())
|
|
72
|
-
|
|
73
|
-
while (keys.hasNext()) {
|
|
74
|
-
val key = keys.next()
|
|
75
|
-
val curValue = this.optJSONObject(key)
|
|
76
|
-
val newValue = newObject.optJSONObject(key)
|
|
77
|
-
|
|
78
|
-
if (curValue != null && newValue != null) {
|
|
79
|
-
val merged = curValue.mergeWith(newValue)
|
|
80
|
-
mergedObject.put(key, merged)
|
|
81
|
-
} else {
|
|
82
|
-
mergedObject.put(key, newObject.get(key))
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return mergedObject
|
|
86
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
package com.reactnativecommunity.asyncstorage.next
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.bridge.Arguments
|
|
4
|
-
import com.facebook.react.bridge.Callback
|
|
5
|
-
import kotlinx.coroutines.CoroutineExceptionHandler
|
|
6
|
-
|
|
7
|
-
internal fun createExceptionHandler(cb: Callback): CoroutineExceptionHandler {
|
|
8
|
-
return CoroutineExceptionHandler { _, throwable ->
|
|
9
|
-
val error = Arguments.createMap()
|
|
10
|
-
if (throwable !is AsyncStorageError) {
|
|
11
|
-
error.putString(
|
|
12
|
-
"message", "Unexpected AsyncStorage error: ${throwable.localizedMessage}"
|
|
13
|
-
)
|
|
14
|
-
} else {
|
|
15
|
-
error.putString("message", throwable.errorMessage)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
cb(error)
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
internal class AsyncStorageError private constructor(val errorMessage: String) :
|
|
23
|
-
Throwable(errorMessage) {
|
|
24
|
-
|
|
25
|
-
companion object {
|
|
26
|
-
fun keyIsNull() = AsyncStorageError("Key cannot be null.")
|
|
27
|
-
|
|
28
|
-
fun keyNotString() = AsyncStorageError("Provided key is not string. Only strings are supported as storage key.")
|
|
29
|
-
|
|
30
|
-
fun valueNotString(key: String?): AsyncStorageError {
|
|
31
|
-
val detail = if (key == null) "Provided value" else "Value for key \"$key\""
|
|
32
|
-
return AsyncStorageError("$detail is not a string. Only strings are supported as a value.")
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
fun invalidKeyValueFormat() =
|
|
36
|
-
AsyncStorageError("Invalid key-value format. Expected a list of [key, value] list.")
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
package com.reactnativecommunity.asyncstorage.next
|
|
2
|
-
|
|
3
|
-
import android.content.Context
|
|
4
|
-
import androidx.annotation.VisibleForTesting
|
|
5
|
-
import com.facebook.react.bridge.Arguments
|
|
6
|
-
import com.facebook.react.bridge.Callback
|
|
7
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
8
|
-
import com.facebook.react.bridge.ReactMethod
|
|
9
|
-
import com.facebook.react.bridge.ReadableArray
|
|
10
|
-
import com.facebook.react.module.annotations.ReactModule
|
|
11
|
-
import com.reactnativecommunity.asyncstorage.NativeAsyncStorageModuleSpec
|
|
12
|
-
import com.reactnativecommunity.asyncstorage.SerialExecutor
|
|
13
|
-
import kotlinx.coroutines.CoroutineName
|
|
14
|
-
import kotlinx.coroutines.CoroutineScope
|
|
15
|
-
import kotlinx.coroutines.Dispatchers
|
|
16
|
-
import kotlinx.coroutines.SupervisorJob
|
|
17
|
-
import kotlinx.coroutines.asExecutor
|
|
18
|
-
import kotlinx.coroutines.launch
|
|
19
|
-
|
|
20
|
-
@ReactModule(name = StorageModule.NAME)
|
|
21
|
-
class StorageModule(reactContext: ReactApplicationContext) : NativeAsyncStorageModuleSpec(reactContext), CoroutineScope {
|
|
22
|
-
override fun getName() = NAME
|
|
23
|
-
|
|
24
|
-
// this executor is not used by the module, but it must exists here due to
|
|
25
|
-
// Detox relying on this implementation detail to run
|
|
26
|
-
@VisibleForTesting
|
|
27
|
-
private val executor = SerialExecutor(Dispatchers.Main.asExecutor())
|
|
28
|
-
|
|
29
|
-
override val coroutineContext =
|
|
30
|
-
Dispatchers.IO + CoroutineName("AsyncStorageScope") + SupervisorJob()
|
|
31
|
-
|
|
32
|
-
private val storage = StorageSupplier.getInstance(reactContext)
|
|
33
|
-
|
|
34
|
-
companion object {
|
|
35
|
-
const val NAME = "RNCAsyncStorage"
|
|
36
|
-
|
|
37
|
-
@JvmStatic
|
|
38
|
-
fun getStorageInstance(ctx: Context): AsyncStorageAccess {
|
|
39
|
-
return StorageSupplier.getInstance(ctx)
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
@ReactMethod
|
|
44
|
-
override fun multiGet(keys: ReadableArray, cb: Callback) {
|
|
45
|
-
launch(createExceptionHandler(cb)) {
|
|
46
|
-
val entries = storage.getValues(keys.toKeyList())
|
|
47
|
-
cb(null, entries.toKeyValueArgument())
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
@ReactMethod
|
|
52
|
-
override fun multiSet(keyValueArray: ReadableArray, cb: Callback) {
|
|
53
|
-
launch(createExceptionHandler(cb)) {
|
|
54
|
-
val entries = keyValueArray.toEntryList()
|
|
55
|
-
storage.setValues(entries)
|
|
56
|
-
cb(null)
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@ReactMethod
|
|
61
|
-
override fun multiRemove(keys: ReadableArray, cb: Callback) {
|
|
62
|
-
launch(createExceptionHandler(cb)) {
|
|
63
|
-
storage.removeValues(keys.toKeyList())
|
|
64
|
-
cb(null)
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
@ReactMethod
|
|
69
|
-
override fun multiMerge(keyValueArray: ReadableArray, cb: Callback) {
|
|
70
|
-
launch(createExceptionHandler(cb)) {
|
|
71
|
-
val entries = keyValueArray.toEntryList()
|
|
72
|
-
storage.mergeValues(entries)
|
|
73
|
-
cb(null)
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
@ReactMethod
|
|
78
|
-
override fun getAllKeys(cb: Callback) {
|
|
79
|
-
launch(createExceptionHandler(cb)) {
|
|
80
|
-
val keys = storage.getKeys()
|
|
81
|
-
val result = Arguments.createArray()
|
|
82
|
-
keys.forEach { result.pushString(it) }
|
|
83
|
-
cb.invoke(null, result)
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
@ReactMethod
|
|
88
|
-
override fun clear(cb: Callback) {
|
|
89
|
-
launch(createExceptionHandler(cb)) {
|
|
90
|
-
storage.clear()
|
|
91
|
-
cb(null)
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|