Repository navigation
feat: expose orientation in the Viewer snapshot screen payload - #71
Merged
Merged
Conversation
Forward `data.orientation` from `describe-ui --json` (the calibrated interface orientation, carried since #38) into the `screen` object of `GET /api/snapshot`, instead of leaving the SPA to spot the `(landscape-right)` suffix in the outline text. The key is omitted whenever the CLI reports none (Android, legacy daemons), matching the CLI envelope semantics. The SPA `Screen` type gains the optional `orientation` field, and the toolbar tags a rotated screen next to the W×H readout — portrait earns no tag, mirroring the outline header behaviour. Closes #57 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011M3T94iAdsJisr6oH7ynof Signed-off-by: onevcat <onevcat@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #57.
GET /api/snapshotnow forwards the CLI's calibrated interface orientation (data.orientationfromdescribe-ui --json, carried since #38) into thescreenpayload verbatim — no parsing of the(landscape-right)suffix out of the outline text:{ "screen": { "appLabel": "Safari", "width": 874, "height": 402, "orientation": "landscape-left" } }Screentype gains the optionalorientationfield, and the toolbar tags a rotated screen next to the W×H readout, e.g.874×402 (landscape-left). Portrait earns no tag, mirroring the outline header behaviour.One nuance vs. the issue text: the CLI emits
"portrait"(notnil) when calibration resolves upright — only the outline header tag is suppressed for portrait. The handler therefore forwards verbatim (key present iffdata.orientationis present) and the portrait suppression lives in the SPA display layer.Changes
Sources/SimUse/Viewer/ViewerAPIHandlers.swift— forwarddata.orientationinto the parsedscreendict at theparseScreenFromOutlinecall site.Tools/Viewer/src/types.ts—Screen.orientation?: string(documented canonical values, widened for forward-compat likeDevice.platform).Tools/Viewer/src/App.tsx— rotation tag next to the W×H readout.Tests/ViewerAPIHandlersTests.swift— new forwarding case + omitted-key assertion in the existing rotated-outline case.CHANGELOG.md,Tools/Viewer/README.md— docs.Testing
make buildclean,make testpasses (1157 tests),tsc -bclean.sim-use viewer: portrait Settings reports"orientation": "portrait"; after rotating with Safari foreground the payload flips to"orientation": "landscape-left"with874×402, byte-consistent with the outline headerApp: Safari 874x402 (landscape-left).🤖 Generated with Claude Code
https://claude.ai/code/session_011M3T94iAdsJisr6oH7ynof