@metarouter/react-native-sdk 0.1.14 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/MetaRouterReactNativeSDK.podspec +25 -27
  2. package/android/build/generated/ksp/debug/java/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl.java +244 -0
  3. package/android/build/generated/ksp/debug/java/com/reactnativecommunity/asyncstorage/next/StorageDb_Impl.java +165 -0
  4. package/android/build/generated/source/buildConfig/debug/com/metarouter/reactnativesdk/BuildConfig.java +10 -0
  5. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +7 -0
  6. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
  7. package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +6 -0
  8. package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
  9. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  10. package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
  11. package/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +0 -0
  12. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -0
  13. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
  14. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/metarouter/reactnativesdk/BuildConfig.class +0 -0
  15. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/metarouter/reactnativesdk/MetaRouterReactNativeSDKPackage.class +0 -0
  16. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncLocalStorageUtil.class +0 -0
  17. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageErrorUtil.class +0 -0
  18. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageExpoMigration.class +0 -0
  19. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule$1.class +0 -0
  20. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule$2.class +0 -0
  21. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule$3.class +0 -0
  22. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule$4.class +0 -0
  23. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule$5.class +0 -0
  24. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule$6.class +0 -0
  25. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule.class +0 -0
  26. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStoragePackage$1.class +0 -0
  27. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.class +0 -0
  28. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/BuildConfig.class +0 -0
  29. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/NativeAsyncStorageModuleSpec.class +0 -0
  30. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/ReactDatabaseSupplier.class +0 -0
  31. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/SerialExecutor$1.class +0 -0
  32. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/SerialExecutor.class +0 -0
  33. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$1.class +0 -0
  34. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$2.class +0 -0
  35. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$3.class +0 -0
  36. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$4.class +0 -0
  37. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$5.class +0 -0
  38. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$6.class +0 -0
  39. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$7.class +0 -0
  40. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl.class +0 -0
  41. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDb_Impl$1.class +0 -0
  42. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDb_Impl.class +0 -0
  43. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/linusu/RNGetRandomValuesModule.class +0 -0
  44. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/linusu/RNGetRandomValuesPackage.class +0 -0
  45. package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +2 -0
  46. package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +7 -0
  47. package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +7 -0
  48. package/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +1 -0
  49. package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
  50. package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +1 -0
  51. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  52. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
  53. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
  54. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
  55. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  56. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
  57. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
  58. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  59. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  60. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  61. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  62. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  63. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  64. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
  65. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  66. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  67. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  68. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  69. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  70. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  71. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
  72. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab +0 -0
  73. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream +0 -0
  74. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len +0 -0
  75. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len +0 -0
  76. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
  77. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i +0 -0
  78. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i.len +0 -0
  79. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  80. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  81. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  82. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  83. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  84. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  85. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
  86. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab +0 -0
  87. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.keystream +0 -0
  88. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.keystream.len +0 -0
  89. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.len +0 -0
  90. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.values.at +0 -0
  91. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab_i +0 -0
  92. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab_i.len +0 -0
  93. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab +0 -0
  94. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.keystream +0 -0
  95. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.keystream.len +0 -0
  96. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.len +0 -0
  97. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.values.at +0 -0
  98. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab_i +0 -0
  99. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab_i.len +0 -0
  100. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  101. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  102. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  103. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  104. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  105. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  106. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
  107. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  108. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
  109. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
  110. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
  111. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  112. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
  113. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
  114. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  115. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  116. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  117. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
  118. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  119. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
  120. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
  121. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  122. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  123. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  124. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
  125. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  126. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  127. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
  128. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +2 -0
  129. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  130. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
  131. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
  132. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
  133. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  134. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
  135. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
  136. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  137. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  138. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  139. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  140. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  141. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
  142. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
  143. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  144. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  145. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  146. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  147. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  148. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  149. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
  150. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  151. package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
  152. package/android/build/outputs/logs/manifest-merger-debug-report.txt +16 -0
  153. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  154. package/android/build/tmp/kotlin-classes/debug/META-INF/metarouter_react-native-sdk_debug.kotlin_module +0 -0
  155. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/ArgumentHelpersKt.class +0 -0
  156. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/AsyncStorageAccess.class +0 -0
  157. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/AsyncStorageError$Companion.class +0 -0
  158. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/AsyncStorageError.class +0 -0
  159. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/Entry.class +0 -0
  160. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/ErrorHelpersKt$createExceptionHandler$$inlined$CoroutineExceptionHandler$1.class +0 -0
  161. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/ErrorHelpersKt.class +0 -0
  162. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/MIGRATION_TO_NEXT.class +0 -0
  163. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageDao$DefaultImpls.class +0 -0
  164. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageDao$mergeValues$1.class +0 -0
  165. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageDao.class +0 -0
  166. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageDb$Companion.class +0 -0
  167. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageDb.class +0 -0
  168. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$Companion.class +0 -0
  169. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$clear$1.class +0 -0
  170. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$getAllKeys$1.class +0 -0
  171. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$multiGet$1.class +0 -0
  172. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$multiMerge$1.class +0 -0
  173. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$multiRemove$1.class +0 -0
  174. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$multiSet$1.class +0 -0
  175. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule.class +0 -0
  176. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageSupplier$Companion.class +0 -0
  177. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageSupplier.class +0 -0
  178. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageSupplierKt.class +0 -0
  179. package/android/build/tmp/kotlin-classes/debug/com/segmentanalyticsreactnative/AnalyticsReactNativeModule$onInitialized$1.class +0 -0
  180. package/android/build/tmp/kotlin-classes/debug/com/segmentanalyticsreactnative/AnalyticsReactNativeModule$toHexString$1.class +0 -0
  181. package/android/build/tmp/kotlin-classes/debug/com/segmentanalyticsreactnative/AnalyticsReactNativeModule.class +0 -0
  182. package/android/build/tmp/kotlin-classes/debug/com/segmentanalyticsreactnative/AnalyticsReactNativePackage$createNativeModules$1.class +0 -0
  183. package/android/build/tmp/kotlin-classes/debug/com/segmentanalyticsreactnative/AnalyticsReactNativePackage.class +0 -0
  184. package/android/build/tmp/kotlin-classes/debug/com/segmentanalyticsreactnative/ConnectionType.class +0 -0
  185. package/android/build/tmp/kotlin-classes/debug/com/sovranreactnative/Sovran$Action.class +0 -0
  186. package/android/build/tmp/kotlin-classes/debug/com/sovranreactnative/Sovran$createNativeModules$1.class +0 -0
  187. package/android/build/tmp/kotlin-classes/debug/com/sovranreactnative/Sovran.class +0 -0
  188. package/android/build/tmp/kotlin-classes/debug/com/sovranreactnative/SovranModule$Companion.class +0 -0
  189. package/android/build/tmp/kotlin-classes/debug/com/sovranreactnative/SovranModule$onInitialized$1.class +0 -0
  190. package/android/build/tmp/kotlin-classes/debug/com/sovranreactnative/SovranModule.class +0 -0
  191. package/android/build.gradle +30 -35
  192. package/android/src/main/java/com/metarouter/reactnativesdk/{MetaRouterReactNativeSdkPackage.java → MetaRouterReactNativeSDKPackage.java} +1 -1
  193. package/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncLocalStorageUtil.java +178 -0
  194. package/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageErrorUtil.java +45 -0
  195. package/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageExpoMigration.java +154 -0
  196. package/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java +410 -0
  197. package/android/src/main/java/com/reactnativecommunity/asyncstorage/BuildConfig.java +8 -0
  198. package/android/src/main/java/com/reactnativecommunity/asyncstorage/NativeAsyncStorageModuleSpec.java +47 -0
  199. package/android/src/main/java/com/reactnativecommunity/asyncstorage/ReactDatabaseSupplier.java +163 -0
  200. package/android/src/main/java/com/reactnativecommunity/asyncstorage/SerialExecutor.java +40 -0
  201. package/android/src/main/java/com/reactnativecommunity/asyncstorage/build.gradle +122 -0
  202. package/android/src/main/java/com/reactnativecommunity/asyncstorage/config.gradle +125 -0
  203. package/android/src/main/java/com/reactnativecommunity/asyncstorage/next/ArgumentHelpers.kt +86 -0
  204. package/android/src/main/java/com/reactnativecommunity/asyncstorage/next/ErrorHelpers.kt +39 -0
  205. package/android/src/main/java/com/reactnativecommunity/asyncstorage/next/StorageModule.kt +94 -0
  206. package/android/src/main/java/com/reactnativecommunity/asyncstorage/next/StorageSupplier.kt +161 -0
  207. package/package.json +1 -1
  208. package/react-native.config.js +29 -8
  209. /package/android/src/main/java/com/{reactnativesovran → sovranreactnative}/Sovran.kt +0 -0
  210. /package/android/src/main/java/com/{reactnativesovran → sovranreactnative}/SovranModule.kt +0 -0
@@ -0,0 +1,410 @@
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.database.Cursor;
11
+ import android.database.sqlite.SQLiteStatement;
12
+ import android.os.AsyncTask;
13
+
14
+ import com.facebook.common.logging.FLog;
15
+ import com.facebook.react.bridge.Arguments;
16
+ import com.facebook.react.bridge.Callback;
17
+ import com.facebook.react.bridge.GuardedAsyncTask;
18
+ import com.facebook.react.bridge.ReactApplicationContext;
19
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
20
+ import com.facebook.react.bridge.ReactMethod;
21
+ import com.facebook.react.bridge.ReadableArray;
22
+ import com.facebook.react.bridge.WritableArray;
23
+ import com.facebook.react.bridge.WritableMap;
24
+ import com.facebook.react.common.ReactConstants;
25
+ import com.facebook.react.common.annotations.VisibleForTesting;
26
+ import com.facebook.react.module.annotations.ReactModule;
27
+
28
+ import java.util.ArrayDeque;
29
+ import java.util.HashSet;
30
+ import java.util.concurrent.Executor;
31
+ import java.util.concurrent.Executors;
32
+
33
+ @ReactModule(name = AsyncStorageModule.NAME)
34
+ public final class AsyncStorageModule extends NativeAsyncStorageModuleSpec {
35
+
36
+ // changed name to not conflict with AsyncStorage from RN repo
37
+ public static final String NAME = "RNCAsyncStorage";
38
+
39
+ // SQL variable number limit, defined by SQLITE_LIMIT_VARIABLE_NUMBER:
40
+ // https://raw.githubusercontent.com/android/platform_external_sqlite/master/dist/sqlite3.c
41
+ private static final int MAX_SQL_KEYS = 999;
42
+
43
+ private ReactDatabaseSupplier mReactDatabaseSupplier;
44
+ private boolean mShuttingDown = false;
45
+
46
+ private final SerialExecutor executor;
47
+
48
+ public AsyncStorageModule(ReactApplicationContext reactContext) {
49
+ this(
50
+ reactContext,
51
+ BuildConfig.AsyncStorage_useDedicatedExecutor
52
+ ? Executors.newSingleThreadExecutor()
53
+ : AsyncTask.THREAD_POOL_EXECUTOR
54
+ );
55
+ }
56
+
57
+ @VisibleForTesting
58
+ AsyncStorageModule(ReactApplicationContext reactContext, Executor executor) {
59
+ super(reactContext);
60
+
61
+ // The migration MUST run before the AsyncStorage database is created for the first time.
62
+ AsyncStorageExpoMigration.migrate(reactContext);
63
+
64
+ this.executor = new SerialExecutor(executor);
65
+
66
+ // Creating the database MUST happen after the migration.
67
+ mReactDatabaseSupplier = ReactDatabaseSupplier.getInstance(reactContext);
68
+ }
69
+
70
+ @Override
71
+ public String getName() {
72
+ return NAME;
73
+ }
74
+
75
+ @Override
76
+ public void initialize() {
77
+ super.initialize();
78
+ mShuttingDown = false;
79
+ }
80
+
81
+ @Override
82
+ public void invalidate() {
83
+ mShuttingDown = true;
84
+ // ensure we close database when activity is destroyed
85
+ mReactDatabaseSupplier.closeDatabase();
86
+ }
87
+
88
+ /**
89
+ * Given an array of keys, this returns a map of (key, value) pairs for the keys found, and
90
+ * (key, null) for the keys that haven't been found.
91
+ */
92
+ @ReactMethod
93
+ @Override
94
+ public void multiGet(final ReadableArray keys, final Callback callback) {
95
+ if (keys == null) {
96
+ callback.invoke(AsyncStorageErrorUtil.getInvalidKeyError(null), null);
97
+ return;
98
+ }
99
+
100
+ new GuardedAsyncTask<Void, Void>(getReactApplicationContext()) {
101
+ @Override
102
+ protected void doInBackgroundGuarded(Void... params) {
103
+ if (!ensureDatabase()) {
104
+ callback.invoke(AsyncStorageErrorUtil.getDBError(null), null);
105
+ return;
106
+ }
107
+
108
+ String[] columns = {ReactDatabaseSupplier.KEY_COLUMN, ReactDatabaseSupplier.VALUE_COLUMN};
109
+ HashSet<String> keysRemaining = new HashSet<>();
110
+ WritableArray data = Arguments.createArray();
111
+ for (int keyStart = 0; keyStart < keys.size(); keyStart += MAX_SQL_KEYS) {
112
+ int keyCount = Math.min(keys.size() - keyStart, MAX_SQL_KEYS);
113
+ Cursor cursor = mReactDatabaseSupplier.get().query(
114
+ ReactDatabaseSupplier.TABLE_CATALYST,
115
+ columns,
116
+ AsyncLocalStorageUtil.buildKeySelection(keyCount),
117
+ AsyncLocalStorageUtil.buildKeySelectionArgs(keys, keyStart, keyCount),
118
+ null,
119
+ null,
120
+ null);
121
+ keysRemaining.clear();
122
+ try {
123
+ if (cursor.getCount() != keys.size()) {
124
+ // some keys have not been found - insert them with null into the final array
125
+ for (int keyIndex = keyStart; keyIndex < keyStart + keyCount; keyIndex++) {
126
+ keysRemaining.add(keys.getString(keyIndex));
127
+ }
128
+ }
129
+
130
+ if (cursor.moveToFirst()) {
131
+ do {
132
+ WritableArray row = Arguments.createArray();
133
+ row.pushString(cursor.getString(0));
134
+ row.pushString(cursor.getString(1));
135
+ data.pushArray(row);
136
+ keysRemaining.remove(cursor.getString(0));
137
+ } while (cursor.moveToNext());
138
+ }
139
+ } catch (Exception e) {
140
+ FLog.w(ReactConstants.TAG, e.getMessage(), e);
141
+ callback.invoke(AsyncStorageErrorUtil.getError(null, e.getMessage()), null);
142
+ return;
143
+ } finally {
144
+ cursor.close();
145
+ }
146
+
147
+ for (String key : keysRemaining) {
148
+ WritableArray row = Arguments.createArray();
149
+ row.pushString(key);
150
+ row.pushNull();
151
+ data.pushArray(row);
152
+ }
153
+ keysRemaining.clear();
154
+ }
155
+
156
+ callback.invoke(null, data);
157
+ }
158
+ }.executeOnExecutor(executor);
159
+ }
160
+
161
+ /**
162
+ * Inserts multiple (key, value) pairs. If one or more of the pairs cannot be inserted, this will
163
+ * return AsyncLocalStorageFailure, but all other pairs will have been inserted.
164
+ * The insertion will replace conflicting (key, value) pairs.
165
+ */
166
+ @ReactMethod
167
+ @Override
168
+ public void multiSet(final ReadableArray keyValueArray, final Callback callback) {
169
+ if (keyValueArray.size() == 0) {
170
+ callback.invoke();
171
+ return;
172
+ }
173
+
174
+ new GuardedAsyncTask<Void, Void>(getReactApplicationContext()) {
175
+ @Override
176
+ protected void doInBackgroundGuarded(Void... params) {
177
+ if (!ensureDatabase()) {
178
+ callback.invoke(AsyncStorageErrorUtil.getDBError(null));
179
+ return;
180
+ }
181
+
182
+ String sql = "INSERT OR REPLACE INTO " + ReactDatabaseSupplier.TABLE_CATALYST + " VALUES (?, ?);";
183
+ SQLiteStatement statement = mReactDatabaseSupplier.get().compileStatement(sql);
184
+ WritableMap error = null;
185
+ try {
186
+ mReactDatabaseSupplier.get().beginTransaction();
187
+ for (int idx=0; idx < keyValueArray.size(); idx++) {
188
+ if (keyValueArray.getArray(idx).size() != 2) {
189
+ error = AsyncStorageErrorUtil.getInvalidValueError(null);
190
+ return;
191
+ }
192
+ if (keyValueArray.getArray(idx).getString(0) == null) {
193
+ error = AsyncStorageErrorUtil.getInvalidKeyError(null);
194
+ return;
195
+ }
196
+ if (keyValueArray.getArray(idx).getString(1) == null) {
197
+ error = AsyncStorageErrorUtil.getInvalidValueError(null);
198
+ return;
199
+ }
200
+
201
+ statement.clearBindings();
202
+ statement.bindString(1, keyValueArray.getArray(idx).getString(0));
203
+ statement.bindString(2, keyValueArray.getArray(idx).getString(1));
204
+ statement.execute();
205
+ }
206
+ mReactDatabaseSupplier.get().setTransactionSuccessful();
207
+ } catch (Exception e) {
208
+ FLog.w(ReactConstants.TAG, e.getMessage(), e);
209
+ error = AsyncStorageErrorUtil.getError(null, e.getMessage());
210
+ } finally {
211
+ try {
212
+ mReactDatabaseSupplier.get().endTransaction();
213
+ } catch (Exception e) {
214
+ FLog.w(ReactConstants.TAG, e.getMessage(), e);
215
+ if (error == null) {
216
+ error = AsyncStorageErrorUtil.getError(null, e.getMessage());
217
+ }
218
+ }
219
+ }
220
+ if (error != null) {
221
+ callback.invoke(error);
222
+ } else {
223
+ callback.invoke();
224
+ }
225
+ }
226
+ }.executeOnExecutor(executor);
227
+ }
228
+
229
+ /**
230
+ * Removes all rows of the keys given.
231
+ */
232
+ @ReactMethod
233
+ @Override
234
+ public void multiRemove(final ReadableArray keys, final Callback callback) {
235
+ if (keys.size() == 0) {
236
+ callback.invoke();
237
+ return;
238
+ }
239
+
240
+ new GuardedAsyncTask<Void, Void>(getReactApplicationContext()) {
241
+ @Override
242
+ protected void doInBackgroundGuarded(Void... params) {
243
+ if (!ensureDatabase()) {
244
+ callback.invoke(AsyncStorageErrorUtil.getDBError(null));
245
+ return;
246
+ }
247
+
248
+ WritableMap error = null;
249
+ try {
250
+ mReactDatabaseSupplier.get().beginTransaction();
251
+ for (int keyStart = 0; keyStart < keys.size(); keyStart += MAX_SQL_KEYS) {
252
+ int keyCount = Math.min(keys.size() - keyStart, MAX_SQL_KEYS);
253
+ mReactDatabaseSupplier.get().delete(
254
+ ReactDatabaseSupplier.TABLE_CATALYST,
255
+ AsyncLocalStorageUtil.buildKeySelection(keyCount),
256
+ AsyncLocalStorageUtil.buildKeySelectionArgs(keys, keyStart, keyCount));
257
+ }
258
+ mReactDatabaseSupplier.get().setTransactionSuccessful();
259
+ } catch (Exception e) {
260
+ FLog.w(ReactConstants.TAG, e.getMessage(), e);
261
+ error = AsyncStorageErrorUtil.getError(null, e.getMessage());
262
+ } finally {
263
+ try {
264
+ mReactDatabaseSupplier.get().endTransaction();
265
+ } catch (Exception e) {
266
+ FLog.w(ReactConstants.TAG, e.getMessage(), e);
267
+ if (error == null) {
268
+ error = AsyncStorageErrorUtil.getError(null, e.getMessage());
269
+ }
270
+ }
271
+ }
272
+ if (error != null) {
273
+ callback.invoke(error);
274
+ } else {
275
+ callback.invoke();
276
+ }
277
+ }
278
+ }.executeOnExecutor(executor);
279
+ }
280
+
281
+ /**
282
+ * Given an array of (key, value) pairs, this will merge the given values with the stored values
283
+ * of the given keys, if they exist.
284
+ */
285
+ @ReactMethod
286
+ @Override
287
+ public void multiMerge(final ReadableArray keyValueArray, final Callback callback) {
288
+ new GuardedAsyncTask<Void, Void>(getReactApplicationContext()) {
289
+ @Override
290
+ protected void doInBackgroundGuarded(Void... params) {
291
+ if (!ensureDatabase()) {
292
+ callback.invoke(AsyncStorageErrorUtil.getDBError(null));
293
+ return;
294
+ }
295
+ WritableMap error = null;
296
+ try {
297
+ mReactDatabaseSupplier.get().beginTransaction();
298
+ for (int idx = 0; idx < keyValueArray.size(); idx++) {
299
+ if (keyValueArray.getArray(idx).size() != 2) {
300
+ error = AsyncStorageErrorUtil.getInvalidValueError(null);
301
+ return;
302
+ }
303
+
304
+ if (keyValueArray.getArray(idx).getString(0) == null) {
305
+ error = AsyncStorageErrorUtil.getInvalidKeyError(null);
306
+ return;
307
+ }
308
+
309
+ if (keyValueArray.getArray(idx).getString(1) == null) {
310
+ error = AsyncStorageErrorUtil.getInvalidValueError(null);
311
+ return;
312
+ }
313
+
314
+ if (!AsyncLocalStorageUtil.mergeImpl(
315
+ mReactDatabaseSupplier.get(),
316
+ keyValueArray.getArray(idx).getString(0),
317
+ keyValueArray.getArray(idx).getString(1))) {
318
+ error = AsyncStorageErrorUtil.getDBError(null);
319
+ return;
320
+ }
321
+ }
322
+ mReactDatabaseSupplier.get().setTransactionSuccessful();
323
+ } catch (Exception e) {
324
+ FLog.w(ReactConstants.TAG, e.getMessage(), e);
325
+ error = AsyncStorageErrorUtil.getError(null, e.getMessage());
326
+ } finally {
327
+ try {
328
+ mReactDatabaseSupplier.get().endTransaction();
329
+ } catch (Exception e) {
330
+ FLog.w(ReactConstants.TAG, e.getMessage(), e);
331
+ if (error == null) {
332
+ error = AsyncStorageErrorUtil.getError(null, e.getMessage());
333
+ }
334
+ }
335
+ }
336
+ if (error != null) {
337
+ callback.invoke(error);
338
+ } else {
339
+ callback.invoke();
340
+ }
341
+ }
342
+ }.executeOnExecutor(executor);
343
+ }
344
+
345
+ /**
346
+ * Clears the database.
347
+ */
348
+ @ReactMethod
349
+ @Override
350
+ public void clear(final Callback callback) {
351
+ new GuardedAsyncTask<Void, Void>(getReactApplicationContext()) {
352
+ @Override
353
+ protected void doInBackgroundGuarded(Void... params) {
354
+ if (!mReactDatabaseSupplier.ensureDatabase()) {
355
+ callback.invoke(AsyncStorageErrorUtil.getDBError(null));
356
+ return;
357
+ }
358
+ try {
359
+ mReactDatabaseSupplier.clear();
360
+ callback.invoke();
361
+ } catch (Exception e) {
362
+ FLog.w(ReactConstants.TAG, e.getMessage(), e);
363
+ callback.invoke(AsyncStorageErrorUtil.getError(null, e.getMessage()));
364
+ }
365
+ }
366
+ }.executeOnExecutor(executor);
367
+ }
368
+
369
+ /**
370
+ * Returns an array with all keys from the database.
371
+ */
372
+ @ReactMethod
373
+ @Override
374
+ public void getAllKeys(final Callback callback) {
375
+ new GuardedAsyncTask<Void, Void>(getReactApplicationContext()) {
376
+ @Override
377
+ protected void doInBackgroundGuarded(Void... params) {
378
+ if (!ensureDatabase()) {
379
+ callback.invoke(AsyncStorageErrorUtil.getDBError(null), null);
380
+ return;
381
+ }
382
+ WritableArray data = Arguments.createArray();
383
+ String[] columns = {ReactDatabaseSupplier.KEY_COLUMN};
384
+ Cursor cursor = mReactDatabaseSupplier.get()
385
+ .query(ReactDatabaseSupplier.TABLE_CATALYST, columns, null, null, null, null, null);
386
+ try {
387
+ if (cursor.moveToFirst()) {
388
+ do {
389
+ data.pushString(cursor.getString(0));
390
+ } while (cursor.moveToNext());
391
+ }
392
+ } catch (Exception e) {
393
+ FLog.w(ReactConstants.TAG, e.getMessage(), e);
394
+ callback.invoke(AsyncStorageErrorUtil.getError(null, e.getMessage()), null);
395
+ return;
396
+ } finally {
397
+ cursor.close();
398
+ }
399
+ callback.invoke(null, data);
400
+ }
401
+ }.executeOnExecutor(executor);
402
+ }
403
+
404
+ /**
405
+ * Verify the database is open for reads and writes.
406
+ */
407
+ private boolean ensureDatabase() {
408
+ return !mShuttingDown && mReactDatabaseSupplier.ensureDatabase();
409
+ }
410
+ }
@@ -0,0 +1,8 @@
1
+ package com.reactnativecommunity.asyncstorage;
2
+
3
+ public final class BuildConfig {
4
+ public static final long AsyncStorage_db_size = 6L;
5
+ public static final boolean AsyncStorage_useDedicatedExecutor = false;
6
+ public static final boolean AsyncStorage_useNextStorage = false;
7
+ public static final boolean IS_NEW_ARCHITECTURE_ENABLED = false;
8
+ }
@@ -0,0 +1,47 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Update this file after changing NativeAsyncStorageModule.ts to match the version generated by codegen.
6
+ */
7
+
8
+ package com.reactnativecommunity.asyncstorage;
9
+
10
+ import com.facebook.proguard.annotations.DoNotStrip;
11
+ import com.facebook.react.bridge.Callback;
12
+ import com.facebook.react.bridge.ReactApplicationContext;
13
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
14
+ import com.facebook.react.bridge.ReactMethod;
15
+ import com.facebook.react.bridge.ReactModuleWithSpec;
16
+ import com.facebook.react.bridge.ReadableArray;
17
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
18
+
19
+ public abstract class NativeAsyncStorageModuleSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule {
20
+ public NativeAsyncStorageModuleSpec(ReactApplicationContext reactContext) {
21
+ super(reactContext);
22
+ }
23
+
24
+ @ReactMethod
25
+ @DoNotStrip
26
+ public abstract void multiGet(ReadableArray keys, Callback callback);
27
+
28
+ @ReactMethod
29
+ @DoNotStrip
30
+ public abstract void multiSet(ReadableArray kvPairs, Callback callback);
31
+
32
+ @ReactMethod
33
+ @DoNotStrip
34
+ public abstract void multiRemove(ReadableArray keys, Callback callback);
35
+
36
+ @ReactMethod
37
+ @DoNotStrip
38
+ public abstract void multiMerge(ReadableArray kvPairs, Callback callback);
39
+
40
+ @ReactMethod
41
+ @DoNotStrip
42
+ public abstract void getAllKeys(Callback callback);
43
+
44
+ @ReactMethod
45
+ @DoNotStrip
46
+ public abstract void clear(Callback callback);
47
+ }
@@ -0,0 +1,163 @@
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
+ }
@@ -0,0 +1,40 @@
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
+ }