From 218ce12eeaef231f343d1188cb6fcac7bfde192e Mon Sep 17 00:00:00 2001 From: Eilon Lipton Date: Mon, 22 Jul 2024 16:18:38 -0700 Subject: [PATCH] HybridWebView: Invoke JS methods from .NET Fixes #22303 --- .../Pages/Controls/HybridWebViewPage.xaml | 24 +++- .../Pages/Controls/HybridWebViewPage.xaml.cs | 27 +++- .../Resources/Raw/HybridSamplePage/index.html | 14 +- .../src/Core/HybridWebView/HybridWebView.cs | 126 ++++++++++++++++-- .../net-android/PublicAPI.Unshipped.txt | 3 + .../PublicAPI/net-ios/PublicAPI.Unshipped.txt | 3 + .../net-maccatalyst/PublicAPI.Unshipped.txt | 3 + .../net-tizen/PublicAPI.Unshipped.txt | 3 + .../net-windows/PublicAPI.Unshipped.txt | 3 + .../PublicAPI/net/PublicAPI.Unshipped.txt | 3 + .../netstandard/PublicAPI.Unshipped.txt | 3 + src/Controls/src/Core/WebView/WebView.cs | 2 +- .../HybridWebView/HybridWebViewTests.cs | 77 ++++++++++- .../Resources/Raw/HybridTestRoot/index.html | 14 +- src/Core/src/Core/IHybridWebView.cs | 17 ++- .../HybridWebViewHandler.Android.cs | 15 ++- .../HybridWebViewHandler.Standard.cs | 2 + .../HybridWebViewHandler.Tizen.cs | 2 + .../HybridWebViewHandler.Windows.cs | 58 ++++++-- .../HybridWebView/HybridWebViewHandler.cs | 3 +- .../HybridWebView/HybridWebViewHandler.iOS.cs | 24 ++-- .../src/Platform/Windows/MauiHybridWebView.cs | 12 ++ .../src/Primitives/HybridWebViewRawMessage.cs | 13 ++ .../net-android/PublicAPI.Unshipped.txt | 6 + .../PublicAPI/net-ios/PublicAPI.Unshipped.txt | 6 + .../net-maccatalyst/PublicAPI.Unshipped.txt | 6 + .../net-tizen/PublicAPI.Unshipped.txt | 6 + .../net-windows/PublicAPI.Unshipped.txt | 7 + .../src/PublicAPI/net/PublicAPI.Unshipped.txt | 6 + .../netstandard/PublicAPI.Unshipped.txt | 6 + .../netstandard2.0/PublicAPI.Unshipped.txt | 6 + 31 files changed, 444 insertions(+), 56 deletions(-) create mode 100644 src/Core/src/Primitives/HybridWebViewRawMessage.cs diff --git a/src/Controls/samples/Controls.Sample/Pages/Controls/HybridWebViewPage.xaml b/src/Controls/samples/Controls.Sample/Pages/Controls/HybridWebViewPage.xaml index 78779691808a..2c383a2cb032 100644 --- a/src/Controls/samples/Controls.Sample/Pages/Controls/HybridWebViewPage.xaml +++ b/src/Controls/samples/Controls.Sample/Pages/Controls/HybridWebViewPage.xaml @@ -8,22 +8,34 @@ -