device-shots 0.5.10 → 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.
Files changed (2) hide show
  1. package/dist/index.js +18 -27
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -339,9 +339,16 @@ function sleep(ms) {
339
339
  }
340
340
  async function demoBroadcast(serial, extras) {
341
341
  const adb = getAdbPath();
342
- const cmd = `am broadcast -a com.android.systemui.demo ${extras}`;
343
- const { stdout, stderr } = await run(adb, ["-s", serial, "shell", "sh", "-c", cmd]);
344
- return stdout || stderr;
342
+ await run(adb, [
343
+ "-s",
344
+ serial,
345
+ "shell",
346
+ "am",
347
+ "broadcast",
348
+ "-a",
349
+ "com.android.systemui.demo",
350
+ ...extras
351
+ ]);
345
352
  }
346
353
  async function setAndroidDemoMode(serial, time = "9:30") {
347
354
  const hhmm = time.replace(":", "");
@@ -349,33 +356,17 @@ async function setAndroidDemoMode(serial, time = "9:30") {
349
356
  await run(adb, ["-s", serial, "shell", "settings", "put", "global", "sysui_demo_allowed", "1"]);
350
357
  await run(adb, ["-s", serial, "shell", "settings", "put", "global", "sysui_tuner_demo_on", "1"]);
351
358
  await sleep(500);
352
- let result = await demoBroadcast(serial, "-e command enter");
353
- process.stderr.write(`[demo] enter: ${result.trim()}
354
- `);
359
+ await demoBroadcast(serial, ["--es", "command", "enter"]);
355
360
  await sleep(1e3);
356
- result = await demoBroadcast(serial, `-e command clock -e hhmm ${hhmm}`);
357
- process.stderr.write(`[demo] clock: ${result.trim()}
358
- `);
359
- await sleep(300);
360
- result = await demoBroadcast(serial, "-e command network -e wifi show -e level 4");
361
- process.stderr.write(`[demo] wifi: ${result.trim()}
362
- `);
363
- await sleep(300);
364
- result = await demoBroadcast(serial, "-e command network -e mobile show -e datatype none -e level 4");
365
- process.stderr.write(`[demo] mobile: ${result.trim()}
366
- `);
367
- await sleep(300);
368
- result = await demoBroadcast(serial, "-e command battery -e level 100 -e plugged false");
369
- process.stderr.write(`[demo] battery: ${result.trim()}
370
- `);
371
- await sleep(300);
372
- result = await demoBroadcast(serial, "-e command notifications -e visible false");
373
- process.stderr.write(`[demo] notif: ${result.trim()}
374
- `);
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"]);
375
366
  await sleep(1e3);
376
367
  }
377
368
  async function clearAndroidDemoMode(serial) {
378
- await demoBroadcast(serial, "-e command exit");
369
+ await demoBroadcast(serial, ["--es", "command", "exit"]);
379
370
  const adb = getAdbPath();
380
371
  await run(adb, ["-s", serial, "shell", "settings", "put", "global", "sysui_tuner_demo_on", "0"]);
381
372
  }
@@ -861,7 +852,7 @@ async function frameCommand(dir, options) {
861
852
  var program = new Command();
862
853
  program.name("device-shots").description(
863
854
  "Capture and frame mobile app screenshots from iOS simulators and Android emulators"
864
- ).version("0.5.10");
855
+ ).version("0.5.11");
865
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) => {
866
857
  await captureCommand({ name, ...opts });
867
858
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "device-shots",
3
- "version": "0.5.10",
3
+ "version": "0.5.11",
4
4
  "description": "Capture and frame mobile app screenshots from iOS simulators and Android emulators",
5
5
  "type": "module",
6
6
  "bin": {