-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code Quality: Improved app theme mode handler #13490
Conversation
Can you fill this section out? |
Done |
@yaira2 This is ready for review. |
/// <summary> | ||
/// Provides static helper for switching and restoring app theme settings. | ||
/// </summary> | ||
public static class AppThemeHelper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be simplified to ThemeHelper?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, looks like that was already the name.
/// <summary> | ||
/// Gets or sets a value for the app theme mode. | ||
/// </summary> | ||
String AppThemeMode { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String AppThemeMode { get; set; } | |
String AppTheme { get; set; } |
I think we can remove the "Mode" part.
section.IsExpanded = Ioc.Default.GetRequiredService<SettingsViewModel>().Get(section.Text == "SidebarFavorites".GetLocalizedResource(), $"section:{section.Text.Replace('\\', '_')}"); | ||
var key = $"section:{section.Text.Replace('\\', '_')}"; | ||
|
||
section.IsExpanded = ApplicationData.Current.LocalSettings.Values.Get(key, section.Text == "SidebarFavorites".GetLocalizedResource()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's out of scope for this PR, but there is some room for further improvements in this area. Ideally this would be saved to settings.json
like everything eles.
@@ -35,6 +35,13 @@ public bool UseCompactStyles | |||
set => Set(value); | |||
} | |||
|
|||
/// <inheritdoc/> | |||
public String AppThemeMode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public String AppThemeMode | |
public String AppTheme |
3ebb408
to
eea0fb2
Compare
Summary
During removing SettingsViewModel, I had to alter ThemeHelper since that ViewModel contained theme change event handler. And while I changing ThemeHelper, I noticed there were several visual issues therefore I fixed in this PR.
Task Checklist
Known Issues
Following issues would be fixed in the upcoming PR.
N/A
PR Checklist
Steps To Validate Changes
Screenshots
Footnotes
If the request hasn't been agreed by the team, this work might be rejected. Make sure that you get approval from the team before opening any PR related the request. ↩
If you removed any en-US string resources, make sure that there are no references of those resources. When you add a new en-US string resources, do not make any changes on other languages' resources; Crowdin will do, instead. ↩