@metarouter/react-native-sdk 0.1.15 → 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.
Files changed (276) hide show
  1. package/README.md +49 -22
  2. package/lib/MetaRouter.d.ts +2 -24
  3. package/lib/MetaRouter.d.ts.map +1 -1
  4. package/lib/MetaRouter.js +5 -52
  5. package/lib/analytics/IdentityManager.d.ts +14 -0
  6. package/lib/analytics/IdentityManager.d.ts.map +1 -0
  7. package/lib/analytics/IdentityManager.js +38 -0
  8. package/lib/analytics/MetaRouterAnalyticsClient.d.ts +45 -0
  9. package/lib/analytics/MetaRouterAnalyticsClient.d.ts.map +1 -0
  10. package/lib/analytics/MetaRouterAnalyticsClient.js +127 -0
  11. package/lib/analytics/enrichEvent.d.ts +3 -0
  12. package/lib/analytics/enrichEvent.d.ts.map +1 -0
  13. package/lib/analytics/enrichEvent.js +14 -0
  14. package/lib/analytics/init.d.ts +5 -0
  15. package/lib/analytics/init.d.ts.map +1 -0
  16. package/lib/analytics/init.js +32 -0
  17. package/lib/analytics/proxy/proxyClient.d.ts +4 -0
  18. package/lib/analytics/proxy/proxyClient.d.ts.map +1 -0
  19. package/lib/{proxyClient.js → analytics/proxy/proxyClient.js} +3 -4
  20. package/lib/analytics/types.d.ts +52 -0
  21. package/lib/analytics/types.d.ts.map +1 -0
  22. package/lib/analytics/types.js +1 -0
  23. package/lib/analytics/utils/anonymousId.d.ts +2 -0
  24. package/lib/analytics/utils/anonymousId.d.ts.map +1 -0
  25. package/lib/analytics/utils/anonymousId.js +11 -0
  26. package/lib/analytics/utils/contextInfo.d.ts +19 -0
  27. package/lib/analytics/utils/contextInfo.d.ts.map +1 -0
  28. package/lib/analytics/utils/contextInfo.js +35 -0
  29. package/lib/analytics/utils/logger.d.ts +4 -0
  30. package/lib/analytics/utils/logger.d.ts.map +1 -0
  31. package/lib/analytics/utils/logger.js +12 -0
  32. package/lib/analytics/utils/retry.d.ts +2 -0
  33. package/lib/analytics/utils/retry.d.ts.map +1 -0
  34. package/lib/analytics/utils/retry.js +17 -0
  35. package/lib/analytics/utils/timezone.d.ts +2 -0
  36. package/lib/analytics/utils/timezone.d.ts.map +1 -0
  37. package/lib/analytics/utils/timezone.js +8 -0
  38. package/lib/index.d.ts +6 -2
  39. package/lib/index.d.ts.map +1 -1
  40. package/lib/index.js +4 -2
  41. package/lib/react/context.d.ts +9 -0
  42. package/lib/react/context.d.ts.map +1 -0
  43. package/lib/react/context.js +12 -0
  44. package/lib/react/useMetaRouter.d.ts +3 -0
  45. package/lib/react/useMetaRouter.d.ts.map +1 -0
  46. package/lib/react/useMetaRouter.js +8 -0
  47. package/lib/types.d.ts +9 -0
  48. package/lib/types.d.ts.map +1 -0
  49. package/lib/types.js +1 -0
  50. package/package.json +11 -12
  51. package/MetaRouterReactNativeSDK.podspec +0 -28
  52. package/android/build/generated/ksp/debug/java/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl.java +0 -244
  53. package/android/build/generated/ksp/debug/java/com/reactnativecommunity/asyncstorage/next/StorageDb_Impl.java +0 -165
  54. package/android/build/generated/source/buildConfig/debug/com/metarouter/reactnativesdk/BuildConfig.java +0 -10
  55. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +0 -7
  56. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +0 -18
  57. package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +0 -6
  58. package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +0 -1
  59. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  60. package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
  61. package/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +0 -0
  62. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -1
  63. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
  64. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/metarouter/reactnativesdk/BuildConfig.class +0 -0
  65. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/metarouter/reactnativesdk/MetaRouterReactNativeSDKPackage.class +0 -0
  66. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncLocalStorageUtil.class +0 -0
  67. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageErrorUtil.class +0 -0
  68. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageExpoMigration.class +0 -0
  69. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule$1.class +0 -0
  70. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule$2.class +0 -0
  71. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule$3.class +0 -0
  72. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule$4.class +0 -0
  73. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule$5.class +0 -0
  74. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule$6.class +0 -0
  75. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStorageModule.class +0 -0
  76. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStoragePackage$1.class +0 -0
  77. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.class +0 -0
  78. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/BuildConfig.class +0 -0
  79. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/NativeAsyncStorageModuleSpec.class +0 -0
  80. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/ReactDatabaseSupplier.class +0 -0
  81. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/SerialExecutor$1.class +0 -0
  82. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/SerialExecutor.class +0 -0
  83. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$1.class +0 -0
  84. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$2.class +0 -0
  85. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$3.class +0 -0
  86. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$4.class +0 -0
  87. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$5.class +0 -0
  88. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$6.class +0 -0
  89. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl$7.class +0 -0
  90. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDao_Impl.class +0 -0
  91. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDb_Impl$1.class +0 -0
  92. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactnativecommunity/asyncstorage/next/StorageDb_Impl.class +0 -0
  93. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/linusu/RNGetRandomValuesModule.class +0 -0
  94. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/linusu/RNGetRandomValuesPackage.class +0 -0
  95. package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +0 -2
  96. package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +0 -7
  97. package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +0 -7
  98. package/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +0 -1
  99. package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +0 -1
  100. package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +0 -1
  101. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  102. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
  103. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
  104. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
  105. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  106. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
  107. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
  108. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  109. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  110. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  111. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  112. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  113. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  114. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
  115. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  116. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  117. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  118. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  119. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  120. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  121. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
  122. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab +0 -0
  123. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream +0 -0
  124. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len +0 -0
  125. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len +0 -0
  126. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
  127. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i +0 -0
  128. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i.len +0 -0
  129. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  130. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  131. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  132. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  133. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  134. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  135. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
  136. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab +0 -0
  137. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.keystream +0 -0
  138. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.keystream.len +0 -0
  139. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.len +0 -0
  140. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.values.at +0 -0
  141. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab_i +0 -0
  142. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab_i.len +0 -0
  143. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab +0 -0
  144. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.keystream +0 -0
  145. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.keystream.len +0 -0
  146. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.len +0 -0
  147. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab.values.at +0 -0
  148. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab_i +0 -0
  149. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/package-parts.tab_i.len +0 -0
  150. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  151. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  152. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  153. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  154. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  155. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  156. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
  157. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  158. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
  159. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
  160. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
  161. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  162. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
  163. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
  164. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  165. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  166. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  167. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
  168. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  169. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
  170. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
  171. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  172. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  173. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  174. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
  175. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  176. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  177. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
  178. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +0 -2
  179. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  180. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
  181. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
  182. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
  183. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  184. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
  185. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
  186. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  187. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  188. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  189. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  190. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  191. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
  192. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
  193. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  194. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  195. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  196. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  197. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  198. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  199. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
  200. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  201. package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
  202. package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -16
  203. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  204. package/android/build/tmp/kotlin-classes/debug/META-INF/metarouter_react-native-sdk_debug.kotlin_module +0 -0
  205. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/ArgumentHelpersKt.class +0 -0
  206. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/AsyncStorageAccess.class +0 -0
  207. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/AsyncStorageError$Companion.class +0 -0
  208. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/AsyncStorageError.class +0 -0
  209. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/Entry.class +0 -0
  210. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/ErrorHelpersKt$createExceptionHandler$$inlined$CoroutineExceptionHandler$1.class +0 -0
  211. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/ErrorHelpersKt.class +0 -0
  212. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/MIGRATION_TO_NEXT.class +0 -0
  213. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageDao$DefaultImpls.class +0 -0
  214. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageDao$mergeValues$1.class +0 -0
  215. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageDao.class +0 -0
  216. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageDb$Companion.class +0 -0
  217. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageDb.class +0 -0
  218. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$Companion.class +0 -0
  219. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$clear$1.class +0 -0
  220. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$getAllKeys$1.class +0 -0
  221. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$multiGet$1.class +0 -0
  222. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$multiMerge$1.class +0 -0
  223. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$multiRemove$1.class +0 -0
  224. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule$multiSet$1.class +0 -0
  225. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageModule.class +0 -0
  226. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageSupplier$Companion.class +0 -0
  227. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageSupplier.class +0 -0
  228. package/android/build/tmp/kotlin-classes/debug/com/reactnativecommunity/asyncstorage/next/StorageSupplierKt.class +0 -0
  229. package/android/build/tmp/kotlin-classes/debug/com/segmentanalyticsreactnative/AnalyticsReactNativeModule$onInitialized$1.class +0 -0
  230. package/android/build/tmp/kotlin-classes/debug/com/segmentanalyticsreactnative/AnalyticsReactNativeModule$toHexString$1.class +0 -0
  231. package/android/build/tmp/kotlin-classes/debug/com/segmentanalyticsreactnative/AnalyticsReactNativeModule.class +0 -0
  232. package/android/build/tmp/kotlin-classes/debug/com/segmentanalyticsreactnative/AnalyticsReactNativePackage$createNativeModules$1.class +0 -0
  233. package/android/build/tmp/kotlin-classes/debug/com/segmentanalyticsreactnative/AnalyticsReactNativePackage.class +0 -0
  234. package/android/build/tmp/kotlin-classes/debug/com/segmentanalyticsreactnative/ConnectionType.class +0 -0
  235. package/android/build/tmp/kotlin-classes/debug/com/sovranreactnative/Sovran$Action.class +0 -0
  236. package/android/build/tmp/kotlin-classes/debug/com/sovranreactnative/Sovran$createNativeModules$1.class +0 -0
  237. package/android/build/tmp/kotlin-classes/debug/com/sovranreactnative/Sovran.class +0 -0
  238. package/android/build/tmp/kotlin-classes/debug/com/sovranreactnative/SovranModule$Companion.class +0 -0
  239. package/android/build/tmp/kotlin-classes/debug/com/sovranreactnative/SovranModule$onInitialized$1.class +0 -0
  240. package/android/build/tmp/kotlin-classes/debug/com/sovranreactnative/SovranModule.class +0 -0
  241. package/android/build.gradle +0 -55
  242. package/android/consumer-rules.pro +0 -0
  243. package/android/src/main/java/com/metarouter/reactnativesdk/MetaRouterReactNativeSDKPackage.java +0 -54
  244. package/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncLocalStorageUtil.java +0 -178
  245. package/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageErrorUtil.java +0 -45
  246. package/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageExpoMigration.java +0 -154
  247. package/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java +0 -410
  248. package/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java +0 -93
  249. package/android/src/main/java/com/reactnativecommunity/asyncstorage/BuildConfig.java +0 -8
  250. package/android/src/main/java/com/reactnativecommunity/asyncstorage/NativeAsyncStorageModuleSpec.java +0 -47
  251. package/android/src/main/java/com/reactnativecommunity/asyncstorage/ReactDatabaseSupplier.java +0 -163
  252. package/android/src/main/java/com/reactnativecommunity/asyncstorage/SerialExecutor.java +0 -40
  253. package/android/src/main/java/com/reactnativecommunity/asyncstorage/build.gradle +0 -122
  254. package/android/src/main/java/com/reactnativecommunity/asyncstorage/config.gradle +0 -125
  255. package/android/src/main/java/com/reactnativecommunity/asyncstorage/next/ArgumentHelpers.kt +0 -86
  256. package/android/src/main/java/com/reactnativecommunity/asyncstorage/next/ErrorHelpers.kt +0 -39
  257. package/android/src/main/java/com/reactnativecommunity/asyncstorage/next/StorageModule.kt +0 -94
  258. package/android/src/main/java/com/reactnativecommunity/asyncstorage/next/StorageSupplier.kt +0 -161
  259. package/android/src/main/java/com/segmentanalyticsreactnative/AnalyticsReactNativeModule.kt +0 -267
  260. package/android/src/main/java/com/segmentanalyticsreactnative/AnalyticsReactNativePackage.kt +0 -43
  261. package/android/src/main/java/com/sovranreactnative/Sovran.kt +0 -45
  262. package/android/src/main/java/com/sovranreactnative/SovranModule.kt +0 -55
  263. package/android/src/main/java/org/linusu/RNGetRandomValuesModule.java +0 -36
  264. package/android/src/main/java/org/linusu/RNGetRandomValuesPackage.java +0 -28
  265. package/lib/MetaRouterPlugin.d.ts +0 -10
  266. package/lib/MetaRouterPlugin.d.ts.map +0 -1
  267. package/lib/MetaRouterPlugin.js +0 -23
  268. package/lib/context.d.ts +0 -8
  269. package/lib/context.d.ts.map +0 -1
  270. package/lib/context.js +0 -9
  271. package/lib/createMetaRouterClient.d.ts +0 -3
  272. package/lib/createMetaRouterClient.d.ts.map +0 -1
  273. package/lib/createMetaRouterClient.js +0 -7
  274. package/lib/proxyClient.d.ts +0 -4
  275. package/lib/proxyClient.d.ts.map +0 -1
  276. package/react-native.config.js +0 -37
@@ -1,16 +0,0 @@
1
- -- Merging decision tree log ---
2
- manifest
3
- ADDED from /Users/choudlette/development/metarouter/ion/packages/demo-mobile/react-native/node_modules/@metarouter/react-native-sdk/android/build/intermediates/tmp/ProcessLibraryManifest/debug/tempAndroidManifest16060778903747402948.xml:2:13-83
4
- INJECTED from /Users/choudlette/development/metarouter/ion/packages/demo-mobile/react-native/node_modules/@metarouter/react-native-sdk/android/build/intermediates/tmp/ProcessLibraryManifest/debug/tempAndroidManifest16060778903747402948.xml:2:13-83
5
- package
6
- INJECTED from /Users/choudlette/development/metarouter/ion/packages/demo-mobile/react-native/node_modules/@metarouter/react-native-sdk/android/build/intermediates/tmp/ProcessLibraryManifest/debug/tempAndroidManifest16060778903747402948.xml
7
- xmlns:android
8
- ADDED from /Users/choudlette/development/metarouter/ion/packages/demo-mobile/react-native/node_modules/@metarouter/react-native-sdk/android/build/intermediates/tmp/ProcessLibraryManifest/debug/tempAndroidManifest16060778903747402948.xml:2:23-81
9
- uses-sdk
10
- INJECTED from /Users/choudlette/development/metarouter/ion/packages/demo-mobile/react-native/node_modules/@metarouter/react-native-sdk/android/build/intermediates/tmp/ProcessLibraryManifest/debug/tempAndroidManifest16060778903747402948.xml reason: use-sdk injection requested
11
- INJECTED from /Users/choudlette/development/metarouter/ion/packages/demo-mobile/react-native/node_modules/@metarouter/react-native-sdk/android/build/intermediates/tmp/ProcessLibraryManifest/debug/tempAndroidManifest16060778903747402948.xml
12
- INJECTED from /Users/choudlette/development/metarouter/ion/packages/demo-mobile/react-native/node_modules/@metarouter/react-native-sdk/android/build/intermediates/tmp/ProcessLibraryManifest/debug/tempAndroidManifest16060778903747402948.xml
13
- android:targetSdkVersion
14
- INJECTED from /Users/choudlette/development/metarouter/ion/packages/demo-mobile/react-native/node_modules/@metarouter/react-native-sdk/android/build/intermediates/tmp/ProcessLibraryManifest/debug/tempAndroidManifest16060778903747402948.xml
15
- android:minSdkVersion
16
- INJECTED from /Users/choudlette/development/metarouter/ion/packages/demo-mobile/react-native/node_modules/@metarouter/react-native-sdk/android/build/intermediates/tmp/ProcessLibraryManifest/debug/tempAndroidManifest16060778903747402948.xml
@@ -1,55 +0,0 @@
1
- buildscript {
2
- repositories {
3
- google()
4
- mavenCentral()
5
- gradlePluginPortal()
6
- }
7
- dependencies {
8
- classpath "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:1.9.25-1.0.20"
9
- }
10
- }
11
-
12
- apply plugin: 'com.android.library'
13
- apply plugin: 'kotlin-android'
14
- apply plugin: 'com.google.devtools.ksp'
15
-
16
- android {
17
- namespace 'com.metarouter.reactnativesdk'
18
- compileSdkVersion 33
19
-
20
- defaultConfig {
21
- minSdkVersion 21
22
- targetSdkVersion 33
23
- versionCode 1
24
- versionName "0.1.0"
25
- }
26
-
27
- compileOptions {
28
- sourceCompatibility JavaVersion.VERSION_1_8
29
- targetCompatibility JavaVersion.VERSION_1_8
30
- }
31
-
32
- kotlin {
33
- jvmToolchain(17)
34
- }
35
- }
36
-
37
- repositories {
38
- google()
39
- mavenCentral()
40
- maven { url "https://www.jitpack.io" }
41
- }
42
-
43
- dependencies {
44
- implementation 'com.facebook.react:react-native:+'
45
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
46
-
47
- // AsyncStorage + Room support
48
- def roomVersion = "2.5.0"
49
- def coroutinesVersion = "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
50
-
51
- implementation "androidx.room:room-runtime:$roomVersion"
52
- implementation "androidx.room:room-ktx:$roomVersion"
53
- ksp "androidx.room:room-compiler:$roomVersion"
54
- implementation coroutinesVersion
55
- }
File without changes
@@ -1,54 +0,0 @@
1
- package com.metarouter.reactnativesdk;
2
-
3
- import com.facebook.react.ReactPackage;
4
- import com.facebook.react.bridge.NativeModule;
5
- import com.facebook.react.bridge.ReactApplicationContext;
6
- import com.facebook.react.uimanager.ViewManager;
7
-
8
- import java.util.ArrayList;
9
- import java.util.Arrays;
10
- import java.util.List;
11
-
12
- // Import the bundled packages
13
- import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
14
- import com.segmentanalyticsreactnative.AnalyticsReactNativePackage;
15
- import com.sovranreactnative.Sovran;
16
- import org.linusu.RNGetRandomValuesPackage;
17
-
18
- public class MetaRouterReactNativeSDKPackage implements ReactPackage {
19
-
20
- // Create instances of bundled packages
21
- private final AsyncStoragePackage asyncStoragePackage = new AsyncStoragePackage();
22
- private final AnalyticsReactNativePackage analyticsPackage = new AnalyticsReactNativePackage();
23
- private final Sovran sovranPackage = new Sovran();
24
- private final RNGetRandomValuesPackage randomValuesPackage = new RNGetRandomValuesPackage();
25
-
26
- @Override
27
- public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
28
- List<NativeModule> modules = new ArrayList<>();
29
-
30
- // Add modules from all bundled packages
31
- modules.addAll(asyncStoragePackage.createNativeModules(reactContext));
32
- modules.addAll(analyticsPackage.createNativeModules(reactContext));
33
- modules.addAll(sovranPackage.createNativeModules(reactContext));
34
- modules.addAll(randomValuesPackage.createNativeModules(reactContext));
35
-
36
- // Add your own SDK modules here if you have any
37
- // modules.add(new MetaRouterModule(reactContext));
38
-
39
- return modules;
40
- }
41
-
42
- @Override
43
- public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
44
- List<ViewManager> viewManagers = new ArrayList<>();
45
-
46
- // Add view managers from all bundled packages
47
- viewManagers.addAll(asyncStoragePackage.createViewManagers(reactContext));
48
- viewManagers.addAll(analyticsPackage.createViewManagers(reactContext));
49
- viewManagers.addAll(sovranPackage.createViewManagers(reactContext));
50
- viewManagers.addAll(randomValuesPackage.createViewManagers(reactContext));
51
-
52
- return viewManagers;
53
- }
54
- }
@@ -1,178 +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 javax.annotation.Nullable;
11
- import java.io.File;
12
- import java.util.Arrays;
13
- import java.util.Iterator;
14
- import android.content.ContentValues;
15
- import android.content.Context;
16
- import android.database.Cursor;
17
- import android.database.sqlite.SQLiteDatabase;
18
- import android.os.Build;
19
- import android.text.TextUtils;
20
- import android.util.Log;
21
- import com.facebook.react.bridge.ReadableArray;
22
- import org.json.JSONException;
23
- import org.json.JSONObject;
24
- import static com.reactnativecommunity.asyncstorage.ReactDatabaseSupplier.KEY_COLUMN;
25
- import static com.reactnativecommunity.asyncstorage.ReactDatabaseSupplier.TABLE_CATALYST;
26
- import static com.reactnativecommunity.asyncstorage.ReactDatabaseSupplier.VALUE_COLUMN;
27
-
28
- /**
29
- * Helper for database operations.
30
- */
31
- public class AsyncLocalStorageUtil {
32
-
33
- /**
34
- * Build the String required for an SQL select statement:
35
- * WHERE key IN (?, ?, ..., ?)
36
- * without 'WHERE' and with selectionCount '?'
37
- */
38
- /* package */ static String buildKeySelection(int selectionCount) {
39
- String[] list = new String[selectionCount];
40
- Arrays.fill(list, "?");
41
- return KEY_COLUMN + " IN (" + TextUtils.join(", ", list) + ")";
42
- }
43
-
44
- /**
45
- * Build the String[] arguments needed for an SQL selection, i.e.:
46
- * {a, b, c}
47
- * to be used in the SQL select statement: WHERE key in (?, ?, ?)
48
- */
49
- /* package */ static String[] buildKeySelectionArgs(ReadableArray keys, int start, int count) {
50
- String[] selectionArgs = new String[count];
51
- for (int keyIndex = 0; keyIndex < count; keyIndex++) {
52
- selectionArgs[keyIndex] = keys.getString(start + keyIndex);
53
- }
54
- return selectionArgs;
55
- }
56
-
57
- /**
58
- * Returns the value of the given key, or null if not found.
59
- */
60
- public static @Nullable String getItemImpl(SQLiteDatabase db, String key) {
61
- String[] columns = {VALUE_COLUMN};
62
- String[] selectionArgs = {key};
63
-
64
- Cursor cursor = db.query(
65
- TABLE_CATALYST,
66
- columns,
67
- KEY_COLUMN + "=?",
68
- selectionArgs,
69
- null,
70
- null,
71
- null);
72
-
73
- try {
74
- if (!cursor.moveToFirst()) {
75
- return null;
76
- } else {
77
- return cursor.getString(0);
78
- }
79
- } finally {
80
- cursor.close();
81
- }
82
- }
83
-
84
- /**
85
- * Sets the value for the key given, returns true if successful, false otherwise.
86
- */
87
- /* package */ static boolean setItemImpl(SQLiteDatabase db, String key, String value) {
88
- ContentValues contentValues = new ContentValues();
89
- contentValues.put(KEY_COLUMN, key);
90
- contentValues.put(VALUE_COLUMN, value);
91
-
92
- long inserted = db.insertWithOnConflict(
93
- TABLE_CATALYST,
94
- null,
95
- contentValues,
96
- SQLiteDatabase.CONFLICT_REPLACE);
97
-
98
- return (-1 != inserted);
99
- }
100
-
101
- /**
102
- * Does the actual merge of the (key, value) pair with the value stored in the database.
103
- * NB: This assumes that a database lock is already in effect!
104
- * @return the errorCode of the operation
105
- */
106
- /* package */ static boolean mergeImpl(SQLiteDatabase db, String key, String value)
107
- throws JSONException {
108
- String oldValue = getItemImpl(db, key);
109
- String newValue;
110
-
111
- if (oldValue == null) {
112
- newValue = value;
113
- } else {
114
- JSONObject oldJSON = new JSONObject(oldValue);
115
- JSONObject newJSON = new JSONObject(value);
116
- deepMergeInto(oldJSON, newJSON);
117
- newValue = oldJSON.toString();
118
- }
119
-
120
- return setItemImpl(db, key, newValue);
121
- }
122
-
123
- /**
124
- * Merges two {@link JSONObject}s. The newJSON object will be merged with the oldJSON object by
125
- * either overriding its values, or merging them (if the values of the same key in both objects
126
- * are of type {@link JSONObject}). oldJSON will contain the result of this merge.
127
- */
128
- private static void deepMergeInto(JSONObject oldJSON, JSONObject newJSON)
129
- throws JSONException {
130
- Iterator<?> keys = newJSON.keys();
131
- while (keys.hasNext()) {
132
- String key = (String) keys.next();
133
-
134
- JSONObject newJSONObject = newJSON.optJSONObject(key);
135
- JSONObject oldJSONObject = oldJSON.optJSONObject(key);
136
- if (newJSONObject != null && oldJSONObject != null) {
137
- deepMergeInto(oldJSONObject, newJSONObject);
138
- oldJSON.put(key, oldJSONObject);
139
- } else {
140
- oldJSON.put(key, newJSON.get(key));
141
- }
142
- }
143
- }
144
- /**
145
- * From Pie and up, Android started to use Write-ahead logging (WAL), instead of journal rollback
146
- * for atomic commits and rollbacks.
147
- * Basically, WAL does not write directly to the database file, rather to the supporting WAL file.
148
- * Because of that, migration to the next storage might not be successful, because the content of
149
- * RKStorage might be still in WAL file instead. Committing all data from WAL to db file is called
150
- * a "checkpoint" and is done automatically (by default) when the WAL file reaches a threshold
151
- * size of 1000 pages.
152
- * More here: https://sqlite.org/wal.html
153
- *
154
- * This helper will force checkpoint on RKStorage, if Next storage file does not exists yet.
155
- */
156
- public static void verifyAndForceSqliteCheckpoint(Context ctx) {
157
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
158
- Log.i("AsyncStorage_Next", "SQLite checkpoint not required on this API version.");
159
- }
160
-
161
- File nextStorageFile = ctx.getDatabasePath("AsyncStorage");
162
- File currentStorageFile = ctx.getDatabasePath(ReactDatabaseSupplier.DATABASE_NAME);
163
- boolean isCheckpointRequired = !nextStorageFile.exists() && currentStorageFile.exists();
164
- if (!isCheckpointRequired) {
165
- Log.i("AsyncStorage_Next", "SQLite checkpoint not required.");
166
- return;
167
- }
168
-
169
- try {
170
- ReactDatabaseSupplier supplier = ReactDatabaseSupplier.getInstance(ctx);
171
- supplier.get().rawQuery("PRAGMA wal_checkpoint", null).close();
172
- supplier.closeDatabase();
173
- Log.i("AsyncStorage_Next", "Forcing SQLite checkpoint successful.");
174
- } catch (Exception e) {
175
- Log.w("AsyncStorage_Next", "Could not force checkpoint on RKStorage, the Next storage might not migrate the data properly: " + e.getMessage());
176
- }
177
- }
178
- }
@@ -1,45 +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 javax.annotation.Nullable;
11
-
12
- import com.facebook.react.bridge.Arguments;
13
- import com.facebook.react.bridge.WritableMap;
14
-
15
- /**
16
- * Helper class for database errors.
17
- */
18
- public class AsyncStorageErrorUtil {
19
-
20
- /**
21
- * Create Error object to be passed back to the JS callback.
22
- */
23
- /* package */ static WritableMap getError(@Nullable String key, String errorMessage) {
24
- WritableMap errorMap = Arguments.createMap();
25
- errorMap.putString("message", errorMessage);
26
- if (key != null) {
27
- errorMap.putString("key", key);
28
- }
29
- return errorMap;
30
- }
31
-
32
- /* package */ static WritableMap getInvalidKeyError(@Nullable String key) {
33
- return getError(key, "Invalid key");
34
- }
35
-
36
- /* package */ static WritableMap getInvalidValueError(@Nullable String key) {
37
- return getError(key, "Invalid Value");
38
- }
39
-
40
- /* package */ static WritableMap getDBError(@Nullable String key) {
41
- return getError(key, "Database Error");
42
- }
43
-
44
-
45
- }
@@ -1,154 +0,0 @@
1
- package com.reactnativecommunity.asyncstorage;
2
-
3
- import android.content.Context;
4
- import android.os.Build;
5
- import android.util.Log;
6
-
7
- import androidx.annotation.RequiresApi;
8
-
9
- import java.io.File;
10
- import java.io.FileInputStream;
11
- import java.io.FileOutputStream;
12
- import java.io.IOException;
13
- import java.nio.channels.FileChannel;
14
- import java.nio.file.Files;
15
- import java.nio.file.attribute.BasicFileAttributes;
16
- import java.util.ArrayList;
17
-
18
- // A utility class that migrates a scoped AsyncStorage database to RKStorage.
19
- // This utility only runs if the RKStorage file has not been created yet.
20
- public class AsyncStorageExpoMigration {
21
- static final String LOG_TAG = "AsyncStorageExpoMigration";
22
-
23
- public static void migrate(Context context) {
24
- // Only migrate if the default async storage file does not exist.
25
- if (isAsyncStorageDatabaseCreated(context)) {
26
- return;
27
- }
28
-
29
- ArrayList<File> expoDatabases = getExpoDatabases(context);
30
-
31
- File expoDatabase = getLastModifiedFile(expoDatabases);
32
-
33
- if (expoDatabase == null) {
34
- Log.v(LOG_TAG, "No scoped database found");
35
- return;
36
- }
37
-
38
- try {
39
- // Create the storage file
40
- ReactDatabaseSupplier.getInstance(context).get();
41
- copyFile(new FileInputStream(expoDatabase), new FileOutputStream(context.getDatabasePath(ReactDatabaseSupplier.DATABASE_NAME)));
42
- Log.v(LOG_TAG, "Migrated most recently modified database " + expoDatabase.getName() + " to RKStorage");
43
- } catch (Exception e) {
44
- Log.v(LOG_TAG, "Failed to migrate scoped database " + expoDatabase.getName());
45
- e.printStackTrace();
46
- return;
47
- }
48
-
49
- try {
50
- for (File file : expoDatabases) {
51
- if (file.delete()) {
52
- Log.v(LOG_TAG, "Deleted scoped database " + file.getName());
53
- } else {
54
- Log.v(LOG_TAG, "Failed to delete scoped database " + file.getName());
55
- }
56
- }
57
- } catch (Exception e) {
58
- e.printStackTrace();
59
- }
60
-
61
- Log.v(LOG_TAG, "Completed the scoped AsyncStorage migration");
62
- }
63
-
64
- private static boolean isAsyncStorageDatabaseCreated(Context context) {
65
- return context.getDatabasePath(ReactDatabaseSupplier.DATABASE_NAME).exists();
66
- }
67
-
68
- // Find all database files that the user may have created while using Expo.
69
- private static ArrayList<File> getExpoDatabases(Context context) {
70
- ArrayList<File> scopedDatabases = new ArrayList<>();
71
- try {
72
- File databaseDirectory = context.getDatabasePath("noop").getParentFile();
73
- File[] directoryListing = databaseDirectory.listFiles();
74
- if (directoryListing != null) {
75
- for (File child : directoryListing) {
76
- // Find all databases matching the Expo scoped key, and skip any database journals.
77
- if (child.getName().startsWith("RKStorage-scoped-experience-") && !child.getName().endsWith("-journal")) {
78
- scopedDatabases.add(child);
79
- }
80
- }
81
- }
82
- } catch (Exception e) {
83
- // Just in case anything happens catch and print, file system rules can tend to be different across vendors.
84
- e.printStackTrace();
85
- }
86
- return scopedDatabases;
87
- }
88
-
89
- // Returns the most recently modified file.
90
- // If a user publishes an app with Expo, then changes the slug
91
- // and publishes again, a new database will be created.
92
- // We want to select the most recent database and migrate it to RKStorage.
93
- private static File getLastModifiedFile(ArrayList<File> files) {
94
- if (files.size() == 0) {
95
- return null;
96
- }
97
- long lastMod = -1;
98
- File lastModFile = null;
99
- for (File child : files) {
100
- long modTime = getLastModifiedTimeInMillis(child);
101
- if (modTime > lastMod) {
102
- lastMod = modTime;
103
- lastModFile = child;
104
- }
105
- }
106
- if (lastModFile != null) {
107
- return lastModFile;
108
- }
109
-
110
- return files.get(0);
111
- }
112
-
113
- private static long getLastModifiedTimeInMillis(File file) {
114
- try {
115
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
116
- return getLastModifiedTimeFromBasicFileAttrs(file);
117
- } else {
118
- return file.lastModified();
119
- }
120
- } catch (Exception e) {
121
- e.printStackTrace();
122
- return -1;
123
- }
124
- }
125
-
126
- @RequiresApi(Build.VERSION_CODES.O)
127
- private static long getLastModifiedTimeFromBasicFileAttrs(File file) {
128
- try {
129
- return Files.readAttributes(file.toPath(), BasicFileAttributes.class).creationTime().toMillis();
130
- } catch (Exception e) {
131
- return -1;
132
- }
133
- }
134
-
135
- private static void copyFile(FileInputStream fromFile, FileOutputStream toFile) throws IOException {
136
- FileChannel fromChannel = null;
137
- FileChannel toChannel = null;
138
- try {
139
- fromChannel = fromFile.getChannel();
140
- toChannel = toFile.getChannel();
141
- fromChannel.transferTo(0, fromChannel.size(), toChannel);
142
- } finally {
143
- try {
144
- if (fromChannel != null) {
145
- fromChannel.close();
146
- }
147
- } finally {
148
- if (toChannel != null) {
149
- toChannel.close();
150
- }
151
- }
152
- }
153
- }
154
- }