Files

43 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
source "$ROOT/scripts/common.sh"
CAPTURE="$TARNAX_SCRATCH_ROOT/appstore-capture"
DERIVED="$TARNAX_SCRATCH_ROOT/appstore-capture-derived"
python3 "$ROOT/appstore/tools/prepare_capture.py" "$CAPTURE"
xcodebuild -project "$CAPTURE/Tarnax.xcodeproj" -scheme Tarnax -configuration Debug \
-destination 'generic/platform=iOS Simulator' -derivedDataPath "$DERIVED" CODE_SIGNING_ALLOWED=NO build > "$TARNAX_SCRATCH_ROOT/appstore-capture-build.log" 2>&1
APP="$DERIVED/Build/Products/Debug-iphonesimulator/Tarnax.app"
BUNDLE=net.absdev.TarnaxStoreCapture
PHONE="${APPSTORE_IPHONE:-AC08A512-DBE5-4209-9D65-CE5810F3C884}"
TABLET="${APPSTORE_IPAD:-5F4168B7-8BB8-4867-B638-72E033754B5D}"
for kind in iphone-6.9 ipad-13; do
if [[ "$kind" == iphone-6.9 ]]; then DEVICE="$PHONE"; else DEVICE="$TABLET"; fi
if ! xcrun simctl list devices booted | grep -q "$DEVICE"; then xcrun simctl boot "$DEVICE"; fi
xcrun simctl bootstatus "$DEVICE" -b
xcrun simctl install "$DEVICE" "$APP"
xcrun simctl status_bar "$DEVICE" override --time '9:41' --dataNetwork wifi --wifiMode active --wifiBars 3 --batteryState discharging --batteryLevel 100
xcrun simctl ui "$DEVICE" content_size large
mkdir -p "$ROOT/appstore/screenshots/raw/$kind" "$TARNAX_SCRATCH_ROOT/appstore-video/$kind"
n=0
for screen in home library details files settings add; do
n=$((n+1))
if [[ "$screen" == home || "$screen" == files ]]; then MODE=dark; else MODE=light; fi
xcrun simctl ui "$DEVICE" appearance "$MODE"
xcrun simctl launch --terminate-running-process "$DEVICE" "$BUNDLE" --capture "$screen"
sleep 8
NAME="$(printf '%02d' "$n")-$screen"
xcrun simctl io "$DEVICE" screenshot "$ROOT/appstore/screenshots/raw/$kind/$NAME.png"
if [[ "${CAPTURE_VIDEO:-1}" == 1 ]]; then
xcrun simctl io "$DEVICE" recordVideo --codec=h264 --force "$TARNAX_SCRATCH_ROOT/appstore-video/$kind/$NAME.mov" >/dev/null 2>&1 &
RECORDER=$!
sleep 5
kill -INT "$RECORDER"
wait "$RECORDER" || true
fi
done
xcrun simctl status_bar "$DEVICE" clear
xcrun simctl ui "$DEVICE" appearance light
echo "Captured $kind"
done