-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[NET10] Replace the obsolete RunJavaScriptTextInputPanel #28531
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
Conversation
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.
Pull Request Overview
This PR replaces the obsolete RunJavaScriptTextInputPanel with a new public API method and adds a decrement functionality in the Blazor sample page.
- Replaces the obsolete method with a new signature and updated parameter list in the iOS WebView manager.
- Removes deprecated warning suppression and updates logic for presenting the alert controller.
- Introduces a new Decrement button and corresponding logic in the Blazor sample page with a JavaScript confirmation.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/BlazorWebView/src/Maui/iOS/IOSWebViewManager.cs | Replaces obsolete RunJavaScriptTextInputPanel with new ShowJavaScriptTextInputPanel and adjusts alert controller presentation logic. |
src/Controls/samples/Controls.Sample/Pages/Blazor/Index.razor | Adds a new Decrement button with confirmation functionality via JSRuntime. |
Comments suppressed due to low confidence (1)
src/Controls/samples/Controls.Sample/Pages/Blazor/Index.razor:23
- The new Decrement method with asynchronous confirmation should be accompanied by test cases in TestCases.HostApp and TestCases.Shared.Tests.
async Task Decrement()
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.
Seems tests are failing
/_/src/BlazorWebView/src/Maui/iOS/IOSWebViewManager.cs(16707566): error MT4174: Unable to locate the block to delegate conversion method for the method System.Void Microsoft.AspNetCore.Components.WebView.Maui.IOSWebViewManager/WebViewUIDelegate::RunJavaScriptTextInputPanelWithPrompt(WebKit.WKWebView,Foundation.NSString,Foundation.NSString,WebKit.WKFrameInfo,System.Action`1<Foundation.NSString>)'s parameter #5. [/Users/builder/azdo/_work/_temp/test-dir/BuildWithDiffer1382439389/BuildWithDiffer1382439389.csproj::TargetFramework=net10.0-maccatalyst]
Should be fixed with the latest changes. |
/rebase |
79e7dd8
to
3548fcb
Compare
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 magic is to use the fancy code from dotnet/macios#15728 (comment)
Right now this PR still throws if null is used.
I'll update
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.
LGTM
Description of Change
This pull request introduces several enhancements and fixes across the Maui platform, focusing on improving iOS support, adding new functionality to Blazor components, and refining public APIs. Key changes include enabling unsafe code blocks, extending iOS-specific features, and adding user interaction capabilities in Blazor components.
Changes to iOS-specific functionality:
UIApplicationExtensions
public and addedGetKeyWindow
andGetWindow
extension methods to simplify window management in iOS. (src/Core/src/Platform/iOS/UIApplicationExtensions.cs
,src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt
,src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt
) [1] [2] [3]IOSWebViewManager
to useGetKeyWindow
instead of deprecatedUIApplication.Windows
for compatibility with iOS 15+ and introducedActionStringTrampolineBlock
for handling unmanaged function pointers. (src/BlazorWebView/src/Maui/iOS/IOSWebViewManager.cs
) [1] [2]Enhancements to Blazor components:
Decrement
andSet Value
) to the Blazor sample app, enabling user interactions with JavaScript for confirmation dialogs, prompts, and alerts. (src/Controls/samples/Controls.Sample/Pages/Blazor/Index.razor
)Build and project settings:
AllowUnsafeBlocks
property in theMicrosoft.AspNetCore.Components.WebView.Maui.csproj
file to allow unsafe code usage. (src/BlazorWebView/src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csproj
)These changes improve compatibility, enhance functionality, and refine user interactions within the Maui platform and Blazor components.
Issues Fixed
Fixes #28135