From 87785030d4fa6dfd17f9874d4c7957aeb4d418df Mon Sep 17 00:00:00 2001 From: Kaede Akino Date: Thu, 17 Sep 2026 16:48:49 +0800 Subject: [PATCH] Fix iPad Vault screenshot capture --- Scripts/run-mobile-marketing-screenshots.sh | 21 ++++++++++--------- TFITests/MobileMarketingScreenshotTests.swift | 20 +----------------- 2 files changed, 12 insertions(+), 29 deletions(-) diff --git a/Scripts/run-mobile-marketing-screenshots.sh b/Scripts/run-mobile-marketing-screenshots.sh index 287b64c0..1169ac66 100755 --- a/Scripts/run-mobile-marketing-screenshots.sh +++ b/Scripts/run-mobile-marketing-screenshots.sh @@ -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" diff --git a/TFITests/MobileMarketingScreenshotTests.swift b/TFITests/MobileMarketingScreenshotTests.swift index 374b6192..f15a31b8 100644 --- a/TFITests/MobileMarketingScreenshotTests.swift +++ b/TFITests/MobileMarketingScreenshotTests.swift @@ -274,28 +274,10 @@ private enum MarketingCaptureError: Error { private struct MarketingVaultScene: View { let app: MobileAppModel - private let features = MobileFeatureRegistry.standard() - @State private var selectedDestination: MobileDestination? = .vault var body: some View { if UIDevice.current.userInterfaceIdiom == .pad { - NavigationSplitView(columnVisibility: .constant(.all)) { - List(selection: $selectedDestination) { - ForEach(features.registrations(on: .padSidebar)) { feature in - NavigationLink(value: feature.id) { - Label(feature.title, systemImage: feature.symbol) - } - } - } - .navigationSplitViewColumnWidth(min: 240, ideal: 280, max: 320) - } detail: { - NavigationStack { - MobileVaultView( - app: app, editingHost: .constant(nil), activateHost: { _ in }, - open: { _, _ in }, showsMetrics: false - ) - } - } + MobileRootView(app: app) } else { MarketingPhoneTabShell(selected: .vault) { NavigationStack {