Skip to content

Conversation

@mickael-menu
Copy link
Member

Added

Navigator

  • Added VisualNavigatorDelegate.navigatorContentInset(_:) to customize the content and safe-area insets used by the navigator.
    • By default, the navigator uses the window's safeAreaInsets, which can cause content to shift when the status bar is shown or hidden (since those insets change). To avoid this, implement navigatorContentInset(_:) and return insets that remain stable across status bar visibility changes — for example, a top inset large enough to accommodate the maximum expected status bar height.

Changed

Navigator

  • EPUBNavigatorViewController.Configuration.contentInset now expects values that already include the safe area insets.
    • If you previously supplied content-only margins, update them to add the safe-area values to preserve the same visible layout.
    • Alternatively, implement VisualNavigatorDelegate.navigatorContentInset(_:) to compute and return the full insets (content + safe area), helping avoid layout shifts when system UI (e.g., the status bar) appears or disappears.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new delegate method for customizing content insets in navigators to prevent layout shifts when system UI (like the status bar) changes visibility. The implementation allows applications to provide stable insets that don't change with safe area updates.

Key Changes:

  • Added VisualNavigatorDelegate.navigatorContentInset(_:) delegate method to customize content and safe-area insets
  • Changed EPUBNavigatorViewController.Configuration.contentInset to expect values that include safe area insets (breaking change)
  • Refactored internal inset calculation logic across PDF and EPUB navigators to use the new delegate method

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Sources/Navigator/VisualNavigator.swift Added new delegate method navigatorContentInset(_:) with default implementation returning nil
Sources/Navigator/PDF/PDFNavigatorViewController.swift Implemented PDFDocumentViewDelegate to forward content inset requests to the navigator delegate
Sources/Navigator/PDF/PDFDocumentView.swift Added delegate protocol and updated inset calculation to use delegate method
Sources/Navigator/EPUB/EPUBSpreadView.swift Added delegate method signature for spread view content inset
Sources/Navigator/EPUB/EPUBReflowableSpreadView.swift Simplified inset calculation to use delegate-provided values
Sources/Navigator/EPUB/EPUBNavigatorViewController.swift Implemented spread view delegate method with fallback logic and updated default configuration values
Sources/Navigator/EPUB/EPUBFixedSpreadView.swift Updated to use delegate-provided insets
CHANGELOG.md Documented the new feature and breaking change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mickael-menu mickael-menu merged commit 04c35ca into develop Oct 27, 2025
5 checks passed
@mickael-menu mickael-menu deleted the fix-safearea branch October 27, 2025 13:11
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.

2 participants