MicroSugarDeveloperOrg / Avalonia.WebView

MIT License
216 stars 39 forks source link

Fix `NavigationStarting` & `NavigationCompleted` event for Avalonia.WebView.Android #46

Open LazuliKao opened 9 months ago

LazuliKao commented 9 months ago
  1. Fixed NavigationStarting and NavigationCompleted events on the Avalonia.WebView.Android (non-Blazor mode).
  2. Implemented IWebViewControl.ExecuteScriptAsync for the Avalonia.WebView.Android.

  1. 修复安卓端(非Blazor模式)无法触发NavigationStartingNavigationCompleted事件的bug
    • Clients\AvaloniaWebViewClient.cs移到Clients\Blazor\AvaloniaBlazorWebViewClient.cs,实现AvaloniaWebViewClient用于非Blazor模式的WebViewClient,相应对应事件
  2. 实现安卓端的 IWebViewControl.ExecuteScriptAsyncTaskCompletionSource转成普通异步。
      var cts = new TaskCompletionSource<string?>();
        _webView.EvaluateJavascript(
            javaScript,
            new JavaScriptValueCallback(result => cts.TrySetResult(result?.ToString()))
        );
        return cts.Task;