@testernest/react-native 0.1.1

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 (139) hide show
  1. package/README.md +108 -0
  2. package/android/build/.transforms/8ce4b91dc8d15c015a4e81859b96eec6/results.bin +1 -0
  3. package/android/build/.transforms/8ce4b91dc8d15c015a4e81859b96eec6/transformed/classes/classes.dex +0 -0
  4. package/android/build/generated/source/buildConfig/debug/com/testernest/reactnative/BuildConfig.java +10 -0
  5. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +7 -0
  6. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +18 -0
  7. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +5 -0
  8. package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +1 -0
  9. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  10. package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
  11. package/android/build/intermediates/compile_symbol_list/debug/R.txt +1986 -0
  12. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -0
  13. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
  14. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
  15. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
  16. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +2 -0
  17. package/android/build/intermediates/javac/debug/classes/com/testernest/reactnative/BuildConfig.class +0 -0
  18. package/android/build/intermediates/library_java_res/debug/res.jar +0 -0
  19. package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +2 -0
  20. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +8 -0
  21. package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +7 -0
  22. package/android/build/intermediates/navigation_json/debug/navigation.json +1 -0
  23. package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +18 -0
  24. package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  25. package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +1479 -0
  26. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  27. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
  28. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
  29. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
  30. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  31. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
  32. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
  33. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  34. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  35. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  36. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  37. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  38. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  39. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
  40. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  41. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  42. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  43. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  44. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  45. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  46. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
  47. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab +0 -0
  48. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream +0 -0
  49. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len +0 -0
  50. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len +0 -0
  51. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
  52. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i +0 -0
  53. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i.len +0 -0
  54. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  55. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  56. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  57. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  58. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  59. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  60. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
  61. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab +0 -0
  62. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.keystream +0 -0
  63. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.keystream.len +0 -0
  64. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.len +0 -0
  65. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.values.at +0 -0
  66. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab_i +0 -0
  67. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab_i.len +0 -0
  68. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  69. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  70. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  71. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  72. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  73. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  74. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
  75. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  76. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
  77. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
  78. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
  79. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  80. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
  81. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
  82. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  83. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  84. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  85. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
  86. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  87. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
  88. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
  89. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  90. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  91. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  92. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
  93. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  94. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  95. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
  96. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +2 -0
  97. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  98. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
  99. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
  100. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
  101. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  102. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
  103. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
  104. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  105. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  106. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  107. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  108. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  109. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
  110. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
  111. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  112. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  113. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  114. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  115. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  116. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  117. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
  118. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  119. package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  120. package/android/build/outputs/logs/manifest-merger-debug-report.txt +25 -0
  121. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  122. package/android/build/tmp/kotlin-classes/debug/META-INF/react-native-testernest_debug.kotlin_module +0 -0
  123. package/android/build/tmp/kotlin-classes/debug/com/testernest/reactnative/TesternestModule$Companion.class +0 -0
  124. package/android/build/tmp/kotlin-classes/debug/com/testernest/reactnative/TesternestModule$logClaimResultAsync$poll$1.class +0 -0
  125. package/android/build/tmp/kotlin-classes/debug/com/testernest/reactnative/TesternestModule$redactTokens$1.class +0 -0
  126. package/android/build/tmp/kotlin-classes/debug/com/testernest/reactnative/TesternestModule$redactTokens$2.class +0 -0
  127. package/android/build/tmp/kotlin-classes/debug/com/testernest/reactnative/TesternestModule.class +0 -0
  128. package/android/build/tmp/kotlin-classes/debug/com/testernest/reactnative/TesternestPackage.class +0 -0
  129. package/android/build.gradle +34 -0
  130. package/android/consumer-rules.pro +1 -0
  131. package/android/gradle.properties +3 -0
  132. package/android/src/main/AndroidManifest.xml +2 -0
  133. package/android/src/main/java/com/testernest/reactnative/TesternestModule.kt +221 -0
  134. package/android/src/main/java/com/testernest/reactnative/TesternestPackage.kt +16 -0
  135. package/package.json +30 -0
  136. package/react-native.config.js +9 -0
  137. package/src/index.ts +2 -0
  138. package/src/native.ts +69 -0
  139. package/src/testernestConnectPrompt.tsx +173 -0
@@ -0,0 +1,25 @@
1
+ -- Merging decision tree log ---
2
+ manifest
3
+ ADDED from C:\Users\LENOVO\Projects\TesterNest SDK\react-native-testernest\android\src\main\AndroidManifest.xml:1:1-2:42
4
+ INJECTED from C:\Users\LENOVO\Projects\TesterNest SDK\react-native-testernest\android\src\main\AndroidManifest.xml:1:1-2:42
5
+ INJECTED from C:\Users\LENOVO\Projects\TesterNest SDK\react-native-testernest\android\src\main\AndroidManifest.xml:1:1-2:42
6
+ package
7
+ ADDED from C:\Users\LENOVO\Projects\TesterNest SDK\react-native-testernest\android\src\main\AndroidManifest.xml:2:3-39
8
+ INJECTED from C:\Users\LENOVO\Projects\TesterNest SDK\react-native-testernest\android\src\main\AndroidManifest.xml
9
+ INJECTED from C:\Users\LENOVO\Projects\TesterNest SDK\react-native-testernest\android\src\main\AndroidManifest.xml
10
+ xmlns:android
11
+ ADDED from C:\Users\LENOVO\Projects\TesterNest SDK\react-native-testernest\android\src\main\AndroidManifest.xml:1:11-69
12
+ uses-sdk
13
+ INJECTED from C:\Users\LENOVO\Projects\TesterNest SDK\react-native-testernest\android\src\main\AndroidManifest.xml reason: use-sdk injection requested
14
+ INJECTED from C:\Users\LENOVO\Projects\TesterNest SDK\react-native-testernest\android\src\main\AndroidManifest.xml
15
+ INJECTED from C:\Users\LENOVO\Projects\TesterNest SDK\react-native-testernest\android\src\main\AndroidManifest.xml
16
+ INJECTED from C:\Users\LENOVO\Projects\TesterNest SDK\react-native-testernest\android\src\main\AndroidManifest.xml
17
+ INJECTED from C:\Users\LENOVO\Projects\TesterNest SDK\react-native-testernest\android\src\main\AndroidManifest.xml
18
+ android:targetSdkVersion
19
+ INJECTED from C:\Users\LENOVO\Projects\TesterNest SDK\react-native-testernest\android\src\main\AndroidManifest.xml
20
+ ADDED from C:\Users\LENOVO\Projects\TesterNest SDK\react-native-testernest\android\src\main\AndroidManifest.xml
21
+ INJECTED from C:\Users\LENOVO\Projects\TesterNest SDK\react-native-testernest\android\src\main\AndroidManifest.xml
22
+ android:minSdkVersion
23
+ INJECTED from C:\Users\LENOVO\Projects\TesterNest SDK\react-native-testernest\android\src\main\AndroidManifest.xml
24
+ ADDED from C:\Users\LENOVO\Projects\TesterNest SDK\react-native-testernest\android\src\main\AndroidManifest.xml
25
+ INJECTED from C:\Users\LENOVO\Projects\TesterNest SDK\react-native-testernest\android\src\main\AndroidManifest.xml
@@ -0,0 +1,34 @@
1
+ plugins {
2
+ id 'com.android.library'
3
+ id 'org.jetbrains.kotlin.android'
4
+ }
5
+
6
+ repositories {
7
+ google()
8
+ mavenCentral()
9
+ }
10
+
11
+ android {
12
+ namespace 'com.testernest.reactnative'
13
+ compileSdkVersion 34
14
+
15
+ defaultConfig {
16
+ minSdkVersion 21
17
+ targetSdkVersion 34
18
+ consumerProguardFiles 'consumer-rules.pro'
19
+ }
20
+
21
+ compileOptions {
22
+ sourceCompatibility JavaVersion.VERSION_17
23
+ targetCompatibility JavaVersion.VERSION_17
24
+ }
25
+
26
+ kotlinOptions {
27
+ jvmTarget = '17'
28
+ }
29
+ }
30
+
31
+ dependencies {
32
+ implementation 'com.facebook.react:react-native:+'
33
+ implementation "com.testernest:testernest-android:$TESTERNEST_ANDROID_VERSION"
34
+ }
@@ -0,0 +1 @@
1
+ # No consumer rules needed for v1.
@@ -0,0 +1,3 @@
1
+ android.useAndroidX=true
2
+ android.enableJetifier=true
3
+ TESTERNEST_ANDROID_VERSION=0.1.2
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.testernest.reactnative" />
@@ -0,0 +1,221 @@
1
+ package com.testernest.reactnative
2
+
3
+ import android.os.Handler
4
+ import android.os.Looper
5
+ import android.util.Log
6
+ import com.facebook.react.bridge.Arguments
7
+ import com.facebook.react.bridge.Promise
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.ReadableMap
12
+ import com.facebook.react.bridge.WritableArray
13
+ import com.facebook.react.bridge.WritableMap
14
+ import com.testernest.android.Testernest
15
+
16
+ class TesternestModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
17
+ override fun getName(): String = NAME
18
+
19
+ @ReactMethod
20
+ fun init(options: ReadableMap, promise: Promise) {
21
+ try {
22
+ val publicKey = options.getString("publicKey") ?: ""
23
+ val baseUrl = if (options.hasKey("baseUrl")) options.getString("baseUrl") else null
24
+ val enableLogs = if (options.hasKey("enableLogs")) options.getBoolean("enableLogs") else false
25
+
26
+ if (publicKey.isBlank()) {
27
+ promise.reject("E_INVALID_PUBLIC_KEY", "publicKey is required")
28
+ return
29
+ }
30
+
31
+ val context = reactApplicationContext
32
+ logDebug("init called publicKeyPrefix=${publicKey.take(6)} thread=${Thread.currentThread().name}")
33
+ Handler(Looper.getMainLooper()).post {
34
+ try {
35
+ logDebug("init running on UI thread=${Thread.currentThread().name}")
36
+ if (baseUrl.isNullOrBlank()) {
37
+ Testernest.init(context, publicKey, enableLogs = enableLogs)
38
+ } else {
39
+ Testernest.init(context, publicKey, baseUrl, enableLogs)
40
+ }
41
+ promise.resolve(null)
42
+ } catch (e: Exception) {
43
+ promise.reject("E_INIT_FAILED", e.message, e)
44
+ }
45
+ }
46
+ } catch (e: Exception) {
47
+ promise.reject("E_INIT_FAILED", e.message, e)
48
+ }
49
+ }
50
+
51
+ @ReactMethod
52
+ fun track(name: String, properties: ReadableMap?) {
53
+ val map = properties?.toHashMap()
54
+ Testernest.logEvent(name, map)
55
+ }
56
+
57
+ @ReactMethod
58
+ fun flush(promise: Promise) {
59
+ try {
60
+ Testernest.flushNow()
61
+ promise.resolve(null)
62
+ } catch (e: Exception) {
63
+ promise.reject("E_FLUSH_FAILED", e.message, e)
64
+ }
65
+ }
66
+
67
+ @ReactMethod
68
+ fun setCurrentScreen(screen: String?) {
69
+ Testernest.setCurrentScreen(screen)
70
+ }
71
+
72
+ @ReactMethod
73
+ fun connectTester(code6: String, promise: Promise) {
74
+ val trimmed = code6.trim()
75
+ logDebug("connectTester called code=${redactCode(trimmed)}")
76
+ if (!Regex("^\\d{6}$").matches(trimmed)) {
77
+ promise.reject("E_INVALID_CODE", "Only 6-digit connect code supported")
78
+ return
79
+ }
80
+ try {
81
+ Testernest.connectTester(trimmed)
82
+ logClaimResultAsync()
83
+ promise.resolve(null)
84
+ } catch (e: Exception) {
85
+ promise.reject("E_CONNECT_FAILED", e.message, e)
86
+ }
87
+ }
88
+
89
+ @ReactMethod
90
+ fun disconnectTester(promise: Promise) {
91
+ try {
92
+ Testernest.disconnectTester()
93
+ promise.resolve(null)
94
+ } catch (e: Exception) {
95
+ promise.reject("E_DISCONNECT_FAILED", e.message, e)
96
+ }
97
+ }
98
+
99
+ @ReactMethod
100
+ fun getDebugSnapshot(promise: Promise) {
101
+ try {
102
+ val snapshot = Testernest.getDebugSnapshot()
103
+ promise.resolve(toWritableMap(snapshot))
104
+ } catch (e: Exception) {
105
+ promise.reject("E_DEBUG_SNAPSHOT_FAILED", e.message, e)
106
+ }
107
+ }
108
+
109
+ @ReactMethod
110
+ fun isConnected(promise: Promise) {
111
+ try {
112
+ promise.resolve(Testernest.isTesterConnected())
113
+ } catch (e: Exception) {
114
+ promise.reject("E_IS_CONNECTED_FAILED", e.message, e)
115
+ }
116
+ }
117
+
118
+ private fun toWritableMap(map: Map<*, *>): WritableMap {
119
+ val writable = Arguments.createMap()
120
+ for ((keyAny, value) in map) {
121
+ val key = keyAny?.toString() ?: continue
122
+ when (value) {
123
+ null -> writable.putNull(key)
124
+ is Boolean -> writable.putBoolean(key, value)
125
+ is Int -> writable.putInt(key, value)
126
+ is Double -> writable.putDouble(key, value)
127
+ is Float -> writable.putDouble(key, value.toDouble())
128
+ is Long -> writable.putDouble(key, value.toDouble())
129
+ is String -> writable.putString(key, value)
130
+ is Map<*, *> -> writable.putMap(key, toWritableMap(value))
131
+ is List<*> -> writable.putArray(key, toWritableArray(value))
132
+ else -> writable.putString(key, value.toString())
133
+ }
134
+ }
135
+ return writable
136
+ }
137
+
138
+ private fun toWritableArray(list: List<*>): WritableArray {
139
+ val array = Arguments.createArray()
140
+ for (value in list) {
141
+ when (value) {
142
+ null -> array.pushNull()
143
+ is Boolean -> array.pushBoolean(value)
144
+ is Int -> array.pushInt(value)
145
+ is Double -> array.pushDouble(value)
146
+ is Float -> array.pushDouble(value.toDouble())
147
+ is Long -> array.pushDouble(value.toDouble())
148
+ is String -> array.pushString(value)
149
+ is Map<*, *> -> array.pushMap(toWritableMap(value))
150
+ is List<*> -> array.pushArray(toWritableArray(value))
151
+ else -> array.pushString(value.toString())
152
+ }
153
+ }
154
+ return array
155
+ }
156
+
157
+ companion object {
158
+ const val NAME = "Testernest"
159
+ private const val LOG_TAG = "TesternestRN"
160
+ }
161
+
162
+ private fun logClaimResultAsync() {
163
+ if (!BuildConfig.DEBUG) return
164
+ val handler = Handler(Looper.getMainLooper())
165
+ val startedAt = System.currentTimeMillis()
166
+ val poll = object : Runnable {
167
+ override fun run() {
168
+ val connected = runCatching { Testernest.isTesterConnected() }.getOrDefault(false)
169
+ val lastError = runCatching {
170
+ val snapshot = Testernest.getDebugSnapshot()
171
+ snapshot["lastError"] as? String
172
+ }.getOrNull()
173
+ when {
174
+ connected -> {
175
+ Log.i(LOG_TAG, "CLAIM status=200")
176
+ return
177
+ }
178
+ !lastError.isNullOrBlank() -> {
179
+ Log.w(LOG_TAG, "CLAIM status=non-200 reason=${redactTokens(lastError)}")
180
+ return
181
+ }
182
+ System.currentTimeMillis() - startedAt > 8000 -> {
183
+ Log.w(LOG_TAG, "CLAIM status=non-200 reason=timeout")
184
+ return
185
+ }
186
+ else -> handler.postDelayed(this, 400)
187
+ }
188
+ }
189
+ }
190
+ handler.postDelayed(poll, 400)
191
+ }
192
+
193
+ private fun logDebug(message: String) {
194
+ if (BuildConfig.DEBUG) {
195
+ Log.i(LOG_TAG, message)
196
+ }
197
+ }
198
+
199
+ private fun redactCode(code: String): String {
200
+ val trimmed = code.trim()
201
+ if (trimmed.length < 2) {
202
+ return "****"
203
+ }
204
+ return trimmed.take(2) + "****"
205
+ }
206
+
207
+ private fun redactTokens(message: String): String {
208
+ var masked = message
209
+ masked = masked.replace(Regex("(?i)Bearer\\s+[A-Za-z0-9._-]+"), "Bearer ***")
210
+ masked = masked.replace(Regex("(?i)access[_-]?token\\s*[=:]\\s*[A-Za-z0-9._-]+"), "accessToken=***")
211
+ masked = masked.replace(Regex("(?i)\"access[_-]?token\"\\s*:\\s*\"[^\"]+\""), "\"accessToken\":\"***\"")
212
+ masked = masked.replace(Regex("(?i)(connect[_-]?code\\s*[=:]\\s*)([A-Za-z0-9._-]+)")) { match ->
213
+ "${match.groupValues[1]}${redactCode(match.groupValues[2])}"
214
+ }
215
+ masked = masked.replace(Regex("(?i)\"connect[_-]?code\"\\s*:\\s*\"([^\"]+)\"")) { match ->
216
+ val code = match.groupValues[1]
217
+ "\"connectCode\":\"${if (code.length >= 2) code.take(2) + "****" else "****"}\""
218
+ }
219
+ return masked
220
+ }
221
+ }
@@ -0,0 +1,16 @@
1
+ package com.testernest.reactnative
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
+ class TesternestPackage : ReactPackage {
9
+ override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
10
+ return listOf(TesternestModule(reactContext))
11
+ }
12
+
13
+ override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
14
+ return emptyList()
15
+ }
16
+ }
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@testernest/react-native",
3
+ "version": "0.1.1",
4
+ "description": "React Native bridge for Testernest Android SDK",
5
+ "main": "src/index.ts",
6
+ "react-native": "src/index.ts",
7
+ "types": "src/index.ts",
8
+ "files": [
9
+ "android",
10
+ "src",
11
+ "react-native.config.js",
12
+ "README.md"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsc -p tsconfig.json",
16
+ "android:build": "cd android && ./gradlew assembleRelease"
17
+ },
18
+ "keywords": [
19
+ "react-native",
20
+ "android",
21
+ "testernest"
22
+ ],
23
+ "peerDependencies": {
24
+ "react": "*",
25
+ "react-native": ">=0.60"
26
+ },
27
+ "devDependencies": {
28
+ "typescript": "^5.4.2"
29
+ }
30
+ }
@@ -0,0 +1,9 @@
1
+ module.exports = {
2
+ dependency: {
3
+ platforms: {
4
+ android: {
5
+ sourceDir: './android',
6
+ },
7
+ },
8
+ },
9
+ };
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './native';
2
+ export { TesternestConnectPrompt } from './testernestConnectPrompt';