Skip to content

Replace the preferences editors with settings(for:) and isApplicable(_:) - #952

Merged
mickael-menu merged 6 commits into
developfrom
feature/editor-to-settings
Nov 27, 2026
Merged

mickael-menu merged 6 commits into
developfrom
feature/editor-to-settings

Conversation

@mickael-menu

Copy link
Copy Markdown
Member

Removes the preferences editors and the Preference machinery. Apps keep their own settings model and get the settings a navigator would apply with navigator.settings(for:). They disable the controls that don't apply with isApplicable(_:) on EPUBSettings, PDFSettings and AudioSettings. Suggested ranges, steps and starting values move to the doc comments of the Preferences types.

Also:

  • maximalLineLength accepts .infinity and minimalLineLength accepts 0 to remove the limits.
  • letterSpacing is no longer halved, matching the other Readium toolkits.

Changelog

Added

Navigator

  • New settings(for:) API on the navigators (Configurable) to get the settings they would apply with given preferences, without submitting them. Check which settings apply to the current publication with isApplicable(_:), e.g. to disable the controls of a settings screen, see the user guide.

Changed

Navigator

  • The lines are limited to a maximal length by default. Set maximalLineLength to .infinity to let them take all the available width.
  • The letterSpacing EPUB preference is no longer halved: 1.0 is now 1rem instead of 0.5rem, like in the other Readium toolkits, see the migration guide.

Removed

Navigator

  • The preferences editors (e.g. EPUBPreferencesEditor) are removed. Edit the preferences in your own settings model, and check which settings apply with navigator.settings(for:) and isApplicable(_:), see the migration guide.

Its meaning differs from the `isEffective` property of the removed
editors: it tells whether a setting would apply if it was set, with the
current publication and the other settings, whether or not it is set.
Reusing the editors' name would mislead apps migrating from them.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The applicability API leaves the scroll toggle enabled while VoiceOver forces scrolling on, exposing a control that cannot disable scrolling.

1 open issue
What changed in this PR

This PR moves settings editing into apps while keeping settings resolution and applicability checks in Readium’s EPUB, PDF, and audio navigators.

Changes:

  • Replaces preferences editors with settings(for:) and isApplicable(_:).
  • Updates TestApp integrations, migration guidance, and tests for app-owned settings.
  • Supports disabling EPUB line-length limits with .infinity or 0, and passes letter spacing directly in rem.
File Description
Tests/​SharedTests/​Toolkit/​Extensions/​ComparableTests.swift Tests nonnegative values and floating-point edge cases.
Tests/​NavigatorTests/​Preferences/​ProgressionStrategyTests.swift Removes tests for deleted progression strategies.
Tests/​NavigatorTests/​Preferences/​OptionalValuePreferenceTests.swift Removes tests for deleted preference wrappers.
Tests/​NavigatorTests/​Preferences/​OptionalRangePreferenceTests.swift Removes tests for deleted optional-range helpers.
Tests/​NavigatorTests/​PDF/​PDFSettingsTests.swift Tests PDF resolution, applicability, and submission consistency.
Tests/​NavigatorTests/​EPUB/​EPUBNavigatorViewModelTests.swift Tests resolution with defaults and rendered resource variants.
Tests/​NavigatorTests/​EPUB/​CSS/​LayoutResolverTests.swift Tests infinite maximum and zero minimum line lengths.
Tests/​NavigatorTests/​Audio/​AudioSettingsTests.swift Tests audio resolution, applicability, and submission consistency.
TestApp/​Sources/​Reader/​PDF/​PDFViewController.swift Passes app-owned settings to the settings interface.
TestApp/​Sources/​Reader/​EPUB/​EPUBViewController.swift Passes app-owned settings to the settings interface.
TestApp/​Sources/​Reader/​Common/​Preferences/​UserSettings.swift Associates app models with navigator settings; removes reverse conversion.
TestApp/​Sources/​Reader/​Audiobook/​AudiobookViewController.swift Passes app-owned settings to the settings interface.
Sources/​Shared/​Toolkit/​Extensions/​Double.swift Removes formatting helpers used by editors.
Sources/​Shared/​Toolkit/​Extensions/​Comparable.swift Adds nonnegative-value validation.
Sources/​Navigator/​Preferences/​RemovedPreferencesEditors.swift Adds migration diagnostics for removed APIs.
Sources/​Navigator/​Preferences/​ProxyPreference.swift Removes proxy preference implementations.
Sources/​Navigator/​Preferences/​ProgressionStrategy.swift Removes preference increment strategies.
Sources/​Navigator/​Preferences/​PreferencesEditor.swift Removes editor protocols and state management.
Sources/​Navigator/​Preferences/​Preference.swift Removes preference handles and type erasers.
Sources/​Navigator/​Preferences/​MappedPreference.swift Removes preference mapping helpers.
Sources/​Navigator/​Preferences/​Configurable.swift Defines resolution and applicability APIs; updates type erasure.
Sources/​Navigator/​PDF/​Preferences/​PDFSettings.swift Adds PDF applicability rules and publication-based resolution.
Sources/​Navigator/​PDF/​Preferences/​PDFPreferencesEditor.swift Removes the PDF preferences editor.
Sources/​Navigator/​PDF/​Preferences/​PDFPreferences.swift Documents page-spacing ranges and steps.
Sources/​Navigator/​PDF/​PDFNavigatorViewController.swift Exposes and reuses settings(for:).
Sources/​Navigator/​EPUB/​Preferences/​EPUBSettings.swift Adds applicability rules and revised line-limit resolution.
Sources/​Navigator/​EPUB/​Preferences/​EPUBPreferencesEditor.swift Removes the EPUB preferences editor.
Sources/​Navigator/​EPUB/​Preferences/​EPUBPreferences+Legacy.swift Removes obsolete editor compatibility declarations.
Sources/​Navigator/​EPUB/​Preferences/​EPUBPreferences.swift Documents control values and accepts zero minimum line length.
Sources/​Navigator/​EPUB/​EPUBNavigatorViewModel.swift Shares resolution using rendered layouts and navigator configuration.
Sources/​Navigator/​EPUB/​EPUBNavigatorViewController.swift Exposes settings resolution through the view model.
Sources/​Navigator/​EPUB/​EPUBLayouts.swift Makes layout context hashable and sendable.
Sources/​Navigator/​EPUB/​CSS/​ReadiumCSS.swift Removes letter-spacing halving and unused color constants.
Sources/​Navigator/​EPUB/​CSS/​LayoutResolver.swift Uses infinity to represent an unlimited maximum line length.
Sources/​Navigator/​Audiobook/​Preferences/​AudioSettings.swift Adds applicability support and default resolution arguments.
Sources/​Navigator/​Audiobook/​Preferences/​AudioPreferencesEditor.swift Removes the audio preferences editor.
Sources/​Navigator/​Audiobook/​Preferences/​AudioPreferences.swift Documents accepted ranges and suggested control steps.
Sources/​Navigator/​Audiobook/​AudioNavigator.swift Exposes and reuses settings(for:).
docs/​Migration Guide.md Explains editor removal and changed EPUB preferences.
docs/​Guides/​Navigator/​Preferences.md Reworks examples around app-owned settings and applicability.
docs/​Guides/​Navigator/​EPUB Fonts.md Removes editor-based font-picker guidance.
docs/​Guides/​Navigator/​Assets/​settings-flow.svg Removes the previous settings-flow diagram.
docs/​Guides/​Navigator/​Assets/​preferences-flow~dark.svg Adds a dark settings-resolution flow diagram.
docs/​Guides/​Navigator/​Assets/​preferences-flow.svg Adds the updated settings-resolution flow diagram.
CHANGELOG.md Records API replacement and EPUB behavior changes.

Review effort: Balanced

@mickael-menu
mickael-menu merged commit 6f420ea into develop Nov 27, 2026
5 checks passed
@mickael-menu
mickael-menu deleted the feature/editor-to-settings branch November 27, 2026 13:04
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