Fix iPad Vault screenshot capture

This commit is contained in:
Kaede Akino committed 2026-09-17 16:52:50 +08:00
1 parent 4bb5c8d671
commit 87785030d4
2 files changed
+12 -29

No files matched your search

+11 -10
View File
@@ -65,12 +65,10 @@ run_capture() {
xcrun simctl boot "$device_id" 2>/dev/null || true
xcrun simctl bootstatus "$device_id" -b
if pgrep -x Simulator >/dev/null; then
if [[ "$name" == iPad* ]]; then
set_simulator_orientation "$name" "Landscape Right"
else
set_simulator_orientation "$name" "Portrait"
fi
if [[ "$name" == iPad* ]]; then
xcrun devicectl device orientation set --device "$device_id" landscapeLeft >/dev/null
elif pgrep -x Simulator >/dev/null; then
set_simulator_orientation "$name" "Portrait"
fi
xcrun simctl status_bar "$device_id" override \
--time '9:41' --batteryState charged --batteryLevel 100 --wifiBars 3 --cellularBars 4
@@ -94,20 +92,23 @@ run_capture() {
if [[ -n "$token" && "$token" != "$last_token" ]]; then
local destination="$output_directory/$feature/$device-$locale.png"
mkdir -p "${destination:h}"
xcrun simctl io "$device_id" screenshot --type=png "$destination" >/dev/null
if [[ "$device" == "ipad" ]]; then
rm -f "$destination"
xcrun devicectl device capture screenshot \
--device "$device_id" \
--destination "$destination" >/dev/null
local width height
width="$(sips -g pixelWidth "$destination" | awk '/pixelWidth/ { print $2 }')"
height="$(sips -g pixelHeight "$destination" | awk '/pixelHeight/ { print $2 }')"
if [[ "$width" == "2064" && "$height" == "2752" ]]; then
sips -r 90 "$destination" >/dev/null
elif [[ "$width" != "2752" || "$height" != "2064" ]]; then
if [[ "$width" != "2752" || "$height" != "2064" ]]; then
print -u2 "Unexpected iPad screenshot dimensions: ${width}x${height}"
kill "$test_pid" 2>/dev/null || true
wait "$test_pid" 2>/dev/null || true
xcrun simctl status_bar "$device_id" clear
exit 70
fi
else
xcrun simctl io "$device_id" screenshot --type=png "$destination" >/dev/null
fi
touch "$app_container/Documents/marketing-capture-control/ack-$token"
last_token="$token"