Skip to content
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

Closed
wants to merge 4 commits into from

Conversation

0x5bfa
Copy link
Member

@0x5bfa 0x5bfa commented Oct 8, 2023

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

  • Removed the duplicated SettingsViewModel
  • Fixed an issue where the action buttons of the properties window were invisible
  • Fixed an issuw where the window icon was not set properly
  • Clean up
  • Apply requested changes

Known Issues

Following issues would be fixed in the upcoming PR.

N/A

PR Checklist

Steps To Validate Changes

  • Open the app
  • Open properties window
  • See x button visibility on the active window
  • And hover the Files icon on the TaskBar
  • See the icon is set properly

Screenshots

image

image

Footnotes

  1. 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.

  2. 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.

@yaira2
Copy link
Member

yaira2 commented Oct 9, 2023

Are there any other steps that were used to validate these changes?

Can you fill this section out?

@0x5bfa
Copy link
Member Author

0x5bfa commented Oct 9, 2023

Done

@0x5bfa 0x5bfa changed the title Code Quality: Removed duplicated SettingsViewModel Code Quality: Fixed issues of properties window components Oct 14, 2023
@0x5bfa
Copy link
Member Author

0x5bfa commented Oct 16, 2023

@yaira2 This is ready for review.

/// <summary>
/// Provides static helper for switching and restoring app theme settings.
/// </summary>
public static class AppThemeHelper
Copy link
Member

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?

Copy link
Member

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; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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());
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public String AppThemeMode
public String AppTheme

@yaira2 yaira2 added the changes requested Changes are needed for this pull request label Oct 22, 2023
@yaira2 yaira2 changed the title Code Quality: Fixed issues of properties window components Code Quality: Fixed issues with the properties window components Oct 22, 2023
@yaira2 yaira2 force-pushed the main branch 4 times, most recently from 3ebb408 to eea0fb2 Compare October 31, 2023 01:16
@0x5bfa 0x5bfa closed this Oct 31, 2023
@0x5bfa 0x5bfa deleted the 5bfa/UpdatePropsWnd branch October 31, 2023 04:02
@0x5bfa 0x5bfa changed the title Code Quality: Fixed issues with the properties window components Code Quality: Improved app theme mode handler Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes requested Changes are needed for this pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants