@mobilenext/mobile-mcp 0.0.21 → 0.0.23
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/lib/android.js +14 -1
- package/lib/ios.js +1 -1
- package/package.json +1 -1
package/lib/android.js
CHANGED
|
@@ -73,6 +73,11 @@ class AndroidRobot {
|
|
|
73
73
|
timeout: TIMEOUT,
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
+
getFirstDisplayId() {
|
|
77
|
+
const output = this.adb("shell", "dumpsys", "SurfaceFlinger", "--display-id").toString();
|
|
78
|
+
const match = output.match(/Display (\d+) \(/);
|
|
79
|
+
return match ? match[1] : null;
|
|
80
|
+
}
|
|
76
81
|
getSystemFeatures() {
|
|
77
82
|
return this.adb("shell", "pm", "list", "features")
|
|
78
83
|
.toString()
|
|
@@ -191,7 +196,15 @@ class AndroidRobot {
|
|
|
191
196
|
this.adb("shell", "input", "swipe", `${x0}`, `${y0}`, `${x1}`, `${y1}`, "1000");
|
|
192
197
|
}
|
|
193
198
|
async getScreenshot() {
|
|
194
|
-
|
|
199
|
+
const displayId = this.getFirstDisplayId();
|
|
200
|
+
if (displayId !== null) {
|
|
201
|
+
// always good to provide displayId. required for multi-display devices such as fold
|
|
202
|
+
return this.adb("exec-out", "screencap", "-p", "-d", displayId);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
// backward compatibility for android 10 and below
|
|
206
|
+
return this.adb("exec-out", "screencap", "-p");
|
|
207
|
+
}
|
|
195
208
|
}
|
|
196
209
|
collectElements(node) {
|
|
197
210
|
const elements = [];
|
package/lib/ios.js
CHANGED
|
@@ -144,7 +144,7 @@ class IosRobot {
|
|
|
144
144
|
}
|
|
145
145
|
exports.IosRobot = IosRobot;
|
|
146
146
|
class IosManager {
|
|
147
|
-
|
|
147
|
+
isGoIosInstalled() {
|
|
148
148
|
try {
|
|
149
149
|
const output = (0, node_child_process_1.execFileSync)(getGoIosPath(), ["version"], { stdio: ["pipe", "pipe", "ignore"] }).toString();
|
|
150
150
|
const json = JSON.parse(output);
|