device-shots 0.5.9 → 0.5.11
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.js +25 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -337,31 +337,38 @@ async function discoverAndroidDevices(bundleId) {
|
|
|
337
337
|
function sleep(ms) {
|
|
338
338
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
339
339
|
}
|
|
340
|
-
async function
|
|
340
|
+
async function demoBroadcast(serial, extras) {
|
|
341
341
|
const adb = getAdbPath();
|
|
342
|
-
|
|
343
|
-
|
|
342
|
+
await run(adb, [
|
|
343
|
+
"-s",
|
|
344
|
+
serial,
|
|
345
|
+
"shell",
|
|
346
|
+
"am",
|
|
347
|
+
"broadcast",
|
|
348
|
+
"-a",
|
|
349
|
+
"com.android.systemui.demo",
|
|
350
|
+
...extras
|
|
351
|
+
]);
|
|
344
352
|
}
|
|
345
353
|
async function setAndroidDemoMode(serial, time = "9:30") {
|
|
346
354
|
const hhmm = time.replace(":", "");
|
|
347
|
-
const
|
|
348
|
-
await
|
|
349
|
-
await
|
|
350
|
-
await
|
|
355
|
+
const adb = getAdbPath();
|
|
356
|
+
await run(adb, ["-s", serial, "shell", "settings", "put", "global", "sysui_demo_allowed", "1"]);
|
|
357
|
+
await run(adb, ["-s", serial, "shell", "settings", "put", "global", "sysui_tuner_demo_on", "1"]);
|
|
358
|
+
await sleep(500);
|
|
359
|
+
await demoBroadcast(serial, ["--es", "command", "enter"]);
|
|
351
360
|
await sleep(1e3);
|
|
352
|
-
await
|
|
353
|
-
await
|
|
354
|
-
await
|
|
355
|
-
await
|
|
356
|
-
await
|
|
357
|
-
await sleep(300);
|
|
358
|
-
await adbExec(serial, ["shell", "am", "broadcast", "-a", ACTION, "-e", "command", "battery", "-e", "level", "100", "-e", "plugged", "false"]);
|
|
359
|
-
await sleep(300);
|
|
360
|
-
await adbExec(serial, ["shell", "am", "broadcast", "-a", ACTION, "-e", "command", "notifications", "-e", "visible", "false"]);
|
|
361
|
+
await demoBroadcast(serial, ["--es", "command", "clock", "--es", "hhmm", hhmm]);
|
|
362
|
+
await demoBroadcast(serial, ["--es", "command", "network", "--es", "wifi", "show", "--es", "level", "4"]);
|
|
363
|
+
await demoBroadcast(serial, ["--es", "command", "network", "--es", "mobile", "show", "--es", "datatype", "none", "--es", "level", "4"]);
|
|
364
|
+
await demoBroadcast(serial, ["--es", "command", "battery", "--es", "level", "100", "--es", "plugged", "false"]);
|
|
365
|
+
await demoBroadcast(serial, ["--es", "command", "notifications", "--es", "visible", "false"]);
|
|
361
366
|
await sleep(1e3);
|
|
362
367
|
}
|
|
363
368
|
async function clearAndroidDemoMode(serial) {
|
|
364
|
-
await
|
|
369
|
+
await demoBroadcast(serial, ["--es", "command", "exit"]);
|
|
370
|
+
const adb = getAdbPath();
|
|
371
|
+
await run(adb, ["-s", serial, "shell", "settings", "put", "global", "sysui_tuner_demo_on", "0"]);
|
|
365
372
|
}
|
|
366
373
|
async function captureAndroidScreenshot(serial, outputPath) {
|
|
367
374
|
const adb = getAdbPath();
|
|
@@ -845,7 +852,7 @@ async function frameCommand(dir, options) {
|
|
|
845
852
|
var program = new Command();
|
|
846
853
|
program.name("device-shots").description(
|
|
847
854
|
"Capture and frame mobile app screenshots from iOS simulators and Android emulators"
|
|
848
|
-
).version("0.5.
|
|
855
|
+
).version("0.5.11");
|
|
849
856
|
program.command("capture").description("Capture screenshots from running devices").argument("[name]", "Screenshot name").option("-b, --bundle-id <id>", "App bundle ID").option("-o, --output <dir>", "Output directory").option("-p, --platform <platform>", "ios, android, or both").option("--no-frame", "Skip framing after capture").option("--time <time>", "Status bar time", "9:41").action(async (name, opts) => {
|
|
850
857
|
await captureCommand({ name, ...opts });
|
|
851
858
|
});
|