Skip to content

Commit

Permalink
feat(iOS): Add support for InvokeScriptAsync on WebView
Browse files Browse the repository at this point in the history
  • Loading branch information
ajpinedam committed Sep 3, 2020
1 parent bbe26b3 commit 8c8fdb8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public void Stop()
throw new global::System.NotImplementedException("The member IAsyncAction WebView.CapturePreviewToStreamAsync(IRandomAccessStream stream) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if __ANDROID__ || false || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<string> InvokeScriptAsync( string scriptName, global::System.Collections.Generic.IEnumerable<string> arguments)
{
Expand Down
4 changes: 4 additions & 0 deletions src/Uno.UI/UI/Xaml/Controls/WebView/WebView.iOSmacOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using System.Threading;
using Windows.UI.Core;
using Uno.Logging;
using Windows.Foundation;

#if XAMARIN_IOS_UNIFIED
using MessageUI;
Expand Down Expand Up @@ -72,6 +73,9 @@ public async Task<string> InvokeScriptAsync(CancellationToken ct, string script,
return await _nativeWebView.EvaluateJavascriptAsync(ct, string.Format(CultureInfo.InvariantCulture, "javascript:{0}(\"{1}\")", script, argumentString));
}

public IAsyncOperation<string> InvokeScriptAsync(string scriptName, IEnumerable<string> arguments) =>
InvokeScriptAsync(CancellationToken.None, scriptName, arguments).AsAsyncOperation();

partial void NavigateWithHttpRequestMessagePartial(HttpRequestMessage requestMessage)
{
if (requestMessage == null)
Expand Down

0 comments on commit 8c8fdb8

Please sign in to comment.