@ansight/react-native 1.2.0-preview.2 → 1.3.0-preview.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.
package/README.md CHANGED
@@ -77,8 +77,8 @@ bundle; its API requires the native Ansight module.
77
77
 
78
78
  This package version expects matching native SDK packages:
79
79
 
80
- - CocoaPods: `Ansight`, `AnsightObjC` version `1.2.0-preview.2`
81
- - Maven: `ai.ansight:ansight-android:1.2.0-preview.2`
80
+ - CocoaPods: `Ansight`, `AnsightObjC` version `1.3.0-preview.1`
81
+ - Maven: `ai.ansight:ansight-android:1.3.0-preview.1`
82
82
 
83
83
  ## Quickstart
84
84
 
@@ -67,6 +67,6 @@ repositories {
67
67
  dependencies {
68
68
  implementation("com.facebook.react:react-android")
69
69
  def ansightAndroidVersion =
70
- findProperty("ansightAndroidVersion") ?: "1.2.0-preview.2"
71
- implementation("ai.ansight:ansight-android:1.2.0-preview.2")
70
+ findProperty("ansightAndroidVersion") ?: "1.3.0-preview.1"
71
+ implementation("ai.ansight:ansight-android:1.3.0-preview.1")
72
72
  }
@@ -16,6 +16,7 @@ import ai.ansight.runtime.AnsightOptionsBuilder
16
16
  import ai.ansight.runtime.AnsightRuntime
17
17
  import ai.ansight.runtime.AnsightSecureStorageOptions
18
18
  import ai.ansight.runtime.AnsightSessionJpegCaptureOptions
19
+ import ai.ansight.runtime.AnsightSessionJpegCaptureMode
19
20
  import ai.ansight.runtime.AnsightToolGuard
20
21
  import ai.ansight.runtime.AnsightTouchCaptureOptions
21
22
  import ai.ansight.runtime.AppLifecycleState
@@ -749,6 +750,7 @@ class AnsightReactNativeModule(
749
750
  "captureGpuBackedSurfaces",
750
751
  AnsightSessionJpegCaptureOptions.DefaultCaptureGpuBackedSurfaces,
751
752
  ),
753
+ mode = sessionJpegCaptureMode(jpeg.stringValue("mode")),
752
754
  )
753
755
  },
754
756
  )
@@ -928,9 +930,17 @@ class AnsightReactNativeModule(
928
930
  "captureGpuBackedSurfaces",
929
931
  AnsightSessionJpegCaptureOptions.DefaultCaptureGpuBackedSurfaces,
930
932
  ),
933
+ mode = sessionJpegCaptureMode(map.stringValue("mode")),
931
934
  )
932
935
  }
933
936
 
937
+ private fun sessionJpegCaptureMode(value: String?): AnsightSessionJpegCaptureMode =
938
+ if (value == "screenshotAndVisualTree") {
939
+ AnsightSessionJpegCaptureMode.ScreenshotAndVisualTree
940
+ } else {
941
+ AnsightSessionJpegCaptureMode.ScreenshotOnly
942
+ }
943
+
934
944
  private fun toolDefinition(map: ReadableMap): ToolDefinition =
935
945
  ToolDefinition(
936
946
  id = map.stringValue("id") ?: "",
@@ -1117,6 +1127,11 @@ class AnsightReactNativeModule(
1117
1127
  "quality" to capture.quality,
1118
1128
  "maxWidth" to capture.maxWidth,
1119
1129
  "captureGpuBackedSurfaces" to capture.captureGpuBackedSurfaces,
1130
+ "mode" to if (capture.mode == AnsightSessionJpegCaptureMode.ScreenshotAndVisualTree) {
1131
+ "screenshotAndVisualTree"
1132
+ } else {
1133
+ "screenshotOnly"
1134
+ },
1120
1135
  ).toWritableMap())
1121
1136
  } ?: putNull("sessionJpegCapture")
1122
1137
  options.touchCapture?.let { touch ->
package/index.d.ts CHANGED
@@ -37,6 +37,7 @@ export interface AnsightSessionJpegCaptureOptions {
37
37
  quality?: number;
38
38
  maxWidth?: number;
39
39
  captureGpuBackedSurfaces?: boolean;
40
+ mode?: "screenshotOnly" | "screenshotAndVisualTree";
40
41
  }
41
42
 
42
43
  export interface AnsightTouchCaptureOptions {
@@ -262,7 +263,8 @@ export class AnsightOptionsBuilder {
262
263
  intervalMilliseconds: number,
263
264
  quality?: number,
264
265
  maxWidth?: number | null,
265
- captureGpuBackedSurfaces?: boolean
266
+ captureGpuBackedSurfaces?: boolean,
267
+ mode?: "screenshotOnly" | "screenshotAndVisualTree"
266
268
  ): this;
267
269
  withoutSessionJpegCapture(): this;
268
270
  withTouchCapture(touchCapture?: AnsightTouchCaptureOptions): this;
package/index.js CHANGED
@@ -268,6 +268,7 @@ class AnsightOptionsBuilder {
268
268
  quality: arguments.length > 1 ? arguments[1] : 60,
269
269
  maxWidth: arguments.length > 2 ? arguments[2] : 480,
270
270
  captureGpuBackedSurfaces: arguments.length > 3 ? arguments[3] : true,
271
+ mode: arguments.length > 4 ? arguments[4] : "screenshotOnly",
271
272
  };
272
273
  return this;
273
274
  }
@@ -275,6 +276,7 @@ class AnsightOptionsBuilder {
275
276
  intervalMilliseconds: 2000,
276
277
  quality: 60,
277
278
  maxWidth: 480,
279
+ mode: "screenshotOnly",
278
280
  ...(optionsOrIntervalMilliseconds || {}),
279
281
  };
280
282
  return this;
@@ -941,7 +941,10 @@ final class AnsightReactNative: RCTEventEmitter {
941
941
  jpeg,
942
942
  "captureGpuBackedSurfaces",
943
943
  defaultValue: AnsightSessionJpegCaptureOptions.defaultCaptureGpuBackedSurfaces
944
- )
944
+ ),
945
+ mode: stringValue(jpeg, "mode") == "screenshotAndVisualTree"
946
+ ? .screenshotAndVisualTree
947
+ : .screenshotOnly
945
948
  )
946
949
  }
947
950
  }
@@ -1267,7 +1270,10 @@ final class AnsightReactNative: RCTEventEmitter {
1267
1270
  dictionary,
1268
1271
  "captureGpuBackedSurfaces",
1269
1272
  defaultValue: AnsightSessionJpegCaptureOptions.defaultCaptureGpuBackedSurfaces
1270
- )
1273
+ ),
1274
+ mode: stringValue(dictionary, "mode") == "screenshotAndVisualTree"
1275
+ ? .screenshotAndVisualTree
1276
+ : .screenshotOnly
1271
1277
  )
1272
1278
  }
1273
1279
 
@@ -1316,6 +1322,7 @@ final class AnsightReactNative: RCTEventEmitter {
1316
1322
  "quality": capture.quality,
1317
1323
  "maxWidth": capture.maxWidth as Any,
1318
1324
  "captureGpuBackedSurfaces": capture.captureGpuBackedSurfaces,
1325
+ "mode": capture.mode.rawValue,
1319
1326
  ]
1320
1327
  } else {
1321
1328
  dictionary["sessionJpegCapture"] = NSNull()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ansight/react-native",
3
- "version": "1.2.0-preview.2",
3
+ "version": "1.3.0-preview.1",
4
4
  "description": "React Native bridge for the Ansight mobile SDK.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",