Skip to content

Keep measuring across rotation and programmatic transitions - #44

Merged
daisuke0131 merged 2 commits into
masterfrom
feat/keep-measuring-on-reload
Aug 9, 2026
Merged

Keep measuring across rotation and programmatic transitions#44
daisuke0131 merged 2 commits into
masterfrom
feat/keep-measuring-on-reload

Conversation

@daisuke0131

@daisuke0131 daisuke0131 commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • While measuring is ON, device rotation and programmatic transitions (timers, network-driven pushes) used to silently reset the toggle to OFF and tear down the overlay — the two reload() paths the input shield cannot block. Measuring now stays ON: the new screen is re-scanned and the overlay re-attached. Selection state (red border / distance reference) intentionally resets, since it points at views of the previous screen
  • Fix the launcher button landing off screen after rotating back to portrait (reported on device; reproduced by the new rotation UI test at x=705 on a 390pt-wide window). orientationDidChange arrives before the window resizes, so the reload now defers one runloop turn and lays out against post-resize geometry
  • Add a real-touch UI test bundle to the UIKit example as well (measurement smoke + the same rotation test), so both lifecycles are covered on CI. Generated by generate_project.rb, added to the shared scheme, lint scope, and the CI example job
  • Start an [Unreleased] changelog section, also recording the accessibility identifiers added in Add real-touch UI tests for the SwiftUI example #43

Test plan

  • 3 new lifecycle unit tests: keep-ON + rescan on reload, OFF stays OFF, stop() clears the measuring flag (128 unit tests / 20 suites green)
  • SwiftUI example: 5 UI tests green (~40s), incl. the rotation test — fails before the fix with the exact off-screen frame from the device report
  • UIKit example: 2 new UI tests green (~14s) — real-touch measurement and rotation through the storyboard/SceneDelegate path
  • swiftlint --strict 0 violations; both example apps build

🤖 Generated with Claude Code

daisuke0131 and others added 2 commits August 9, 2026 16:42
While measuring is ON, the shield blocks tap-driven navigation, but two
paths still trigger reload(): device rotation and programmatic
transitions (timers, network-driven pushes). Both silently reset the
toggle to OFF and tore down the overlay. Keep the measuring state on
ViewMonitor itself (the launcher's isSelected dies with the button on
every reload), and have reload() re-open the overlay against the new
screen when measuring. Selection state is not carried over - it points
at views of the previous screen.

Also fix the launcher landing off screen after rotating back to
portrait (reported on device, reproduced by the new rotation UI test:
x=705 on a 390pt-wide window). orientationDidChange arrives before the
window has resized, so reloading immediately lays everything out
against the old bounds. Defer the reload one runloop turn so it uses
post-resize geometry.

Covered by three lifecycle unit tests (keep-ON + rescan, OFF stays OFF,
stop() clears the flag) and a rotation UI test asserting the toggle
stays ON, the launcher stays within the window, and the new orientation
is re-scanned.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Same coverage as the SwiftUI example's UI tests, through the
UIKit-only path (storyboard hierarchy, SceneDelegate startup): a
measurement smoke test and the rotation test asserting measuring stays
ON, the launcher stays within the window, and each orientation is
re-scanned. The UI test bundle is generated by generate_project.rb like
the rest of the project, added to the shared scheme's test action, lint
scope, and the CI example job.

Verifying rotation from inside the process is not an option: the
UIDevice orientation KVC trick no longer rotates the interface on
current iOS, so XCUIDevice rotation is the only faithful trigger.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@daisuke0131
daisuke0131 merged commit 05c750e into master Aug 9, 2026
4 checks passed
@daisuke0131
daisuke0131 deleted the feat/keep-measuring-on-reload branch August 9, 2026 12:23
@daisuke0131 daisuke0131 mentioned this pull request Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant