新增“切换系统强调色”行动,修复媒体规则抖动并统一主题切换逻辑#73
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a243443a7d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| _lastMediaRuleCheckAt = now; | ||
| return _lastMediaRuleResult; |
There was a problem hiding this comment.
Clear cached playing state when SMTC query throws
If media was previously detected as playing, this catch path returns that stale true value on every SMTC failure, so the rule can remain permanently true after playback has already stopped whenever RequestAsync()/GetSessions() starts throwing (for example, intermittent WinRT/permission failures). Because this rule drives automations, returning the last positive state on exceptions can cause repeated false triggers; the failure path should invalidate or age out the cached result instead of reusing it indefinitely.
Useful? React with 👍 / 👎.
| var settingsServiceObj = IAppHost.TryGetService<object>(); | ||
| if (settingsServiceObj != null) | ||
| { | ||
| var type = settingsServiceObj.GetType(); | ||
| if (type.Name == "SettingsService") |
There was a problem hiding this comment.
Resolve settings service instead of requesting object
This lookup asks DI for object, which typically does not resolve to arbitrary registered services in the default .NET container, so the reflection branch is effectively unreachable and the method always falls back to IThemeService.SetTheme(...). That means the new “apply like app settings” synchronization logic does not actually run, so the intended fix for theme-state consistency is not applied.
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 588cec70da
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Motivation
规则集更新触发器下的频繁抖动问题,避免误触发自动化工作流。Description
SwitchSystemAccentColorAction(Actions/SwitchSystemAccentColorAction.cs)及其设置模型AccentColorSettings(Settings/AccentColorSettings.cs)和设置控件AccentColorSettingsControl(Controls/AccentColorSettingsControl.cs),通过注册表写入实现即时切换强调色。Plugin.cs中注册新行动并将其加入“系统个性化”菜单和功能开关页(添加动作注册与菜单项)。Plugin.cs中的HandleMediaMusicPlayingRule):保持使用 SMTC 遍历会话判断是否存在任意Playing会话的核心逻辑,同时加入 800ms 短时缓存与异常回退以降低高频触发抖动。AdaptiveThemeSyncService的自动应用主题逻辑改为优先通过反射写入SettingsService.Settings.Theme(方法ApplyThemeLikeAppSettings),无法访问时回退到IThemeService.SetTheme(...),使行为更接近 ClassIsland 的“应用设置”实现。Testing
dotnet build -v minimal但当前运行环境缺少 .NET SDK,构建未能执行(dotnet: command not found)。Codex Task