Skip to content

Commit

Permalink
fix!: Align WebView.NavigateWithHttpRequestMessage signature with UWP
Browse files Browse the repository at this point in the history
BREAKING CHANGE: WebView.NavigateWithHttpRequestMessage parameter type is now `Windows.Web.Http.HttpRequestMessage` instead of `System.Net.Http.HttpRequestMessage`
  • Loading branch information
Youssef1313 authored and jeromelaban committed Apr 25, 2023
1 parent 607c6c9 commit 00ea4b6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
10 changes: 2 additions & 8 deletions src/Uno.UI/Generated/3.0.0.0/Windows.UI.Xaml.Controls/WebView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 00ea4b6

Please sign in to comment.