← back to Nineoh Guide

scripts/capture-appstore-screenshots.sh

55 lines

#!/usr/bin/env bash
# Turnkey App Store screenshot capture for nineoh (TK-12).
# Captures the two REQUIRED sizes: iPhone 6.9" + iPad 13".
# Run this AFTER a build exists (EAS simulator build, or `expo run:ios` .app).
#
#   bash scripts/capture-appstore-screenshots.sh /path/to/nineoh.app
#
# If no .app is given, it builds a local sim app first (`expo run:ios`, ~15 min first time).
# Screenshots land in ./screenshots/<device>/NN.png — you tap to each screen, press Enter, it grabs.
set -euo pipefail
cd "$(dirname "$0")/.."

APP_PATH="${1:-}"
BUNDLE="com.abrams.nineohguide"
OUT="screenshots"
mkdir -p "$OUT"

# Required App Store devices (2026): iPhone 6.9" (16 Pro Max) + iPad 13".
IPHONE="iPhone 16 Pro Max"
IPAD="iPad Pro 13-inch (M5)"

boot() {  # $1 = device name -> echoes its UDID, booting + downloading runtime if needed
  local name="$1" udid
  udid=$(xcrun simctl list devices available | grep -F "$name" | head -1 | grep -oE "[0-9A-F-]{36}" || true)
  if [ -z "$udid" ]; then
    echo "  ⚠️  '$name' sim not installed. Create it in Xcode › Settings › Components (download the iOS runtime), then:" >&2
    echo "      xcrun simctl create \"$name\" \"$name\"" >&2
    return 1
  fi
  xcrun simctl boot "$udid" 2>/dev/null || true
  open -a Simulator
  echo "$udid"
}

shoot() {  # $1=udid $2=device-label
  local udid="$1" label="$2" n=1 dir="$OUT/$label"
  mkdir -p "$dir"
  if [ -n "$APP_PATH" ]; then xcrun simctl install "$udid" "$APP_PATH"; fi
  xcrun simctl launch "$udid" "$BUNDLE" 2>/dev/null || echo "  (launch app manually if not auto-installed)"
  echo "── Capturing $label. Navigate to each screen in the Simulator; press Enter to grab, or 'q' Enter to finish. ──"
  while true; do
    read -r -p "  [$label] shot $n (Enter=grab / q=next device): " k
    [ "$k" = "q" ] && break
    xcrun simctl io "$udid" screenshot "$dir/$(printf '%02d' $n).png" && echo "    saved $dir/$(printf '%02d' $n).png"
    n=$((n+1))
  done
}

echo "== nineoh App Store screenshots =="
[ -z "$APP_PATH" ] && { echo "No .app passed — building local sim app (expo run:ios)…"; npx expo run:ios --configuration Release || { echo "local build failed — pass an EAS sim .app instead"; exit 1; }; }

if U=$(boot "$IPHONE"); then shoot "$U" "iphone-6.9"; fi
if U=$(boot "$IPAD");   then shoot "$U" "ipad-13";   fi
echo "Done. Screenshots in ./$OUT/  → upload 3–5 per size to App Store Connect (Episodes/Cast/Watch/News have real content)."