33 lines
899 B
Bash
Executable File
33 lines
899 B
Bash
Executable File
#!/bin/zsh
|
|
|
|
set -euo pipefail
|
|
|
|
script_dir="$(cd -- "$(dirname "$0")" && pwd)"
|
|
device="${1:-booted}"
|
|
output_dir="${2:-/tmp/socialio-controlled-shots}"
|
|
control_file="${SOCIALIO_CONTROL_FILE:-/tmp/socialio-control.txt}"
|
|
routes_file="${SOCIALIO_SCREENSHOT_ROUTES:-$script_dir/ui-screenshot-routes.txt}"
|
|
bundle_id="io.social.app"
|
|
|
|
mkdir -p "$output_dir"
|
|
|
|
printf '%s\n' 'socialio://mailbox/inbox' > "$control_file"
|
|
|
|
SIMCTL_CHILD_SOCIALIO_CONTROL_FILE="$control_file" \
|
|
SIMCTL_CHILD_SOCIALIO_CONTROL_POLL_MS="250" \
|
|
xcrun simctl launch --terminate-running-process "$device" "$bundle_id" >/dev/null
|
|
|
|
sleep 2
|
|
|
|
while IFS='|' read -r name route; do
|
|
if [[ -z "${name}" || "${name}" == \#* ]]; then
|
|
continue
|
|
fi
|
|
|
|
printf '%s\n' "$route" > "$control_file"
|
|
sleep 1.2
|
|
xcrun simctl io "$device" screenshot "$output_dir/$name.png" >/dev/null
|
|
done < "$routes_file"
|
|
|
|
echo "Saved screenshots to $output_dir"
|