-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Fix for [iOS] Use non-overridden traits in AppInfoImplementation.RequestTheme #25497
Open
SuthiYuvaraj
wants to merge
4
commits into
dotnet:main
Choose a base branch
from
SuthiYuvaraj:fix-23411
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+131
−3
Open
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
src/Controls/tests/TestCases.HostApp/Issues/Issue23411.xaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Maui.Controls.Sample.Issues.Issue23411"> | ||
|
||
<ScrollView AutomationId="ThemePage"> | ||
<VerticalStackLayout | ||
Padding="30,0" | ||
Spacing="25"> | ||
<Image | ||
Source="dotnet_bot.png" | ||
HeightRequest="185" | ||
Aspect="AspectFit" | ||
SemanticProperties.Description="dot net bot in a race car number eight" /> | ||
|
||
<Label | ||
Text="Hello, World!" | ||
Style="{StaticResource Headline}" | ||
SemanticProperties.HeadingLevel="Level1" /> | ||
|
||
<Label | ||
Text="Welcome to .NET Multi-platform App UI" | ||
Style="{StaticResource SubHeadline}" | ||
SemanticProperties.HeadingLevel="Level2" | ||
SemanticProperties.Description="Welcome to dot net Multi platform App U I" /> | ||
|
||
<Button AutomationId="ModalPageButton" | ||
x:Name="ModalPageBtn" | ||
Text="Open modal page" | ||
Clicked="OnModalPage" | ||
HorizontalOptions="Fill" /> | ||
|
||
<Button | ||
x:Name="LightThemeBtn" | ||
Text="Light theme" | ||
Clicked="OnLightTheme" | ||
HorizontalOptions="Fill" /> | ||
|
||
<Button | ||
x:Name="DarkThemeBtn" | ||
Text="Dark theme" | ||
Clicked="OnDarkTheme" | ||
HorizontalOptions="Fill" /> | ||
|
||
<Button AutomationId="ResetThemeButton" | ||
x:Name="ResetThemeBtn" | ||
Text="Reset theme" | ||
Clicked="OnResetTheme" | ||
HorizontalOptions="Fill" /> | ||
</VerticalStackLayout> | ||
</ScrollView> | ||
</ContentPage> |
43 changes: 43 additions & 0 deletions
43
src/Controls/tests/TestCases.HostApp/Issues/Issue23411.xaml.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#if IOS | ||
using Microsoft.Maui.Controls; | ||
using Microsoft.Maui.Controls.PlatformConfiguration; | ||
using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific; | ||
using Application = Microsoft.Maui.Controls.Application; | ||
using NavigationPage = Microsoft.Maui.Controls.NavigationPage; | ||
|
||
namespace Maui.Controls.Sample.Issues | ||
{ | ||
[Issue(IssueTracker.Github, 23411, "[iOS]Use non-overridden traits in AppInfoImplementation.RequestTheme", | ||
PlatformAffected.iOS)] | ||
public partial class Issue23411 : ContentPage | ||
{ | ||
public Issue23411() | ||
{ | ||
InitializeComponent(); | ||
Application.Current.UserAppTheme = AppTheme.Dark; | ||
} | ||
|
||
private void OnModalPage(object sender, EventArgs e) | ||
{ | ||
var modalPage = new NavigationPage(new Issue23411() { Title = "Modal Page" ,AutomationId = "PageSheetModalPage" }); | ||
modalPage.On<iOS>().SetModalPresentationStyle(UIModalPresentationStyle.PageSheet); | ||
Navigation.PushModalAsync(modalPage); | ||
} | ||
|
||
private void OnDarkTheme(object sender, EventArgs e) | ||
{ | ||
Application.Current!.UserAppTheme = AppTheme.Dark; | ||
} | ||
|
||
private void OnLightTheme(object sender, EventArgs e) | ||
{ | ||
Application.Current!.UserAppTheme = AppTheme.Light; | ||
} | ||
|
||
private void OnResetTheme(object sender, EventArgs e) | ||
{ | ||
Application.Current!.UserAppTheme = AppTheme.Unspecified; | ||
} | ||
} | ||
} | ||
#endif |
32 changes: 32 additions & 0 deletions
32
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23411.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#if IOS | ||
using NUnit.Framework.Legacy; | ||
using NUnit.Framework; | ||
using UITest.Appium; | ||
using UITest.Core; | ||
|
||
namespace Microsoft.Maui.TestCases.Tests.Issues | ||
{ | ||
internal class Issue23411 : _IssuesUITest | ||
{ | ||
public override string Issue => "[iOS]Use non-overridden traits in AppInfoImplementation.RequestTheme"; | ||
|
||
public Issue23411(TestDevice device) : base(device) | ||
{ | ||
} | ||
|
||
[Test] | ||
[Category(UITestCategories.Page)] | ||
public void ThemeUnspecifiedDoesNotAffectModalPageSheet() | ||
{ | ||
// Is a iOS issue; see https://github.com/dotnet/maui/issues/23411 | ||
App.WaitForElement("ThemePage"); | ||
App.WaitForElement("ModalPageButton"); | ||
App.Tap("ModalPage"); | ||
App.WaitForElement("PageSheetModalPage"); | ||
App.WaitForElement("ResetThemeButton"); | ||
VerifyScreenshot(); | ||
|
||
} | ||
} | ||
} | ||
#endif |
This file contains 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
Oops, something went wrong.
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.
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.
The EventHandler is only created for iOS and failing in the rest of the platforms.
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.
@jsuarezruiz ,Thank you for sharing your concerns with us. We are actively working to resolve the issue and optimize the code for all platforms. We will provide you with an update on the latest fix as soon as possible.