[net7.0] Cache the dynamic AppTheme value in Controls (and not Essentials) (#11200)#13963
Merged
[net7.0] Cache the dynamic AppTheme value in Controls (and not Essentials) (#11200)#13963
Conversation
…1200) Previously, the RequestedAppTheme and RequestedLayoutDiection values were cached on first access and this was incorrect as they can change at runtime - both by the OS and the user. This PR makes a few changes: Don't cache the theme and layout in Essentials as there is no way to update the cache Don't cache the layout anywhere because this is only accessed once when the window is [re]created Cache the theme in the Controls Application where the events can actually handle. --------- Co-authored-by: Rui Marinho <me@ruimarinho.net> Co-authored-by: Matthew Leibowitz <mattleibow@live.com> # Conflicts: # src/Essentials/src/AppInfo/AppInfo.android.cs
jsuarezruiz
approved these changes
Mar 15, 2023
Contributor
jsuarezruiz
left a comment
There was a problem hiding this comment.
Passing the Build. LGTM.
mandel-macaque
suggested changes
Mar 15, 2023
| } | ||
|
|
||
| public void NotifyThemeChanged() => | ||
| (this as IApplication).ThemeChanged(); |
Contributor
There was a problem hiding this comment.
Do we really need the 'as'?
Member
There was a problem hiding this comment.
If we want these changes we should do a PR to main and not lose the changes in this backport PR.
I don't think we need to block the backport PR on this, but perhaps we get a PR to main with the fixes before we complete this backport PR?
| _ => AppTheme.Unspecified | ||
| }; | ||
| var config = Application.Context.Resources?.Configuration; | ||
| if (config == null) |
Contributor
There was a problem hiding this comment.
Suggested change
| if (config == null) | |
| if (config is null) |
mandel-macaque
approved these changes
Mar 16, 2023
Contributor
mandel-macaque
left a comment
There was a problem hiding this comment.
Approving based on the fact that it is a backport.
Member
|
/backport to release/7.0.2xx |
Contributor
|
Started backporting to release/7.0.2xx: https://github.com/dotnet/maui/actions/runs/4469159124 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Backport of #11200 to net7.0
/cc @mattleibow @jonathanpeppers @jsuarezruiz @PureWeen @Redth