Repository navigation
Move the settings into UIFoundation's Settings window - #41
Merged
Merged
Conversation
The Preferences form clamped a typed timeout to 0.1-120 s (falling back to the default for anything that is not a positive, finite number) and kept the image contrast level between 0 and 2, in private helpers of its view model that no test reached. PreferenceValuePolicy holds both rules now, so the Settings window can use them and swift test covers their edges.
The Preferences window and the separate Private Discriminator Settings window become two pages, General and Private Discriminator, of one Settings window: UIFoundation's SettingsWindowController, from the package's Settings trait (product UIFoundationSettingsUI). Only the presentation changes. PreferenceManager still keeps the general settings in the standard user defaults under the same keys, and PrivateDiscriminatorStore still keeps its own in config.json. - App menu: "Preferences…" is now "Settings…" (still Command-comma); the "Private Discriminator Settings…" item is gone. - The General page writes through PreferenceManager and follows it by KVO, so a change made elsewhere, such as the Dashboard's color format switch, shows up while the window is open. Typed timeouts and the contrast level go through PreferenceValuePolicy. - NavigationManager keeps one window controller for the app's lifetime, so the window reopens on the last page; with two pages the back and forward controls are hidden. - The DEBUG UI snapshots capture the new window as the "settings" scene. - The app target's membership list swaps the three removed files for the three new ones in LookInside/Settings. - String catalog: "Settings", "Settings…" and "General" in all 13 languages; the five strings no code uses any more are marked stale.
RuntimeViewer is the reference for UIFoundation's Settings window, and
both pages now follow it:
- The sidebar shows plain glyphs at 15 points. It is 20 points wider
than UIFoundation's default so "Private Discriminator" fits, and the
window grows by as much, so the pages keep their width.
- The back and forward controls are shown again.
- Each group has a header, and what a setting does moves from a line
under the row to the group's footer.
- Appearance is chosen from three thumbnails, read at run time from
System Settings' Appearance extension, so LookInside ships no copy of
them. Should a macOS version move them, the page falls back to the
pop-up menu.
- The timeouts are a field with a stepper; the footer gives the unit.
The new headers and thumbnail titles are translated into all 13
languages. The empty key leaves the string catalog: the Stepper("") in
the old Preferences view was the last thing that used it.
A group holding nothing but a button read as an empty box. The reset is now laid out the way Xcode's settings lay out theirs: a "Reset" header over a row titled "Reset Settings", with what it does under the title and the button at the trailing edge. The default library row names the modules it downloads, shows how the last update went under them, and keeps its button at the trailing edge. The module names come from the store, which now exposes them, and are formatted as a list for the user's language. The two new strings are translated into all 13 languages.
LabeledContent lines its control up with the first line of its label, so the Reset button sat level with "Reset Settings" instead of in the middle of the row, and the default library's button did the same once its status showed. Both rows are now an HStack, the way RuntimeViewer lays out its own, with the line under the title styled as before.
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.
Summary
The Preferences window and the separate Private Discriminator Settings window are now two pages — General and Private Discriminator — of one Settings window built on UIFoundation's
SettingsWindowController(the package'sSettingstrait, productUIFoundationSettingsUI). The pages are laid out the way RuntimeViewer lays out its settings in the same window.Only the presentation changes. Every value stays where it was:
PreferenceManagerkeeps the general settings in the standard user defaults under the same keys, andPrivateDiscriminatorStorekeeps its own inconfig.json, so existing users keep their settings and nothing is migrated.What changes for users
PreferenceManagerby KVO, so a change made elsewhere — the Dashboard's color format switch — shows up while the window is open.Implementation notes
LookInside.xcodeproj: the UIFoundation reference enables theSettingstrait next toAppleInternal, the app target linksUIFoundationSettingsUI, and the target's membership list swaps the three removed files for the three new ones inLookInside/Settings/.PreferenceValuePolicy(LookInsideHostCore) now holds the timeout and contrast rules the old form kept as private helpers, with swift-testing cases.NavigationManagerkeeps oneSettingsWindowControllerfor the app's lifetime. The sidebar is 20 points wider than UIFoundation's default so "Private Discriminator" fits, and the window grows by as much, so the pages keep their width.AppearanceAuto,AppearanceLightandAppearanceDarkin/System/Library/ExtensionKit/Extensions/Appearance.appex.HStackrather thanLabeledContent, which would line the button up with the title instead of centering it on both lines.PrivateDiscriminatorStoreexposesdefaultLibraryModuleNames; the page formats them as a list for the user's language.settingsscene (previouslypreferences), so its baseline needs recording again.Settings,Settings…,General, the group headersHierarchy,TimeoutsandModules, the thumbnail captionsSystem,LightandDark, andReset Settingswith its description, all in 13 languages. The five strings no code uses any more are marked stale, and the empty key left by the old Preferences view'sStepper("")is removed.After pulling
Turning a package trait on is not something Xcode's incremental build description notices. If a build reports
cannot find 'SettingsWindowController' in scope, delete the project's DerivedData and build again.Testing
swift testinPackages/LookInsideHostCore: all 117 tests pass, including the newPreferenceValuePolicyTests.xcodebuildDebug build of theLookInsidescheme succeeds, rerun after each layout commit; no new warnings.LookInside-InjectorandLookInside-MCPcheckouts, so the two embed phases stopped it afterwards, as they are designed to.