Fix iPad Vault screenshot capture
This commit is contained in:
1 parent
4bb5c8d671
commit
87785030d4
2 files changed
+12
-29
No files matched your search
@@ -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"
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user