#!/usr/bin/env bash # Copies the localized golden screenshots into the two places that consume them: # 1. the Hugo landing site (site/assets/screenshots//) # 2. the Play Store metadata (fastlane/metadata/android//images/phoneScreenshots/) # # Regenerate the PNGs first: # flutter test --update-goldens --tags screenshots test/screenshots/screenshots_test.dart # then run this from apps/app_seeds/: # tool/collect_screenshots.sh set -euo pipefail here="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # apps/app_seeds repo_root="$(cd "$here/../.." && pwd)" goldens="$here/test/screenshots/goldens" site_dir="$repo_root/site/assets/screenshots" fastlane_dir="$here/fastlane/metadata/android" if [[ ! -d "$goldens" ]]; then echo "No goldens at $goldens — run the screenshots test with --update-goldens first." >&2 exit 1 fi # App locale (golden dir) -> Play Store locale (fastlane dir). 'rtl' is a layout # demo only (not a real locale) and goes to the site, not the stores. declare -A play_locale=( [en]=en-US [es]=es-ES [fr]=fr-FR [de]=de-DE [pt]=pt-PT [ja]=ja-JP ) for dir in "$goldens"/*/; do locale="$(basename "$dir")" # 1) Landing site: every locale, including the RTL demo. mkdir -p "$site_dir/$locale" cp "$dir"*.png "$site_dir/$locale/" # 2) Play Store: only locales that ALREADY have text metadata (a title.txt). # A locale dir with images but no store text is invalid for `fastlane supply`, # so we don't create image-only locales — add the text first, then it's picked up. play="${play_locale[$locale]:-}" if [[ -n "$play" && -f "$fastlane_dir/$play/title.txt" ]]; then shots="$fastlane_dir/$play/images/phoneScreenshots" mkdir -p "$shots" # Number them so the store shows them in a deliberate order. i=1 for name in home inventory market calendar detail; do [[ -f "$dir$name.png" ]] && cp "$dir$name.png" "$shots/$i.png" && i=$((i + 1)) done echo " store: $play ($((i - 1)) shots)" fi echo "site: $locale" done echo "Done. To add a Play locale beyond en-US/es-ES, create its title/short/full" echo "description text under fastlane/metadata/android// first, then re-run."