#!/usr/bin/env bash # # Maps the localized golden screenshots generated by test/screenshot_test.dart # (./screenshots//--.png) into the per-language # folder layout that `fastlane supply` (Google Play) and `fastlane deliver` # (App Store) expect. Each store locale is filled from the matching language # folder (e.g. de-DE <- screenshots/de). The generated folders are .gitignored # and recreated on demand (e.g. in CI before an upload), so they are never # committed. # # Usage: scripts/prepare_store_screenshots.sh set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" SRC="$ROOT/screenshots" ANDROID_LOCALES="en-US de-DE fr-FR es-ES it-IT pl-PL" IOS_LOCALES="en-US de-DE fr-FR es-ES it pl" # Order in which the scenes appear in the store listing. SCENES="device trainer virtualshifting virtualshifting-settings customization companion" if [ ! -d "$SRC" ]; then echo "Source screenshots folder not found: $SRC" >&2 exit 1 fi # --- Google Play (supply) -------------------------------------------------- # phoneScreenshots <- android phone (1320x2868) # tenInchScreenshots <- android tablet (3840x2400) for loc in $ANDROID_LOCALES; do lang="${loc%%-*}" # de-DE -> de src="$SRC/$lang" # Android images live under the metadata path, which is in the private prop # submodule (prop/store_metadata/android/...); these image dirs are gitignored # in prop. phone="$ROOT/prop/store_metadata/android/$loc/images/phoneScreenshots" ten="$ROOT/prop/store_metadata/android/$loc/images/tenInchScreenshots" rm -rf "$phone" "$ten" mkdir -p "$phone" "$ten" i=1 for scene in $SCENES; do n=$(printf '%02d' "$i") cp "$src/${scene}-android-1320x2868.png" "$phone/${n}_${scene}.png" cp "$src/${scene}-androidTablet-3840x2400.png" "$ten/${n}_${scene}.png" i=$((i + 1)) done done # --- App Store (deliver) --------------------------------------------------- # deliver detects the device class from the image resolution: # iPhone 6.5" <- 1242x2688 # iPad 12.9" <- 2752x2064 for loc in $IOS_LOCALES; do lang="${loc%%-*}" # de-DE -> de, it -> it src="$SRC/$lang" d="$ROOT/ios/fastlane/screenshots/$loc" rm -rf "$d" mkdir -p "$d" i=1 for scene in $SCENES; do n=$(printf '%02d' "$i") cp "$src/${scene}-iPhone-1242x2688.png" "$d/${n}_${scene}_iphone65.png" cp "$src/${scene}-iPad-2752x2064.png" "$d/${n}_${scene}_ipad129.png" i=$((i + 1)) done done # --- Mac App Store (deliver, platform osx) --------------------------------- # The macOS listing mirrors the iOS texts (the upload_metadata_macos lane points # deliver at the same metadata path). Screenshots use the desktop renders, which # are 2560x1600 — a valid Mac screenshot size that deliver maps to APP_DESKTOP. for loc in $IOS_LOCALES; do lang="${loc%%-*}" # de-DE -> de, it -> it src="$SRC/$lang" d="$ROOT/ios/fastlane/screenshots_macos/$loc" rm -rf "$d" mkdir -p "$d" i=1 for scene in $SCENES; do n=$(printf '%02d' "$i") cp "$src/${scene}-desktop-2560x1600.png" "$d/${n}_${scene}_desktop.png" i=$((i + 1)) done done echo "Prepared store screenshots for Play Store (${ANDROID_LOCALES}), App Store (${IOS_LOCALES}) and Mac App Store (${IOS_LOCALES})."