Refactor theme resource dictionary retrieval logic#4331
Refactor theme resource dictionary retrieval logic#4331Jack251970 wants to merge 1 commit intodevfrom
Conversation
Replaced separate calls to GetResourceDictionary and UpdateResourceDictionary with a single GetThemeResourceDictionary call in Theme.cs. Updated blur enablement check to use the new dictionary variable, simplifying theme resource management.
|
🥷 Code experts: no user but you matched threshold 10 Jack251970 has most 👩💻 activity in the files. See details
Activity based on git-commit:
Knowledge based on git-blame: ✨ Comment |
|
Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX. |
There was a problem hiding this comment.
Pull request overview
Refactors how Theme.ChangeTheme retrieves the theme ResourceDictionary (separating “raw theme dictionary” retrieval from the dictionary used for applying runtime font/window-size settings), and uses the refactored retrieval for blur capability detection.
Changes:
- Removed direct theme resource application (
UpdateResourceDictionary) fromChangeTheme. - Switched blur detection in
ChangeThemeto useGetThemeResourceDictionary(theme).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Flow.Launcher.Core/Resource/Theme.cs`:
- Around line 430-434: ChangeTheme currently only sets BlurEnabled and defers
swapping Application.Current.Resources.MergedDictionaries to
RefreshFrameAsync/SetBlurForWindow, breaking the synchronous contract; update
ChangeTheme to synchronously apply the new resource dictionary returned by
GetThemeResourceDictionary(theme) into
Application.Current.Resources.MergedDictionaries (perform the swap before
calling RefreshFrameAsync), then compute BlurEnabled and finally fire
RefreshFrameAsync/SetBlurForWindow asynchronously if needed so callers see the
new theme immediately; reference GetThemeResourceDictionary, BlurEnabled,
RefreshFrameAsync, SetBlurForWindow, ChangeTheme, and
Application.Current.Resources.MergedDictionaries.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0fa6601a-6cb8-4a00-ad0d-46dacceacdc3
📒 Files selected for processing (1)
Flow.Launcher.Core/Resource/Theme.cs
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="Flow.Launcher.Core/Resource/Theme.cs">
<violation number="1" location="Flow.Launcher.Core/Resource/Theme.cs:430">
P2: `ChangeTheme` now returns success before the theme resource is actually applied, so async apply failures can be missed and leave state inconsistent.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
CHANGES
No need to update the resource dictionary in this place. Since it will be updated later in this function.
Separated from #4302.
TEST
Summary by cubic
Refactors theme resource dictionary handling in
Theme.ChangeThemeto use a singleGetThemeResourceDictionarycall. Simplifies blur enablement logic without changing user-visible behavior.GetThemeResourceDictionary(theme). Dictionary retrieval happens once and is used directly forIsThemeBlurEnabled.GetThemeResourceDictionary(theme)to centralize getting the font-applied theme resources used during theme change.GetResourceDictionary(theme)andUpdateResourceDictionary(...).Written for commit c0134d5. Summary will update on new commits.