Repository navigation
fix: Settings Watchdog and Camera/Mic/Location look again each time they are shown, and the drift CSV says what Restore will do - #2939
Merged
Conversation
…hey are shown, and the drift CSV says what Restore will do - SettingsWatchdogViewModel and PrivacyMonitorViewModel have an IsActive flag, set by MainWindowViewModel.SetActive, that looks again when the tab comes on screen once the first look is done, as Undo Changes and Recent Changes do. Camera/Mic/Location does not start a read beside a Refresh still reading. Both tabs read only when built and on Refresh, so a link from Undo Changes showed the look from before the change, and "In use now" stayed. - SettingsWatchdogService.ToCsv writes CanWriteBack in "Can restore", and the drift row's CanRestore is CanWriteBack: a setting not set in the baseline is never put back, and every catalog entry has CanRestore.
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.
Closes #2837.
Confirmed in the code: both view models read in their constructor and then only on Refresh or F5, both are kept until SysManager closes, and neither had an
IsActiveflag or a case inMainWindowViewModel.SetActive.SettingsWatchdogService.ToCsvwroteCanRestore, which is true for every catalog entry, while Restore has usedCanWriteBacksince #2594.The changes:
SettingsWatchdogViewModel.IsActiveandPrivacyMonitorViewModel.IsActive, set bySetActive, look again when the tab comes on screen once the first look has finished, the way Undo Changes and Recent Changes do. Settings Watchdog's look is the one Refresh runs, so a link from Undo Changes or Recent Changes now shows the change it was sent for, and Restore can act on it. Camera/Mic/Location starts its read off the UI thread as before, and not beside a Refresh still reading, which would have disposed the first read's cancellation source under it.ShownRefreshlets a test await the read.SettingsWatchdogService.ToCsvwritesCanWriteBackin "Can restore", andDriftRow.CanRestore, bound by nothing today, isCanWriteBacktoo, so the row, the CSV and Restore agree.EveryViewModelWithAnIsActiveFlag_IsHandledBySetActivealready holds everyIsActiveflag to a case inSetActive; it fails with either case removed.Docs
README: Camera/Mic/Location reads again each time it is opened, so "In use now" means now; Settings Watchdog checks each time it is opened; and the CSV's "Can restore" says "no" for a setting that was not set when the baseline was saved.
Tests
SettingsWatchdogViewModelTests: a setting that drifts after the tab was built is listed when the tab is shown again, with Restore on; leaving the tab reads nothing; and a drift with no value in the baseline is not offered on its row.PrivacyMonitorViewModelTests: a camera in use at the first read and let go of since no longer reads "In use now" once the tab is shown again; leaving the tab reads nothing; and showing it while a Refresh is reading starts no second read.CsvExportTests: a drift whose baseline value is null writes "no".CanRestore; and the twoSetActivecases removed (the existing guard).SettingsWatchdogViewModelTests,PrivacyMonitorViewModelTests,CsvExportTests,SettingsWatchdogServiceTests,SettingsWatchdogViewBindingTests,PrivacyMonitorServiceTests,UndoChangesViewModelTests,RecentChangesViewModelTests,ArchitectureTestsandInclusiveTermsTests(519), and the integrationFormattedLabelViewUiTests(7). All four projects build with 0 warnings, anddotnet format --verify-no-changesis clean.