Repository navigation
Replace the preferences editors with settings(for:) and isApplicable(_:) - #952
Merged
Merged
Conversation
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.
…re/editor-to-settings
There was a problem hiding this comment.
🟡 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:)andisApplicable(_:). - Updates TestApp integrations, migration guidance, and tests for app-owned settings.
- Supports disabling EPUB line-length limits with
.infinityor0, and passes letter spacing directly inrem.
| 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
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.

Removes the preferences editors and the
Preferencemachinery. Apps keep their own settings model and get the settings a navigator would apply withnavigator.settings(for:). They disable the controls that don't apply withisApplicable(_:)onEPUBSettings,PDFSettingsandAudioSettings. Suggested ranges, steps and starting values move to the doc comments of thePreferencestypes.Also:
maximalLineLengthaccepts.infinityandminimalLineLengthaccepts0to remove the limits.letterSpacingis no longer halved, matching the other Readium toolkits.Changelog
Added
Navigator
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 withisApplicable(_:), e.g. to disable the controls of a settings screen, see the user guide.Changed
Navigator
maximalLineLengthto.infinityto let them take all the available width.letterSpacingEPUB preference is no longer halved:1.0is now1reminstead of0.5rem, like in the other Readium toolkits, see the migration guide.Removed
Navigator
EPUBPreferencesEditor) are removed. Edit the preferences in your own settings model, and check which settings apply withnavigator.settings(for:)andisApplicable(_:), see the migration guide.