Skip to content
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

fix: add minimum API HttpRequestHeaderCollection to work #18546

Merged
merged 7 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/Uno.UI/UI/Xaml/Controls/WebView/Core/CoreWebView2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ internal void OnOwnerApplyTemplate()
{
_nativeWebView = GetNativeWebViewFromTemplate();

//The nativate WebView already navigate to a blank page if no source is set.
//The native WebView already navigate to a blank page if no source is set.
//Avoid a bug where invoke GoBack() on WebView do nothing in Android 4.4
UpdateFromInternalSource();
OnScrollEnabledChanged(_scrollEnabled);
Expand Down Expand Up @@ -280,8 +280,16 @@ private void UpdateFromInternalSource()
{
_nativeWebView.ProcessNavigation(html);
}
else if (_processedSource is HttpRequestMessage httpRequestMessage)
else if (_processedSource is global::Windows.Web.Http.HttpRequestMessage requestMessage)
{
var httpRequestMessage = new HttpRequestMessage()
{
RequestUri = requestMessage.RequestUri
};
foreach (var header in requestMessage.Headers)
{
httpRequestMessage.Headers.Add(header.Key, header.Value);
}
_nativeWebView.ProcessNavigation(httpRequestMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public bool TryAppendWithoutValidation(string name, string value)
// Forced skipping of method Windows.Web.Http.Headers.HttpRequestHeaderCollection.First()
// Skipping already declared method Windows.Web.Http.Headers.HttpRequestHeaderCollection.ToString()
// Processing: System.Collections.Generic.IDictionary<string, string>
#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
// DeclaringType: System.Collections.Generic.IDictionary<string, string>
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public void Add(string key, string value)
Expand Down Expand Up @@ -228,7 +228,7 @@ public void Add(string key, string value)
}
#endif
// Processing: System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string, string>>
#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
// DeclaringType: System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string, string>>
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public void Add(global::System.Collections.Generic.KeyValuePair<string, string> item)
Expand All @@ -255,7 +255,7 @@ public void CopyTo(global::System.Collections.Generic.KeyValuePair<string, strin
// Skipping already implement System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string, string>>.Count
// Skipping already implement System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string, string>>.IsReadOnly
// Processing: System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string>>
#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
// DeclaringType: System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string>>
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<string, string>> GetEnumerator()
Expand All @@ -264,7 +264,7 @@ public void CopyTo(global::System.Collections.Generic.KeyValuePair<string, strin
}
#endif
// Processing: System.Collections.IEnumerable
#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
// DeclaringType: System.Collections.IEnumerable
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
Expand Down
16 changes: 16 additions & 0 deletions src/Uno.UWP/Web/Http/HttpRequestHeaderCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ public DateTimeOffset? Date
}
}

public void Add(string key, string value)
=> _dictionary.Add(key, value);

public void Add(KeyValuePair<string, string> item)
=> Add(item.Key, item.Value);

public bool ContainsKey(string key)
=> _dictionary.ContainsKey(key);

Expand Down Expand Up @@ -214,4 +220,14 @@ public void Clear()
public int Count => _dictionary.Count;

public bool IsReadOnly => false;

public global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<string, string>> GetEnumerator()
{
return _dictionary.GetEnumerator();
}

global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
{
return _dictionary.GetEnumerator();
}
}
Loading