From 00ea4b60c036a7061a65bbae3b63e866a677a202 Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Thu, 16 Feb 2023 10:14:30 +0200 Subject: [PATCH] fix!: Align WebView.NavigateWithHttpRequestMessage signature with UWP BREAKING CHANGE: WebView.NavigateWithHttpRequestMessage parameter type is now `Windows.Web.Http.HttpRequestMessage` instead of `System.Net.Http.HttpRequestMessage` --- .../WebView/WebView_WithHeaders.xaml.cs | 8 ++----- .../Windows_UI_Xaml_Controls/Given_WebView.cs | 22 +++++++++---------- .../Windows.UI.Xaml.Controls/WebView.cs | 10 ++------- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/WebView/WebView_WithHeaders.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/WebView/WebView_WithHeaders.xaml.cs index 67b399acc73e..85b6bc5d8faf 100644 --- a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/WebView/WebView_WithHeaders.xaml.cs +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/WebView/WebView_WithHeaders.xaml.cs @@ -3,7 +3,7 @@ using Windows.UI.Xaml; using SamplesApp.Windows_UI_Xaml_Controls.WebView; using Windows.UI.Xaml.Controls; -using System.Net.Http; +using Windows.Web.Http; namespace Uno.UI.Samples.Content.UITests.WebView { @@ -21,11 +21,7 @@ private void MyButton_OnClick(object sender, RoutedEventArgs e) { var url = "http://requestb.in/rw35narw"; MyTextBlock.Text = $"Inspect data at {url}?inspect"; - var request = new HttpRequestMessage - { - RequestUri = new Uri(url), - Method = HttpMethod.Get - }; + var request = new HttpRequestMessage(HttpMethod.Get, new Uri(url)); request.Headers.Add("HELLO", "TESTTEST, TEST2"); request.Headers.Add("HELLO2", "TEST111"); MyWebView2.NavigateWithHttpRequestMessage(request); diff --git a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_WebView.cs b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_WebView.cs index f95defd2bd8c..3d8e155398f0 100644 --- a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_WebView.cs +++ b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_WebView.cs @@ -22,19 +22,19 @@ public void When_Navigate() } #if __ANDROID__ || __IOS__ || __MACOS__ - [TestMethod] - public void When_NavigateWithHttpRequestMessage() - { - var webView = new WebView(); - var uri = new Uri("https://bing.com"); - webView.NavigateWithHttpRequestMessage(new System.Net.Http.HttpRequestMessage(System.Net.Http.HttpMethod.Get, uri)); - Assert.IsNotNull(webView.Source); - Assert.AreEqual("https://bing.com/", webView.Source.OriginalString); - Assert.AreEqual("https://bing.com", uri.OriginalString); - } + [TestMethod] + public void When_NavigateWithHttpRequestMessage() + { + var webView = new WebView(); + var uri = new Uri("https://bing.com"); + webView.NavigateWithHttpRequestMessage(new Windows.Web.Http.HttpRequestMessage(Windows.Web.Http.HttpMethod.Get, uri)); + Assert.IsNotNull(webView.Source); + Assert.AreEqual("https://bing.com/", webView.Source.OriginalString); + Assert.AreEqual("https://bing.com", uri.OriginalString); + } #endif - [TestMethod] + [TestMethod] public void When_NavigateToString() { var webView = new WebView(); diff --git a/src/Uno.UI/Generated/3.0.0.0/Windows.UI.Xaml.Controls/WebView.cs b/src/Uno.UI/Generated/3.0.0.0/Windows.UI.Xaml.Controls/WebView.cs index f6778f0331d8..fe5f362ee641 100644 --- a/src/Uno.UI/Generated/3.0.0.0/Windows.UI.Xaml.Controls/WebView.cs +++ b/src/Uno.UI/Generated/3.0.0.0/Windows.UI.Xaml.Controls/WebView.cs @@ -224,7 +224,7 @@ public void NavigateToLocalStreamUri( global::System.Uri source, global::Windo { throw new global::System.NotImplementedException("The member Uri WebView.BuildLocalStreamUri(string contentIdentifier, string relativePath) is not implemented. For more information, visit https://aka.platform.uno/notimplemented?m=Uri%20WebView.BuildLocalStreamUri%28string%20contentIdentifier%2C%20string%20relativePath%29"); } - #endif +#endif // Forced skipping of method Windows.UI.Xaml.Controls.WebView.DefaultBackgroundColor.get // Forced skipping of method Windows.UI.Xaml.Controls.WebView.DefaultBackgroundColor.set // Forced skipping of method Windows.UI.Xaml.Controls.WebView.NavigationCompleted.add @@ -243,13 +243,7 @@ public void NavigateToLocalStreamUri( global::System.Uri source, global::Windo // Forced skipping of method Windows.UI.Xaml.Controls.WebView.UnsafeContentWarningDisplaying.remove // Forced skipping of method Windows.UI.Xaml.Controls.WebView.UnviewableContentIdentified.add // Forced skipping of method Windows.UI.Xaml.Controls.WebView.UnviewableContentIdentified.remove - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ - [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] - public void NavigateWithHttpRequestMessage( global::Windows.Web.Http.HttpRequestMessage requestMessage) - { - global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.Xaml.Controls.WebView", "void WebView.NavigateWithHttpRequestMessage(HttpRequestMessage requestMessage)"); - } - #endif + // Skipping already declared method Windows.UI.Xaml.Controls.WebView.NavigateWithHttpRequestMessage(Windows.Web.Http.HttpRequestMessage) // Skipping already declared method Windows.UI.Xaml.Controls.WebView.Focus(Windows.UI.Xaml.FocusState) // Forced skipping of method Windows.UI.Xaml.Controls.WebView.ContainsFullScreenElement.get // Forced skipping of method Windows.UI.Xaml.Controls.WebView.ContainsFullScreenElementChanged.add