device-shots 0.5.4 → 0.5.6

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 +10 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -31,6 +31,7 @@ var DEFAULTS = {
31
31
  output: "./.screenshots",
32
32
  platform: "both",
33
33
  time: "9:41",
34
+ androidTime: "9:30",
34
35
  frame: true
35
36
  };
36
37
  async function loadConfig() {
@@ -51,6 +52,7 @@ function createDefaultConfig(bundleId) {
51
52
  output: "./.screenshots",
52
53
  platform: "both",
53
54
  time: "9:41",
55
+ androidTime: "9:30",
54
56
  frame: true
55
57
  },
56
58
  null,
@@ -332,14 +334,15 @@ async function discoverAndroidDevices(bundleId) {
332
334
  }
333
335
  return devices;
334
336
  }
335
- async function setAndroidDemoMode(serial, time) {
337
+ async function setAndroidDemoMode(serial, time = "9:30") {
336
338
  const adb = getAdbPath();
337
339
  const hhmm = time.replace(":", "");
338
340
  const commands = [
339
341
  ["settings", "put", "global", "sysui_demo_allowed", "1"],
340
342
  ["am", "broadcast", "-a", "com.android.systemui.demo", "-e", "command", "enter"],
341
343
  ["am", "broadcast", "-a", "com.android.systemui.demo", "-e", "command", "clock", "-e", "hhmm", hhmm],
342
- ["am", "broadcast", "-a", "com.android.systemui.demo", "-e", "command", "wifi", "-e", "fully", "true"],
344
+ ["am", "broadcast", "-a", "com.android.systemui.demo", "-e", "command", "wifi", "-e", "fully", "true", "-e", "wifi", "show"],
345
+ ["am", "broadcast", "-a", "com.android.systemui.demo", "-e", "command", "network", "-e", "mobile", "show", "-e", "fully", "true", "-e", "level", "4"],
343
346
  ["am", "broadcast", "-a", "com.android.systemui.demo", "-e", "command", "battery", "-e", "level", "100", "-e", "plugged", "false"],
344
347
  ["am", "broadcast", "-a", "com.android.systemui.demo", "-e", "command", "notifications", "-e", "visible", "false"]
345
348
  ];
@@ -596,7 +599,8 @@ async function captureCommand(options) {
596
599
  const bundleIdDisplay = Array.isArray(bundleId) ? bundleId.join(", ") : bundleId;
597
600
  const outputDir = options.output || config.output;
598
601
  const platform = options.platform || config.platform;
599
- const time = options.time || config.time;
602
+ const iosTime = options.time || config.time;
603
+ const androidTime = config.androidTime;
600
604
  const shouldFrame = !options.noFrame && config.frame;
601
605
  const spinner = ora("Discovering devices...").start();
602
606
  const devices = await discoverDevices(bundleId, platform);
@@ -670,13 +674,13 @@ Detected ${devices.length} device(s) with ${bundleIdDisplay}:`)
670
674
  const androidDevices = devices.filter((d) => d.platform === "android");
671
675
  if (iosDevices.length > 0) {
672
676
  const s = ora("Setting clean iOS status bar...").start();
673
- await setIosStatusBar(time);
677
+ await setIosStatusBar(iosTime);
674
678
  s.succeed("iOS status bar set");
675
679
  }
676
680
  if (androidDevices.length > 0) {
677
681
  const s = ora("Setting clean Android status bar...").start();
678
682
  for (const device of androidDevices) {
679
- await setAndroidDemoMode(device.captureId, time);
683
+ await setAndroidDemoMode(device.captureId, androidTime);
680
684
  }
681
685
  s.succeed("Android demo mode set");
682
686
  }
@@ -843,7 +847,7 @@ async function frameCommand(dir, options) {
843
847
  var program = new Command();
844
848
  program.name("device-shots").description(
845
849
  "Capture and frame mobile app screenshots from iOS simulators and Android emulators"
846
- ).version("0.5.4");
850
+ ).version("0.5.6");
847
851
  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) => {
848
852
  await captureCommand({ name, ...opts });
849
853
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "device-shots",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "description": "Capture and frame mobile app screenshots from iOS simulators and Android emulators",
5
5
  "type": "module",
6
6
  "bin": {