@skrillex1224/android-toolkit 1.0.6 → 1.0.7

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/dist/index.cjs CHANGED
@@ -757,6 +757,9 @@ function sanitizeData(value, depth = 0, seen = /* @__PURE__ */ new WeakSet()) {
757
757
  return out;
758
758
  }
759
759
 
760
+ // src/device-input.js
761
+ var import_node_crypto2 = require("node:crypto");
762
+
760
763
  // src/device-view.js
761
764
  var import_node_crypto = require("node:crypto");
762
765
  var import_fast_xml_parser = require("fast-xml-parser");
@@ -1060,15 +1063,15 @@ async function scrollToTop(ctx, selector, options = {}) {
1060
1063
  async function scrollUntilStable(ctx, selector, direction, options = {}) {
1061
1064
  const maxSwipes = Math.max(1, Number(options.maxSwipes || 20));
1062
1065
  const stableRoundsTarget = Math.max(1, Number(options.stableRounds || 2));
1066
+ const hashSource = String(options.stability || options.hashSource || "view");
1063
1067
  let lastHash = "";
1064
1068
  let stableRounds = 0;
1065
1069
  for (let index = 0; index < maxSwipes; index += 1) {
1066
- const node = await DeviceView.find(ctx, selector, options);
1067
- const currentHash = DeviceView.hashNode(node);
1070
+ const currentHash = await scrollStateHash(ctx, selector, options, hashSource);
1068
1071
  if (currentHash === lastHash) {
1069
1072
  stableRounds += 1;
1070
1073
  if (stableRounds >= stableRoundsTarget) {
1071
- return { swipes: index, stableRounds, hash: currentHash };
1074
+ return { swipes: index, stableRounds, hash: currentHash, hashSource };
1072
1075
  }
1073
1076
  } else {
1074
1077
  stableRounds = 0;
@@ -1076,7 +1079,15 @@ async function scrollUntilStable(ctx, selector, direction, options = {}) {
1076
1079
  }
1077
1080
  await scroll(ctx, selector, direction, options);
1078
1081
  }
1079
- return { swipes: maxSwipes, stableRounds, hash: lastHash };
1082
+ return { swipes: maxSwipes, stableRounds, hash: lastHash, hashSource };
1083
+ }
1084
+ async function scrollStateHash(ctx, selector, options, hashSource) {
1085
+ if (hashSource === "screenshot") {
1086
+ const png = await Device.screenshotPng(ctx);
1087
+ return (0, import_node_crypto2.createHash)("sha256").update(png).digest("hex");
1088
+ }
1089
+ const node = await DeviceView.find(ctx, selector, options);
1090
+ return DeviceView.hashNode(node);
1080
1091
  }
1081
1092
  function nearestClickable(node) {
1082
1093
  let current = node;
@@ -1531,7 +1542,7 @@ function selectorLabel2(selector) {
1531
1542
  }
1532
1543
 
1533
1544
  // src/share.js
1534
- var import_node_crypto2 = require("node:crypto");
1545
+ var import_node_crypto3 = require("node:crypto");
1535
1546
  var import_jimp2 = require("jimp");
1536
1547
 
1537
1548
  // src/internals/compression.js
@@ -1703,7 +1714,7 @@ async function captureScreen(ctx, options = {}) {
1703
1714
  });
1704
1715
  await sleep(DEFAULT_SETTLE_MS);
1705
1716
  const png = await Device.screenshotPng(ctx);
1706
- const hash = (0, import_node_crypto2.createHash)("sha256").update(png).digest("hex");
1717
+ const hash = (0, import_node_crypto3.createHash)("sha256").update(png).digest("hex");
1707
1718
  if (seen.has(hash)) break;
1708
1719
  seen.add(hash);
1709
1720
  frameBuffers.push(png);