← All repositories

reportage

A life-logging app for iPhone

git clone https://code.inqk.net/reportage.git


Scripts/screenshots-marketing.sh (2676B)

1#!/bin/bash
2# Takes the App Store screenshots on the demo simulator and frames them: each
3# scene is captured with the status bar at 9:41, given a Dynamic Island,
4# framed in a device by the "Frame Screenshots" Shortcut and captioned on a
5# 1320x2868 canvas. -n skips the Dynamic Island; the current frame draws its
6# own, so use -n unless the frame changes to one without it.
7#
8# Usage: bash Scripts/screenshots-marketing.sh [-n] [iOS-major]
9#        (default major 27; output Marketing/iphone_<n>.png)
10set -euo pipefail
11
12SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
13REPO_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
14source "${SCRIPT_DIR}/demo-simulator.sh"
15
16ADD_DYNAMIC_ISLAND=true
17while getopts "n" opt; do
18  case $opt in
19    n) ADD_DYNAMIC_ISLAND=false ;;
20    *) exit 1 ;;
21  esac
22done
23shift $((OPTIND - 1))
24
25if ! shortcuts list | grep -qx "Frame Screenshots"; then
26  echo "The 'Frame Screenshots' Shortcut isn't installed." >&2
27  exit 1
28fi
29
30WORK_DIR="/tmp/reportage-marketing"
31MARKETING_DIR="${REPO_DIR}/Marketing"
32
33# Each scene is a screen the demo opens to (DemoSeed.Screen).
34SCENES=(timeline detail charts survey)
35CAPTIONS=(
36  "Record Your Life."
37  "See Every Detail."
38  "Made to Measure."
39  "File in Seconds."
40)
41
42rm -rf "$WORK_DIR"
43mkdir -p "$WORK_DIR" "$MARKETING_DIR"
44
45demo_simulator "${1:-27}"
46xcrun simctl ui "$UDID" appearance light
47xcrun simctl status_bar "$UDID" override \
48  --time "9:41" \
49  --batteryState discharging \
50  --batteryLevel 100 \
51  --wifiBars 3 \
52  --cellularBars 4 \
53  --cellularMode active \
54  --dataNetwork wifi
55echo "Status bar overridden"
56
57demo_install
58
59for index in "${!SCENES[@]}"; do
60  scene="${SCENES[$index]}"
61  caption="${CAPTIONS[$index]}"
62  raw_path="${WORK_DIR}/${scene}.png"
63  island_path="${WORK_DIR}/${scene}-island.png"
64  framed_path="${WORK_DIR}/${scene}-framed.png"
65  output_path="${MARKETING_DIR}/iphone_${index}.png"
66
67  echo ""
68  echo "Capturing iphone_${index}.png - ${caption}"
69  demo_launch --reportage-demo-screen "$scene"
70  # Time for the seed to fill the store and the scene to draw it.
71  sleep 4
72  xcrun simctl io "$UDID" screenshot --mask ignored "$raw_path"
73
74  frame_input="$raw_path"
75  if [ "$ADD_DYNAMIC_ISLAND" = true ]; then
76    swift "${SCRIPT_DIR}/screenshots-iphone-island.swift" "$raw_path" "$island_path"
77    frame_input="$island_path"
78  fi
79
80  shortcuts run "Frame Screenshots" -i "$frame_input" -o "$framed_path"
81  swift "${SCRIPT_DIR}/screenshots-iphone-compose.swift" "$framed_path" "$output_path" "$caption"
82  ls -la "$output_path"
83done
84
85xcrun simctl status_bar "$UDID" clear 2>/dev/null || true
86rm -rf "$WORK_DIR"
87
88echo ""
89echo "Screenshots saved to ${MARKETING_DIR}/"
90ls -la "${MARKETING_DIR}/iphone_"*.png