Commit 0aa34887 authored by Kourser's avatar Kourser
Browse files

chore(screenshots): an iPhone Duo screenshot script, and a quiet demo player

fastlane/generate_shots_duo.sh takes the App Store screenshots of the
iPhone Duo for the 22 listing locales, one display per run: `outer`
(folded, 1398×2034) or `inner` (unfolded, 2853×2007), the simulator
being folded by hand in Device Hub. It finds the display by its size,
since port identifiers change at each boot. The screenshots go to
fastlane/screenshots_duo/, kept apart because App Store Connect has no
iPhone Duo screenshot type yet: in fastlane/screenshots they would break
`deliver --screenshots`.

The demo player (DEBUG) pauses as soon as it is open, so taking
screenshots plays no sound, and the demo episodes' missing audio no
longer raises an alert over them.

Co-Authored-By: default avatarClaude Opus 5.5 <noreply@anthropic.com>
parent a6c3e7cd
Loading
Loading
Loading
Loading
+4
Changes for Skingomz/AppModel.swift: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -77,6 +77,10 @@ final class AppModel {
            Task { await self?.handlePlaybackFinished() }
        }
        playback.onError = { [weak self] error in
            #if DEBUG
            // Screenshots: the demo episodes' audio does not exist; no alert over them.
            if AppModel.uiDemoScreen != nil { return }
            #endif
            self?.report(error, String(localized: "Échec de la lecture : \(error.localizedDescription)"))
        }
        playback.onSleepAtEpisodeEnd = { [weak self] in
+2
Changes for Skingomz/RootView.swift: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -624,6 +624,8 @@ struct RootView: View {
                : episodes.first
            if let episode { await model.play(episode) }
            try? await Task.sleep(for: .milliseconds(500))
            // A still for screenshots: no sound while they are taken.
            playback.pause()
            #if os(iOS)
            // Large screens show the player in its panel.
            if horizontalSizeClass == .regular {
+x+94
Changes for fastlane/generate_shots_duo.sh: 94 added lines, 0 removed lines.
Original line number Diff line number Diff line
#!/usr/bin/env bash
#
# Captures App Store iPhone Duo pour les 22 locales de fiche, un écran à la fois :
#
#   ./fastlane/generate_shots_duo.sh outer   # plié   : écran extérieur, 1398×2034
#   ./fastlane/generate_shots_duo.sh inner   # déplié : écran intérieur, 2853×2007
#
# Prérequis : Xcode 27.1 et le simulateur « iPhone Duo » (runtime iOS 27.1),
# démarré, plié ou déplié À LA MAIN dans Device Hub — simctl ne sait pas le
# faire. Le harnais de démo (#if DEBUG, -uiSeed / -uiScreen) amorce le podcast
# de démonstration ; sur l'écran intérieur (largeur regular), -uiScreen player
# et transcript ouvrent le lecteur dans son panneau.
#
# Les captures vont dans fastlane/screenshots_duo/<locale>/, à part : en
# octobre 2026, App Store Connect n'a pas encore de type de capture iPhone Duo
# (ni dans l'API, ScreenshotDisplayType, ni donc dans deliver) ; les mettre
# dans fastlane/screenshots ferait échouer `deliver --screenshots`.
#
# Ne PAS utiliser set -e : un échec ponctuel ne doit pas tout arrêter.
set -uo pipefail
cd "$(dirname "$0")/.."
export DEVELOPER_DIR="${DEVELOPER_DIR:-/Applications/Xcode.app/Contents/Developer}"

BUNDLE=eu.cythin.skingomz
OUT="fastlane/screenshots_duo"
DD="build/dd-sim-duo"
STRIP="build/appstore-screenshots/strip_alpha.swift"

case "${1:-}" in
  outer)
    WIDTH=1398
    SCREENS=( "01-library:" "02-inbox:inbox" "03-detail:detail" "04-queue:queue" "05-settings:settings" ) ;;
  inner)
    WIDTH=2007
    SCREENS=( "01-detail:detail" "02-player:player" "03-transcript:transcript" "04-queue:queue" "05-inbox:inbox" ) ;;
  *) echo "usage: $0 <outer|inner>" >&2; exit 2 ;;
esac
SIDE="$1"

LOCALES=(
  "fr-FR:fr-FR:fr_FR" "en-US:en-US:en_US" "de-DE:de-DE:de_DE" "es-ES:es-ES:es_ES"
  "it:it:it_IT" "pt-PT:pt-PT:pt_PT" "pt-BR:pt-BR:pt_BR" "nl-NL:nl-NL:nl_NL"
  "pl:pl:pl_PL" "sv:sv:sv_SE" "da:da:da_DK" "fi:fi:fi_FI" "el:el:el_GR"
  "hu:hu:hu_HU" "ro:ro:ro_RO" "sk:sk:sk_SK" "cs:cs:cs_CZ" "hr:hr:hr_HR"
  "zh-Hans:zh-Hans:zh_CN" "ja:ja:ja_JP" "ko:ko:ko_KR" "ru:ru:ru_RU"
)

UDID=$(xcrun simctl list devices booted | grep -m1 'iPhone Duo (' | grep -oE '[0-9A-F-]{36}')
[ -n "$UDID" ] || { echo "✗ démarrer le simulateur « iPhone Duo » (iOS 27.1) d'abord" >&2; exit 1; }

# The display to capture, found by its size: port UUIDs change at each boot.
PORT=$(xcrun simctl io "$UDID" enumerate 2>/dev/null \
  | awk -v w="$WIDTH" '/UUID:/{u=$2} /Default width/{if ($3 == w) {print u; exit}}')
[ -n "$PORT" ] || { echo "✗ écran de largeur $WIDTH introuvable" >&2; exit 1; }

echo "▶︎ Build Debug (simulateur)…"
xcodebuild -project Skingomz.xcodeproj -scheme Skingomz -configuration Debug \
  -destination "platform=iOS Simulator,id=$UDID" -derivedDataPath "$DD" build >/dev/null \
  || { echo "✗ build" >&2; exit 1; }
APP=$(find "$DD/Build/Products/Debug-iphonesimulator" -maxdepth 1 -name 'Skingomz.app' -type d | head -1)

xcrun simctl status_bar "$UDID" override --time "9:41" --batteryState charged \
  --batteryLevel 100 --wifiBars 3 --cellularBars 4 --dataNetwork wifi >/dev/null 2>&1 || true

# A fresh install, seeded once.
xcrun simctl uninstall "$UDID" "$BUNDLE" >/dev/null 2>&1
xcrun simctl install "$UDID" "$APP" >/dev/null 2>&1
xcrun simctl launch "$UDID" "$BUNDLE" -uiSeed -AppleLanguages "(en)" -AppleLocale en_US >/dev/null 2>&1
sleep 10

for entry in "${LOCALES[@]}"; do
  IFS=":" read -r asc applang aploc <<< "$entry"
  mkdir -p "$OUT/$asc"
  for sc in "${SCREENS[@]}"; do
    IFS=":" read -r fname arg <<< "$sc"
    xcrun simctl terminate "$UDID" "$BUNDLE" >/dev/null 2>&1
    if [ -z "$arg" ]; then
      xcrun simctl launch "$UDID" "$BUNDLE" -uiSeed -AppleLanguages "($applang)" -AppleLocale "$aploc" >/dev/null 2>&1
    else
      xcrun simctl launch "$UDID" "$BUNDLE" -uiSeed -uiScreen "$arg" -AppleLanguages "($applang)" -AppleLocale "$aploc" >/dev/null 2>&1
    fi
    case "$arg" in player|transcript) sleep 8 ;; *) sleep 5 ;; esac
    dest="$OUT/$asc/duo-${SIDE}-${fname}.png"
    perl -e 'alarm 40; exec @ARGV' xcrun simctl io "$UDID" screenshot --display="$PORT" "$dest" >/dev/null 2>&1 \
      || echo "  ✗ ÉCHEC $asc/duo-${SIDE}-${fname}"
  done
  echo "[duo-$SIDE] $asc ✓"
done
xcrun simctl terminate "$UDID" "$BUNDLE" >/dev/null 2>&1
xcrun simctl status_bar "$UDID" clear >/dev/null 2>&1 || true

echo "▶︎ Strip alpha…"
find "$OUT" -name "duo-${SIDE}-*.png" -print0 | xargs -0 swift "$STRIP" >/dev/null 2>&1 || true
echo "✓ Terminé."