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

[macOS/iOS] Fix RequestedThemeChanged event #11199

Merged
merged 16 commits into from
Mar 16, 2023
Merged

[macOS/iOS] Fix RequestedThemeChanged event #11199

merged 16 commits into from
Mar 16, 2023

Conversation

jsuarezruiz
Copy link
Contributor

@jsuarezruiz jsuarezruiz commented Nov 8, 2022

Description of Change

Fix RequestedThemeChanged event using Shell on macOS/iOS.

fix-macos-themes

We use the page controller to detect theme changes thanks to traitCollectionDidChange. However, with Shell this doesn't work and the default project template uses Shell. This PR applies changes to detect changes in themes also using Shell.

Issues Fixed

Fixes #10055
Fixes #10310
Fixes #11005
Fixes #11119

@jsuarezruiz jsuarezruiz added t/bug Something isn't working area-xaml XAML, CSS, Triggers, Behaviors labels Nov 8, 2022
@Redth Redth requested a review from PureWeen November 22, 2022 16:56
@piotreksda
Copy link

When will the changes be available in the .net 6 stable version?

@jfversluis
Copy link
Member

When will the changes be available in the .net 6 stable version?

This will probably not land in .NET 6 as it introduces new APIs and thus breaking changes. This will become available in .NET 8 or if we decide this is crucial in .NET 7 maybe.

@Hurricane31337
Copy link

When will the changes be available in the .net 6 stable version?

This will probably not land in .NET 6 as it introduces new APIs and thus breaking changes. This will become available in .NET 8 or if we decide this is crucial in .NET 7 maybe.

Please at least make this change in .NET 7. This is not a new feature but a crucial fix for developing macOS apps using .NET MAUI.

I am currently developing a MAUI application that I intend to ship to macOS only (cross platform to be flexible) and my current experience is that its Dark Mode capabilities are completely unusable without this fix and I would never ship my app in its current state.

How could it be better to keep it in its current state "to not break things"? Currently this part of the macOS target is completely broken anyways! 😃

Copy link
Member

@mandel-macaque mandel-macaque left a comment

Choose a reason for hiding this comment

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

Small possible improvement

…ctionRootRenderer.cs

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
@samhouts samhouts dismissed mandel-macaque’s stale review February 27, 2023 17:34

Changes made. Please re-review.

@mattleibow mattleibow self-assigned this Mar 8, 2023
@mattleibow mattleibow added the area-theme Themes, theming label Mar 8, 2023
@mattleibow
Copy link
Member

This will be superseded by #13510. However, this PR is more backport friendly and we can get the fix in sooner until @PureWeen runs all the tests.

This PR is very hard to test because our UI tests are not yet ready to run and this is an OS event.

@mattleibow mattleibow enabled auto-merge (squash) March 16, 2023 20:34
@mattleibow mattleibow added the backport/suggested The PR author or issue review has suggested that the change should be backported. label Mar 16, 2023
@mattleibow mattleibow merged commit 9b58e56 into main Mar 16, 2023
@mattleibow mattleibow deleted the fix-10055 branch March 16, 2023 21:15
@rmarinho
Copy link
Member

/backport to net7.0

@rmarinho rmarinho added the backport/approved After some discussion or review, this PR or change was approved to be backported. label Mar 20, 2023
@github-actions
Copy link
Contributor

Started backporting to net7.0: https://github.com/dotnet/maui/actions/runs/4469092013

@github-actions
Copy link
Contributor

@rmarinho backporting to net7.0 failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: Fix RequestedThemeChanged event on macOS using Shell
Using index info to reconstruct a base tree...
M	src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt
M	src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt
Falling back to patching base and 3-way merge...
Auto-merging src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt
CONFLICT (content): Merge conflict in src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt
Auto-merging src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt
CONFLICT (content): Merge conflict in src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Fix RequestedThemeChanged event on macOS using Shell
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

@github-actions
Copy link
Contributor

@rmarinho an error occurred while backporting to net7.0, please check the run log for details!

Error: git am failed, most likely due to a merge conflict.

@mattleibow
Copy link
Member

/backport to main

@github-actions
Copy link
Contributor

Started backporting to main: https://github.com/dotnet/maui/actions/runs/4469507099

@github-actions
Copy link
Contributor

@mattleibow backporting to main failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: Fix RequestedThemeChanged event on macOS using Shell
Using index info to reconstruct a base tree...
M	src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRootRenderer.cs
M	src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt
M	src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt
Falling back to patching base and 3-way merge...
Auto-merging src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt
CONFLICT (content): Merge conflict in src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt
Auto-merging src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt
CONFLICT (content): Merge conflict in src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt
Auto-merging src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRootRenderer.cs
CONFLICT (content): Merge conflict in src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRootRenderer.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Fix RequestedThemeChanged event on macOS using Shell
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

@github-actions
Copy link
Contributor

@mattleibow an error occurred while backporting to main, please check the run log for details!

Error: git am failed, most likely due to a merge conflict.

mattleibow added a commit that referenced this pull request Mar 20, 2023
Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
Co-authored-by: Rui Marinho <me@ruimarinho.net>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
github-actions bot pushed a commit that referenced this pull request Mar 20, 2023
Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
Co-authored-by: Rui Marinho <me@ruimarinho.net>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
rmarinho added a commit that referenced this pull request Mar 20, 2023
Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com>
Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
Co-authored-by: Rui Marinho <me@ruimarinho.net>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
mattleibow added a commit that referenced this pull request Mar 20, 2023
Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com>
Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
Co-authored-by: Rui Marinho <me@ruimarinho.net>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-theme Themes, theming area-xaml XAML, CSS, Triggers, Behaviors backport/approved After some discussion or review, this PR or change was approved to be backported. backport/suggested The PR author or issue review has suggested that the change should be backported. platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst t/bug Something isn't working
Projects
None yet
9 participants