From c4d65c5a0f5e43a49ccdb95cae7cbccc305e767f Mon Sep 17 00:00:00 2001 From: Eilon Lipton Date: Thu, 23 May 2024 11:17:20 -0700 Subject: [PATCH 1/8] Initial HybridWebView control to send messages between C# and .NET Fixes #22302 --- .../Pages/Controls/HybridWebViewPage.xaml | 32 ++ .../Pages/Controls/HybridWebViewPage.xaml.cs | 23 + .../Raw/HybridSamplePage/docs/sample.pdf | Bin 0 -> 18144 bytes .../Resources/Raw/HybridSamplePage/index.html | 32 ++ .../HybridSamplePage/scripts/HybridWebView.js | 48 ++ .../Raw/HybridSamplePage/styles/app.css | 10 + .../ViewModels/ControlsViewModel.cs | 3 + .../src/Core/HybridWebView/HybridWebView.cs | 54 ++ ...ybridWebViewRawMessageReceivedEventArgs.cs | 14 + .../net-android/PublicAPI.Unshipped.txt | 13 + .../PublicAPI/net-ios/PublicAPI.Unshipped.txt | 13 + .../net-maccatalyst/PublicAPI.Unshipped.txt | 13 + .../net-tizen/PublicAPI.Unshipped.txt | 13 + .../net-windows/PublicAPI.Unshipped.txt | 13 + .../PublicAPI/net/PublicAPI.Unshipped.txt | 13 + .../netstandard/PublicAPI.Unshipped.txt | 13 + .../Xaml/Hosting/AppHostBuilderExtensions.cs | 1 + .../DeviceTests/Controls.DeviceTests.csproj | 4 + .../HybridWebView/HybridWebViewTests.cs | 83 ++++ .../Resources/Raw/HybridTestRoot/index.html | 23 + .../HybridTestRoot/scripts/HybridWebView.js | 48 ++ .../tests/DeviceTests/TestCategory.cs | 1 + src/Core/src/Core/IHybridWebView.cs | 18 + .../FileExtensionContentTypeProvider.cs | 469 ++++++++++++++++++ .../HybridWebViewHandler.Android.cs | 115 +++++ .../HybridWebViewHandler.Standard.cs | 11 + .../HybridWebViewHandler.Tizen.cs | 11 + .../HybridWebViewHandler.Windows.cs | 148 ++++++ .../HybridWebView/HybridWebViewHandler.cs | 110 ++++ .../HybridWebView/HybridWebViewHandler.iOS.cs | 213 ++++++++ .../HybridWebViewQueryStringHelper.cs | 50 ++ .../HybridWebView/IHybridPlatformWebView.cs | 7 + .../HybridWebView/IHybridWebViewHandler.cs | 23 + .../src/Platform/Android/MauiHybridWebView.cs | 27 + .../Android/MauiHybridWebViewClient.cs | 109 ++++ .../src/Platform/Windows/MauiHybridWebView.cs | 22 + .../src/Platform/iOS/MauiHybridWebView.cs | 29 ++ .../net-android/PublicAPI.Unshipped.txt | 35 ++ .../PublicAPI/net-ios/PublicAPI.Unshipped.txt | 32 ++ .../net-maccatalyst/PublicAPI.Unshipped.txt | 33 ++ .../net-tizen/PublicAPI.Unshipped.txt | 27 + .../net-windows/PublicAPI.Unshipped.txt | 32 ++ .../src/PublicAPI/net/PublicAPI.Unshipped.txt | 27 + .../netstandard/PublicAPI.Unshipped.txt | 27 + .../netstandard2.0/PublicAPI.Unshipped.txt | 27 + 45 files changed, 2069 insertions(+) create mode 100644 src/Controls/samples/Controls.Sample/Pages/Controls/HybridWebViewPage.xaml create mode 100644 src/Controls/samples/Controls.Sample/Pages/Controls/HybridWebViewPage.xaml.cs create mode 100644 src/Controls/samples/Controls.Sample/Resources/Raw/HybridSamplePage/docs/sample.pdf create mode 100644 src/Controls/samples/Controls.Sample/Resources/Raw/HybridSamplePage/index.html create mode 100644 src/Controls/samples/Controls.Sample/Resources/Raw/HybridSamplePage/scripts/HybridWebView.js create mode 100644 src/Controls/samples/Controls.Sample/Resources/Raw/HybridSamplePage/styles/app.css create mode 100644 src/Controls/src/Core/HybridWebView/HybridWebView.cs create mode 100644 src/Controls/src/Core/HybridWebView/HybridWebViewRawMessageReceivedEventArgs.cs create mode 100644 src/Controls/tests/DeviceTests/Elements/HybridWebView/HybridWebViewTests.cs create mode 100644 src/Controls/tests/DeviceTests/Resources/Raw/HybridTestRoot/index.html create mode 100644 src/Controls/tests/DeviceTests/Resources/Raw/HybridTestRoot/scripts/HybridWebView.js create mode 100644 src/Core/src/Core/IHybridWebView.cs create mode 100644 src/Core/src/Handlers/HybridWebView/FileExtensionContentTypeProvider.cs create mode 100644 src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Android.cs create mode 100644 src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Standard.cs create mode 100644 src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Tizen.cs create mode 100644 src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.Windows.cs create mode 100644 src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.cs create mode 100644 src/Core/src/Handlers/HybridWebView/HybridWebViewHandler.iOS.cs create mode 100644 src/Core/src/Handlers/HybridWebView/HybridWebViewQueryStringHelper.cs create mode 100644 src/Core/src/Handlers/HybridWebView/IHybridPlatformWebView.cs create mode 100644 src/Core/src/Handlers/HybridWebView/IHybridWebViewHandler.cs create mode 100644 src/Core/src/Platform/Android/MauiHybridWebView.cs create mode 100644 src/Core/src/Platform/Android/MauiHybridWebViewClient.cs create mode 100644 src/Core/src/Platform/Windows/MauiHybridWebView.cs create mode 100644 src/Core/src/Platform/iOS/MauiHybridWebView.cs diff --git a/src/Controls/samples/Controls.Sample/Pages/Controls/HybridWebViewPage.xaml b/src/Controls/samples/Controls.Sample/Pages/Controls/HybridWebViewPage.xaml new file mode 100644 index 000000000000..78779691808a --- /dev/null +++ b/src/Controls/samples/Controls.Sample/Pages/Controls/HybridWebViewPage.xaml @@ -0,0 +1,32 @@ + + + + + +