@metarouter/react-native-sdk 0.1.16 → 0.1.18

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 +91 -23
  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 +51 -0
  8. package/lib/analytics/MetaRouterAnalyticsClient.d.ts +64 -0
  9. package/lib/analytics/MetaRouterAnalyticsClient.d.ts.map +1 -0
  10. package/lib/analytics/MetaRouterAnalyticsClient.js +196 -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 +36 -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 +54 -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 +26 -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 +5 -0
  30. package/lib/analytics/utils/logger.d.ts.map +1 -0
  31. package/lib/analytics/utils/logger.js +16 -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 +7 -2
  39. package/lib/index.d.ts.map +1 -1
  40. package/lib/index.js +5 -2
  41. package/lib/react/context.d.ts +8 -0
  42. package/lib/react/context.d.ts.map +1 -0
  43. package/lib/react/context.js +5 -0
  44. package/lib/react/useMetaRouter.d.ts +5 -0
  45. package/lib/react/useMetaRouter.d.ts.map +1 -0
  46. package/lib/react/useMetaRouter.js +10 -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 -26
  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,161 +0,0 @@
1
- package com.reactnativecommunity.asyncstorage.next
2
-
3
- import android.content.Context
4
- import android.util.Log
5
- import androidx.room.ColumnInfo
6
- import androidx.room.Dao
7
- import androidx.room.Database
8
- import androidx.room.Entity
9
- import androidx.room.Insert
10
- import androidx.room.OnConflictStrategy
11
- import androidx.room.PrimaryKey
12
- import androidx.room.Query
13
- import androidx.room.Room
14
- import androidx.room.RoomDatabase
15
- import androidx.room.Transaction
16
- import androidx.room.migration.Migration
17
- import androidx.sqlite.db.SupportSQLiteDatabase
18
- import org.json.JSONObject
19
-
20
- private const val DATABASE_VERSION = 2
21
- private const val DATABASE_NAME = "AsyncStorage"
22
- private const val TABLE_NAME = "Storage"
23
- private const val COLUMN_KEY = "key"
24
- private const val COLUMN_VALUE = "value"
25
-
26
-
27
- @Entity(tableName = TABLE_NAME)
28
- data class Entry(
29
- @PrimaryKey @ColumnInfo(name = COLUMN_KEY) val key: String,
30
- @ColumnInfo(name = COLUMN_VALUE) val value: String?
31
- )
32
-
33
- @Dao
34
- internal interface StorageDao {
35
-
36
- @Transaction
37
- @Query("SELECT * FROM $TABLE_NAME WHERE `$COLUMN_KEY` IN (:keys)")
38
- suspend fun getValues(keys: List<String>): List<Entry>
39
-
40
- @Transaction
41
- @Insert(onConflict = OnConflictStrategy.REPLACE)
42
- suspend fun setValues(entries: List<Entry>)
43
-
44
- @Transaction
45
- @Query("DELETE FROM $TABLE_NAME WHERE `$COLUMN_KEY` in (:keys)")
46
- suspend fun removeValues(keys: List<String>)
47
-
48
- @Transaction
49
- suspend fun mergeValues(entries: List<Entry>) {
50
- val currentDbEntries = getValues(entries.map { it.key })
51
- val newEntries = mutableListOf<Entry>()
52
-
53
- entries.forEach { newEntry ->
54
- val oldEntry = currentDbEntries.find { it.key == newEntry.key }
55
- if (oldEntry?.value == null) {
56
- newEntries.add(newEntry)
57
- } else if (!oldEntry.value.isValidJson() || !newEntry.value.isValidJson()) {
58
- newEntries.add(newEntry)
59
- } else {
60
- val newValue =
61
- JSONObject(oldEntry.value).mergeWith(JSONObject(newEntry.value)).toString()
62
- newEntries.add(newEntry.copy(value = newValue))
63
- }
64
- }
65
- setValues(newEntries)
66
- }
67
-
68
- @Transaction
69
- @Query("SELECT `$COLUMN_KEY` FROM $TABLE_NAME")
70
- suspend fun getKeys(): List<String>
71
-
72
- @Transaction
73
- @Query("DELETE FROM $TABLE_NAME")
74
- suspend fun clear()
75
- }
76
-
77
-
78
- /**
79
- * Previous version of AsyncStorage is violating the SQL standard (based on bug in SQLite),
80
- * where PrimaryKey ('key' column) should never be null (https://www.sqlite.org/lang_createtable.html#the_primary_key).
81
- * Because of that, we cannot reuse the old DB, because ROOM is guarded against that case (won't compile).
82
- *
83
- * In order to work around this, two steps are necessary:
84
- * - Room DB pre-population from the old database file (https://developer.android.com/training/data-storage/room/prepopulate#from-asset)
85
- * - Version migration, so that we can mark 'key' column as NOT-NULL
86
- *
87
- * This migration will happens only once, when developer enable this feature (when DB is still not created).
88
- */
89
- @Suppress("ClassName")
90
- private object MIGRATION_TO_NEXT : Migration(1, 2) {
91
- override fun migrate(database: SupportSQLiteDatabase) {
92
- val oldTableName = "catalystLocalStorage" // from ReactDatabaseSupplier
93
- database.execSQL("CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`${COLUMN_KEY}` TEXT NOT NULL, `${COLUMN_VALUE}` TEXT, PRIMARY KEY(`${COLUMN_KEY}`));")
94
- // even if the old AsyncStorage has checks for not nullable keys
95
- // make sure we don't copy any, to not fail migration
96
- database.execSQL("DELETE FROM $oldTableName WHERE `${COLUMN_KEY}` IS NULL")
97
- database.execSQL(
98
- """
99
- INSERT INTO $TABLE_NAME (`${COLUMN_KEY}`, `${COLUMN_VALUE}`)
100
- SELECT `${COLUMN_KEY}`, `${COLUMN_VALUE}`
101
- FROM $oldTableName;
102
- """.trimIndent()
103
- )
104
- Log.e("AsyncStorage_Next", "Migration to Next storage completed.")
105
- }
106
- }
107
-
108
- @Database(entities = [Entry::class], version = DATABASE_VERSION, exportSchema = false)
109
- internal abstract class StorageDb : RoomDatabase() {
110
- abstract fun storage(): StorageDao
111
-
112
- companion object {
113
- private var instance: StorageDb? = null
114
-
115
- fun getDatabase(context: Context): StorageDb {
116
- var inst = instance
117
- if (inst != null) {
118
- return inst
119
- }
120
- synchronized(this) {
121
- val oldDbFile = context.getDatabasePath("RKStorage")
122
- val db = Room.databaseBuilder(
123
- context, StorageDb::class.java, DATABASE_NAME
124
- )
125
- if (oldDbFile.exists()) {
126
- // migrate data from old database, if it exists
127
- db.createFromFile(oldDbFile).addMigrations(MIGRATION_TO_NEXT)
128
- }
129
- inst = db.build()
130
- instance = inst
131
- return instance!!
132
- }
133
- }
134
- }
135
- }
136
-
137
- interface AsyncStorageAccess {
138
- suspend fun getValues(keys: List<String>): List<Entry>
139
- suspend fun setValues(entries: List<Entry>)
140
- suspend fun removeValues(keys: List<String>)
141
- suspend fun getKeys(): List<String>
142
- suspend fun clear()
143
- suspend fun mergeValues(entries: List<Entry>)
144
- }
145
-
146
- class StorageSupplier internal constructor(db: StorageDb) : AsyncStorageAccess {
147
- companion object {
148
- fun getInstance(ctx: Context): AsyncStorageAccess {
149
- return StorageSupplier(StorageDb.getDatabase(ctx))
150
- }
151
- }
152
-
153
- private val access = db.storage()
154
-
155
- override suspend fun getValues(keys: List<String>) = access.getValues(keys)
156
- override suspend fun setValues(entries: List<Entry>) = access.setValues(entries)
157
- override suspend fun removeValues(keys: List<String>) = access.removeValues(keys)
158
- override suspend fun mergeValues(entries: List<Entry>) = access.mergeValues(entries)
159
- override suspend fun getKeys() = access.getKeys()
160
- override suspend fun clear() = access.clear()
161
- }
@@ -1,267 +0,0 @@
1
- package com.segmentanalyticsreactnative
2
-
3
- import android.annotation.SuppressLint
4
- import android.app.Activity
5
- import android.content.Context
6
- import android.content.Intent
7
- import android.content.pm.PackageInfo
8
- import android.content.res.Resources
9
- import android.media.MediaDrm
10
- import android.net.ConnectivityManager
11
- import android.net.NetworkCapabilities
12
- import android.net.Uri
13
- import android.os.Build
14
- import android.util.Log
15
- import androidx.core.content.pm.PackageInfoCompat
16
- import com.facebook.react.ReactActivity
17
- import com.facebook.react.ReactApplication
18
- import com.facebook.react.bridge.*
19
- import com.facebook.react.module.annotations.ReactModule
20
- import com.sovranreactnative.SovranModule
21
- import java.lang.Exception
22
- import java.util.*
23
- import java.security.MessageDigest
24
- import java.util.UUID
25
-
26
-
27
- enum class ConnectionType {
28
- Cellular, Unknown, Wifi
29
- }
30
-
31
- @ReactModule(name="AnalyticsReactNative")
32
- class AnalyticsReactNativeModule : ReactContextBaseJavaModule, ActivityEventListener, LifecycleEventListener {
33
-
34
- var onInitialized: () -> Unit = {};
35
-
36
- constructor(reactContext: ReactApplicationContext) : super(reactContext) {
37
- this.pInfo = reactContext.packageManager.getPackageInfo(reactContext.packageName, 0)
38
- // Listen for new intents when app is in the background
39
- reactContext.addActivityEventListener(this)
40
- // Listen for resume events when it is cold started, or in the background
41
- reactContext.addLifecycleEventListener(this)
42
- }
43
-
44
- override fun initialize() {
45
- super.initialize()
46
- onInitialized()
47
- }
48
-
49
- private var isColdLaunch = true
50
- private val pInfo: PackageInfo
51
-
52
- override fun getName(): String {
53
- return "AnalyticsReactNative"
54
- }
55
-
56
- private fun getBuildNumber(): String {
57
- return PackageInfoCompat.getLongVersionCode(pInfo).toString()
58
- }
59
-
60
- fun ByteArray.toHexString() = joinToString("") { "%02x".format(it) }
61
-
62
- /**
63
- * Workaround for not able to get device id on Android 10 or above using DRM API
64
- * {@see https://stackoverflow.com/questions/58103580/android-10-imei-no-longer-available-on-api-29-looking-for-alternatives}
65
- * {@see https://developer.android.com/training/articles/user-data-ids}
66
- */
67
- private fun getUniqueId(collectDeviceId : Boolean): String? {
68
- if (collectDeviceId) {
69
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2)
70
- return null
71
-
72
- val WIDEVINE_UUID = UUID(-0x121074568629b532L, -0x5c37d8232ae2de13L)
73
- var wvDrm: MediaDrm? = null
74
- try {
75
- wvDrm = MediaDrm(WIDEVINE_UUID)
76
- val wideVineId = wvDrm.getPropertyByteArray(MediaDrm.PROPERTY_DEVICE_UNIQUE_ID)
77
- val md = MessageDigest.getInstance("SHA-256")
78
- md.update(wideVineId)
79
- return md.digest().toHexString()
80
- } catch (e: Exception) {
81
- return null
82
- } finally {
83
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
84
- wvDrm?.close()
85
- } else {
86
- wvDrm?.release()
87
- }
88
- }
89
- }
90
- return null
91
- }
92
-
93
- private fun getConnectionType(context: Context): ConnectionType {
94
- val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager?
95
- var result: ConnectionType = ConnectionType.Unknown
96
-
97
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
98
- cm?.run {
99
- cm.getNetworkCapabilities(cm.activeNetwork)?.run {
100
- if (hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) {
101
- result = ConnectionType.Wifi
102
- } else if (hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)) {
103
- result = ConnectionType.Cellular
104
- } else {
105
- result = ConnectionType.Unknown
106
- }
107
- }
108
- }
109
- } else {
110
- cm?.run {
111
- cm.activeNetworkInfo?.run {
112
- if (type == ConnectivityManager.TYPE_WIFI) {
113
- result = ConnectionType.Wifi
114
- } else if (type == ConnectivityManager.TYPE_MOBILE) {
115
- result = ConnectionType.Cellular
116
- } else {
117
- result = ConnectionType.Unknown
118
- }
119
- }
120
- }
121
- }
122
- return result
123
- }
124
-
125
- @ReactMethod
126
- fun getContextInfo(config: ReadableMap, promise: Promise) {
127
- val appName: String = reactApplicationContext.applicationInfo.loadLabel(reactApplicationContext.packageManager).toString()
128
- val appVersion: String = pInfo.versionName.toString()
129
- val buildNumber = getBuildNumber()
130
- val bundleId = reactApplicationContext.packageName
131
-
132
- val connectionType: ConnectionType = getConnectionType(reactApplicationContext)
133
- val timezone: TimeZone = TimeZone.getDefault()
134
- val currentLocale: Locale = Locale.getDefault()
135
- val locale: String = "${currentLocale.language}-${currentLocale.country}"
136
-
137
- val screenWidth = Resources.getSystem().displayMetrics.widthPixels
138
- val screenHeight = Resources.getSystem().displayMetrics.heightPixels
139
-
140
- val screenDensity = Resources.getSystem().displayMetrics.density;
141
-
142
- val contextInfo: WritableMap = Arguments.createMap()
143
-
144
-
145
- if (config.hasKey("collectDeviceId") && config.getBoolean("collectDeviceId")) {
146
- val fallbackDeviceId = UUID.randomUUID().toString()
147
- val deviceId = getUniqueId(config.hasKey("collectDeviceId") && config.getBoolean("collectDeviceId"))?: fallbackDeviceId
148
-
149
- contextInfo.putString("deviceId", deviceId)
150
- }
151
-
152
- contextInfo.putString("appName", appName)
153
- contextInfo.putString("appVersion", appVersion)
154
- contextInfo.putString("buildNumber", buildNumber)
155
- contextInfo.putString("bundleId", bundleId)
156
-
157
- contextInfo.putString("deviceName", Build.DEVICE)
158
- contextInfo.putString("deviceType", "android")
159
- contextInfo.putString("manufacturer", Build.MANUFACTURER)
160
- contextInfo.putString("model", Build.MODEL)
161
-
162
- contextInfo.putString("timezone", timezone.id)
163
- contextInfo.putString("locale", locale)
164
- contextInfo.putString("networkType", connectionType.toString().lowercase(currentLocale))
165
-
166
- contextInfo.putString("osName", "Android")
167
- contextInfo.putString("osVersion", Build.VERSION.RELEASE)
168
-
169
- contextInfo.putInt("screenWidth", screenWidth)
170
- contextInfo.putInt("screenHeight", screenHeight)
171
- contextInfo.putDouble("screenDensity", screenDensity.toDouble())
172
-
173
- promise.resolve(contextInfo)
174
- }
175
-
176
- fun getReferrer(activity: Activity): Uri? {
177
- return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
178
- activity.referrer
179
- } else {
180
- null
181
- }
182
- }
183
-
184
- fun trackDeepLinks(intent: Intent?) {
185
- if (intent == null || intent.data == null) {
186
- Log.d(name, "No Intent data found")
187
- return
188
- }
189
-
190
- val properties = Hashtable<String, String>()
191
-
192
- if (currentActivity == null) {
193
- Log.d(name, "No activity found")
194
- return
195
- }
196
-
197
- val referrer = getReferrer(currentActivity!!)
198
-
199
- if (referrer != null) {
200
- val referringApplication = referrer.toString()
201
- properties["referring_application"] = referringApplication
202
- }
203
-
204
- val uri = intent.data
205
- try {
206
- properties["url"] = uri.toString()
207
- for (parameter in uri!!.queryParameterNames) {
208
- val value = uri.getQueryParameter(parameter)
209
- if (value != null && value.trim { it <= ' ' }.isNotEmpty()) {
210
- properties[parameter] = value
211
- }
212
- }
213
- } catch (e: Exception) {
214
- // handle error
215
- Log.d(name, "Error getting URL: ${e.message}")
216
- return
217
- }
218
-
219
- Log.d(name, "Sending Deeplink data to store: uri=${uri}, referrer=${referrer}")
220
- val sovran = (currentActivity?.application as ReactApplication)
221
- ?.reactNativeHost
222
- ?.reactInstanceManager
223
- ?.currentReactContext
224
- ?.getNativeModule(SovranModule::class.java)
225
- sovran?.dispatch("add-deepLink-data", properties)
226
-
227
-
228
- }
229
-
230
- fun setAnonymousId(anonymousId: String) {
231
- val properties = Hashtable<String, String>()
232
- properties["anonymousId"] = anonymousId
233
-
234
- val currentContext = getReactApplicationContext()
235
-
236
- if (currentContext != null) {
237
- val sovran = currentContext.getNativeModule(SovranModule::class.java)
238
- sovran?.dispatch("add-anonymous-id", properties)
239
- }
240
- }
241
-
242
- override fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, data: Intent?) {
243
- // Do nothing
244
- }
245
-
246
- override fun onNewIntent(intent: Intent) {
247
- Log.d(name, "onNewIntent = ${intent}")
248
- trackDeepLinks(intent)
249
- }
250
-
251
- override fun onHostResume() {
252
- if (currentActivity != null && isColdLaunch) {
253
- isColdLaunch = false
254
- Log.d(name, "onHostResume = ${currentActivity!!.intent}")
255
- trackDeepLinks(currentActivity!!.intent)
256
- }
257
- }
258
-
259
- override fun onHostPause() {
260
- // Do nothing
261
- }
262
-
263
- override fun onHostDestroy() {
264
- isColdLaunch = true
265
- // Do nothing
266
- }
267
- }
@@ -1,43 +0,0 @@
1
- package com.segmentanalyticsreactnative
2
-
3
- import java.util.Arrays
4
- import java.util.Collections
5
-
6
- import com.facebook.react.ReactPackage
7
- import com.facebook.react.bridge.NativeModule
8
- import com.facebook.react.bridge.ReactApplicationContext
9
- import com.facebook.react.uimanager.ViewManager
10
- import com.facebook.react.bridge.JavaScriptModule
11
-
12
- class AnalyticsReactNativePackage : ReactPackage {
13
-
14
- private var isInitialized = false
15
- private var anonymousId: String? = null
16
- private var module: AnalyticsReactNativeModule? = null
17
-
18
- override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
19
- module = AnalyticsReactNativeModule(reactContext)
20
- module?.onInitialized = {
21
- isInitialized = true
22
- anonymousId?.let { anonId ->
23
- module?.setAnonymousId(anonId)
24
- }
25
- }
26
- return listOf(module as NativeModule)
27
- }
28
-
29
- override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
30
- return emptyList<ViewManager<*, *>>()
31
- }
32
-
33
- fun setAnonymousId(nativeAnonymousId: String) {
34
- if (isInitialized) {
35
- anonymousId = nativeAnonymousId;
36
- anonymousId?.let { anonId ->
37
- module?.setAnonymousId(anonId)
38
- }
39
- } else {
40
- anonymousId = nativeAnonymousId
41
- }
42
- }
43
- }
@@ -1,45 +0,0 @@
1
- package com.sovranreactnative
2
-
3
- import android.util.Log
4
- import com.facebook.react.ReactPackage
5
- import com.facebook.react.bridge.NativeModule
6
- import com.facebook.react.bridge.ReactApplicationContext
7
- import com.facebook.react.uimanager.ViewManager
8
-
9
- class Sovran : ReactPackage {
10
-
11
- data class Action (val type: String, val payload: Map<String, Any?>)
12
-
13
- private var isInitialized = false
14
- private val queue = mutableListOf<Action>()
15
- private var module: SovranModule? = null
16
-
17
- override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
18
- module = SovranModule(reactContext)
19
-
20
- module?.onInitialized = {
21
- Log.v("SovranModule", "onInitialized queue: ${queue.size}")
22
- isInitialized = true
23
- queue.forEach {
24
- module?.dispatch(it.type, it.payload)
25
- }
26
- queue.clear()
27
- }
28
-
29
- return listOf(module as NativeModule)
30
-
31
- }
32
-
33
- override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
34
- return emptyList()
35
- }
36
-
37
- fun dispatch(action: String, payload: Map<String, Any?>) {
38
- Log.v("SovranModule", "dispatch: $action isInitialized: $isInitialized")
39
- if (isInitialized) {
40
- module?.dispatch(action, payload)
41
- } else {
42
- queue.add(Action(action, payload))
43
- }
44
- }
45
- }
@@ -1,55 +0,0 @@
1
- package com.sovranreactnative
2
-
3
- import com.facebook.react.bridge.Arguments
4
- import com.facebook.react.bridge.ReactApplicationContext
5
- import com.facebook.react.bridge.ReactContextBaseJavaModule
6
- import com.facebook.react.bridge.ReactMethod
7
- import com.facebook.react.bridge.Promise
8
- import com.facebook.react.bridge.WritableMap
9
- import com.facebook.react.modules.core.DeviceEventManagerModule
10
- import com.facebook.react.module.annotations.ReactModule;
11
-
12
- @ReactModule(name="Sovran")
13
- class SovranModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
14
-
15
- var onInitialized: () -> Unit = {};
16
-
17
- override fun getName(): String {
18
- return "Sovran"
19
- }
20
-
21
- companion object {
22
- const val ON_STORE_ACTION = "onStoreAction"
23
- }
24
-
25
- override fun getConstants() = mapOf(
26
- "ON_STORE_ACTION" to ON_STORE_ACTION
27
- )
28
-
29
- override fun initialize() {
30
- super.initialize()
31
- onInitialized()
32
- }
33
-
34
- // Example method
35
- // See https://reactnative.dev/docs/native-modules-android
36
- @ReactMethod
37
- fun addListener(eventName: String?) {
38
- // Keep: Required for RN built in Event Emitter Calls.
39
- }
40
-
41
- @ReactMethod
42
- fun removeListeners(count: Int?) {
43
- // Keep: Required for RN built in Event Emitter Calls.
44
- }
45
-
46
- fun dispatch(action: String, payload: Map<String, Any?>) {
47
- val map = mapOf(
48
- "type" to action,
49
- "payload" to payload
50
- )
51
- val event: WritableMap = Arguments.makeNativeMap(map)
52
- reactApplicationContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
53
- .emit(ON_STORE_ACTION, event)
54
- }
55
- }
@@ -1,36 +0,0 @@
1
- package org.linusu;
2
-
3
- import java.security.NoSuchAlgorithmException;
4
- import java.security.SecureRandom;
5
-
6
- import android.util.Base64;
7
-
8
- import com.facebook.react.bridge.ReactApplicationContext;
9
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
10
- import com.facebook.react.bridge.ReactMethod;
11
- import com.facebook.react.bridge.Callback;
12
-
13
- public class RNGetRandomValuesModule extends ReactContextBaseJavaModule {
14
-
15
- private final ReactApplicationContext reactContext;
16
-
17
- public RNGetRandomValuesModule(ReactApplicationContext reactContext) {
18
- super(reactContext);
19
- this.reactContext = reactContext;
20
- }
21
-
22
- @Override
23
- public String getName() {
24
- return "RNGetRandomValues";
25
- }
26
-
27
- @ReactMethod(isBlockingSynchronousMethod = true)
28
- public String getRandomBase64(int byteLength) throws NoSuchAlgorithmException {
29
- byte[] data = new byte[byteLength];
30
- SecureRandom random = new SecureRandom();
31
-
32
- random.nextBytes(data);
33
-
34
- return Base64.encodeToString(data, Base64.NO_WRAP);
35
- }
36
- }
@@ -1,28 +0,0 @@
1
- package org.linusu;
2
-
3
- import java.util.Arrays;
4
- import java.util.Collections;
5
- import java.util.List;
6
-
7
- import com.facebook.react.ReactPackage;
8
- import com.facebook.react.bridge.NativeModule;
9
- import com.facebook.react.bridge.ReactApplicationContext;
10
- import com.facebook.react.uimanager.ViewManager;
11
- import com.facebook.react.bridge.JavaScriptModule;
12
-
13
- public class RNGetRandomValuesPackage implements ReactPackage {
14
- @Override
15
- public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
16
- return Arrays.<NativeModule>asList(new RNGetRandomValuesModule(reactContext));
17
- }
18
-
19
- // Deprecated from RN 0.47
20
- public List<Class<? extends JavaScriptModule>> createJSModules() {
21
- return Collections.emptyList();
22
- }
23
-
24
- @Override
25
- public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
26
- return Collections.emptyList();
27
- }
28
- }
@@ -1,10 +0,0 @@
1
- import { DestinationPlugin, PluginType, SegmentEvent } from '@segment/analytics-react-native';
2
- export declare class MetaRouterPlugin extends DestinationPlugin {
3
- private ingestionEndpoint;
4
- private writeKey;
5
- key: string;
6
- type: PluginType;
7
- constructor(ingestionEndpoint: string, writeKey: string);
8
- execute(event: SegmentEvent): Promise<SegmentEvent>;
9
- }
10
- //# sourceMappingURL=MetaRouterPlugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MetaRouterPlugin.d.ts","sourceRoot":"","sources":["../src/MetaRouterPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE9F,qBAAa,gBAAiB,SAAQ,iBAAiB;IAKzC,OAAO,CAAC,iBAAiB;IAAU,OAAO,CAAC,QAAQ;IAH/D,GAAG,SAA2B;IAC9B,IAAI,aAAyB;gBAET,iBAAiB,EAAE,MAAM,EAAU,QAAQ,EAAE,MAAM;IAIjE,OAAO,CAAC,KAAK,EAAE,YAAY;CAclC"}
@@ -1,23 +0,0 @@
1
- import { DestinationPlugin, PluginType } from '@segment/analytics-react-native';
2
- export class MetaRouterPlugin extends DestinationPlugin {
3
- constructor(ingestionEndpoint, writeKey) {
4
- super();
5
- this.ingestionEndpoint = ingestionEndpoint;
6
- this.writeKey = writeKey;
7
- // Required by Segment
8
- this.key = 'MetaRouterDestination';
9
- this.type = PluginType.destination;
10
- }
11
- async execute(event) {
12
- const enrichedEvent = {
13
- ...event,
14
- writeKey: this.writeKey,
15
- };
16
- await fetch(this.ingestionEndpoint, {
17
- method: 'POST',
18
- headers: { 'Content-Type': 'application/json' },
19
- body: JSON.stringify(enrichedEvent),
20
- });
21
- return event;
22
- }
23
- }
package/lib/context.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- import type { AnalyticsInterface } from "./MetaRouter";
3
- export declare const MetaRouterProvider: React.FC<{
4
- client: AnalyticsInterface;
5
- children: React.ReactNode;
6
- }>;
7
- export declare const useMetaRouter: () => AnalyticsInterface;
8
- //# sourceMappingURL=context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIvD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC;IACxC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAIA,CAAC;AAEF,eAAO,MAAM,aAAa,QAAO,kBAKhC,CAAC"}