refactor(tray): extract Settings page into a WinUI-free view model over a settings store#1043
Open
bkudiess wants to merge 1 commit into
Open
refactor(tray): extract Settings page into a WinUI-free view model over a settings store#1043bkudiess wants to merge 1 commit into
bkudiess wants to merge 1 commit into
Conversation
…er a settings store Moves the Settings page's settings read/persist logic out of the code-behind into a WinUI-free view model backed by a new settings facade, as a behavior-and-visual-identical refactor. First page to adopt the merged DI + navigation activation seam and the first visible reduction of a page god-file. - Add ISettingsStore (SettingsStore): immutable snapshot read, batched Update, a single non-echoing Changed (self-originated saves suppressed; external saves marshaled to the UI thread), and BeginSelfWrite() so App-owned direct writes share the same echo suppression. - Add SettingsPageViewModel (WinUI-free): two-way-bindable settings state that persists through the store, preserving the save/notify contract and the read-aloud / tool-call side effects, reloading on external change without re-persisting, and normalizing combo values so a legacy tag never renders blank. - Add SettingsAppInfoProjection (WinUI-free) for the About section strings. - Bind SettingsPage.xaml to the view model; shrink the code-behind to the remaining view concerns (gateway removal dialog, uptime timer, saved indicator, app-info, gateway-section refresh on external change). - Populate the page->view-model map so the navigation hook resolves and binds the view model; add ApplyAutoStart/SetChatSpeakerMuted/SetChatToolCallsVisible to the app-commands adapter, with mute suppression scoped to the Settings call. - Record settings-store and settings-page-vm in the architecture ledger with behavioral guard tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: refactor(tray): extract Settings page into a WinUI-free view model over a settings store This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
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.
Moves the Settings page's settings read/persist logic out of the code-behind into a WinUI-free view model backed by a new settings facade, as a behavior-and-visual-identical refactor. First page to adopt the merged DI + navigation activation seam and the first visible reduction of a page god-file.
What changed
ISettingsStore(SettingsStore): immutable snapshot read, batchedUpdate, a single non-echoingChanged(self-originated saves suppressed; external saves marshaled to the UI thread), andBeginSelfWrite()so App-owned direct writes (auto-start OS registration, speaker mute from Settings) share the same echo suppression.SettingsPageViewModel(WinUI-free): two-way-bindable settings state that persists through the store, preserving the save/notify contract and the read-aloud / tool-call side effects, reloading on external change without re-persisting, and normalizing combo values so a legacy tag never renders blank.SettingsAppInfoProjection(WinUI-free) for the About section strings.SettingsPage.xamlto the view model; shrink the code-behind (about -258 lines) to the remaining view concerns (gateway removal dialog, uptime timer, saved indicator, app-info, gateway-section refresh on external change).ApplyAutoStart/SetChatSpeakerMuted/SetChatToolCallsVisibleto the app-commands adapter, with mute suppression scoped to the Settings-originated call so a mute toggled elsewhere still refreshes an open Settings page.settings-storeandsettings-page-vmin the architecture ledger with behavioral guard tests.Validation
./build.ps1dotnet test tests/OpenClaw.Shared.Tests(3170 passed)dotnet test tests/OpenClaw.Tray.Tests(1954 passed)New tests cover the store (self-write suppression, external-change echo, depth reset), the view model (field mapping, save/notify ordering, no-echo, combo normalization, auto-start success/failure), and the app-info projection; ledger consistency passes.
Real behavior proof
Isolated build: navigated to Settings via the node
app.navigatecommand; toggles and combos persist tosettings.jsonand flash the Saved indicator; a legacy value renders the correct item instead of a blank combo; Start-with-Windows persists through the ordered auto-start path and shows Saved only after it persists; the About section renders the runtime/version/channel/build-date projection; values survive an app restart with no spurious save on open. Renders identically to the pre-change page.