Skip to content

Fix stuck landscape orientation in depth profile fullscreen (PRO-65) - #165

Merged
shaheinm merged 2 commits into
mainfrom
dev/pro-65-depthprofilefullscreenview-stuck-landscape-orientation-after
Jun 11, 2026
Merged

shaheinm merged 2 commits into
mainfrom
dev/pro-65-depthprofilefullscreenview-stuck-landscape-orientation-after

Conversation

@shaheinm

Copy link
Copy Markdown
Contributor

Summary

  • DepthProfileFullscreenView had the identical stuck-orientation bug fixed for the replay chart in Add replay chart v2 with ceiling/GF overlays and fullscreen (PRO-51) #163: it reset AppDelegate.orientationLock on dismiss but never called setNeedsUpdateOfSupportedInterfaceOrientations(), which UIKit requires to re-query supported orientations — so the phone stayed locked in landscape after closing the fullscreen chart.
  • Extracts a shared landscapeFullscreen(onSwipeDismiss:) view modifier (Helpers/LandscapeFullscreenModifier.swift) and adopts it in both DepthProfileFullscreenView and ReplayChartFullscreenView, removing the duplicated orientation-lock pattern.
  • The depth profile fullscreen also gains portrait snap-back on close and downward swipe-to-dismiss, for parity with the replay chart.

Closes PRO-65. Fixes #164.

Test plan

  • Open a dive → fullscreen depth profile → close via X → returns to portrait, rotation works
  • Fullscreen depth profile → swipe down → dismisses
  • Replay fullscreen chart still locks landscape, swipe-dismisses (pausing animation), and restores portrait
  • macOS sheet presentation unaffected (modifier is a no-op off iOS)

Validation

  • SwiftLint strict: clean
  • macOS build: green
  • iOS device build: green
  • View-layer change only — covered by manual QA per testing standards

Made with Cursor

Extract shared landscapeFullscreen() modifier used by both fullscreen
chart views. DepthProfileFullscreenView previously reset the orientation
lock without calling setNeedsUpdateOfSupportedInterfaceOrientations(),
which UIKit requires to re-query supported orientations — leaving the
phone stuck in landscape after closing. Also gains the portrait snap-back
and swipe-to-dismiss for parity with ReplayChartFullscreenView, which
now uses the shared modifier instead of its own copy.

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

- requestOrientation prefers the foreground-active window scene instead
  of connectedScenes.first, which can be the wrong scene under iPad
  multitasking / Stage Manager
- Swipe-to-dismiss requires the vertical translation to dominate, so a
  diagonal chart scrub exceeding 80pt vertically no longer dismisses

Co-authored-by: Cursor <cursoragent@cursor.com>
@shaheinm

Copy link
Copy Markdown
Contributor Author

Second-opinion review (gpt-5.3-codex) — no blockers → addressed in latest commit

Should-fixes (both addressed):

  • connectedScenes.first could target the wrong scene under iPad multitasking / Stage Manager. → Now prefers the foreground-active window scene, falling back to the first.
  • Vertical-only swipe threshold could false-trigger on diagonal chart scrubs. → Added dominant-axis check (height > abs(width)).

Nit (not addressed): requestGeometryUpdate errors are ignored; could log in debug for diagnosability. Left as-is — matches existing codebase style.

Confirmed correct by review: orientation lock/restore + setNeedsUpdateOfSupportedInterfaceOrientations() fix, modifier ordering, @Environment(\.dismiss) in the modifier, macOS compile gating (no iOS symbol leaks).

SwiftLint clean, macOS + iOS device builds green.

@shaheinm
shaheinm merged commit ba7d7e8 into main Jun 11, 2026
7 checks passed
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.

DepthProfileFullscreenView: stuck landscape orientation after closing fullscreen

1 participant