Update to native Electron 11.1.1 - Fix breaking changes and refactoring.

This commit is contained in:
Gregor Biswanger
2021-01-11 01:56:39 +01:00
parent b9feff3436
commit f06b95803f
45 changed files with 2083 additions and 718 deletions

View File

@@ -2,9 +2,6 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace ElectronNET.API
@@ -29,30 +26,6 @@ namespace ElectronNET.API
/// </summary>
public WebContents WebContents { get; internal set; }
/// <summary>
/// Whether the view is destroyed.
/// </summary>
public Task<bool> IsDestroyedAsync
{
get
{
return Task.Run<bool>(() =>
{
var taskCompletionSource = new TaskCompletionSource<bool>();
BridgeConnector.Socket.On("browserView-isDestroyed-reply", (result) =>
{
BridgeConnector.Socket.Off("browserView-isDestroyed-reply");
taskCompletionSource.SetResult((bool)result);
});
BridgeConnector.Socket.Emit("browserView-isDestroyed", Id);
return taskCompletionSource.Task;
});
}
}
/// <summary>
/// Resizes and moves the view to the supplied bounds relative to the window.
///
@@ -83,8 +56,6 @@ namespace ElectronNET.API
}
}
internal Action<BrowserView> Destroyed;
/// <summary>
/// BrowserView
/// </summary>
@@ -97,18 +68,6 @@ namespace ElectronNET.API
WebContents = new WebContents(id + 1000);
}
/// <summary>
/// Force closing the view, the `unload` and `beforeunload` events won't be emitted
/// for the web page.After you're done with a view, call this function in order to
/// free memory and other resources as soon as possible.
/// </summary>
public void Destroy()
{
BridgeConnector.Socket.Emit("browserView-destroy", Id);
Destroyed?.Invoke(this);
}
/// <summary>
/// (experimental)
/// </summary>

View File

@@ -1,31 +0,0 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class RemoveClientCertificate
{
/// <summary>
/// Origin of the server whose associated client certificate must be removed from
/// the cache.
/// </summary>
public string Origin { get; set; }
/// <summary>
/// clientCertificate.
/// </summary>
public string Type { get; set; }
/// <summary>
///
/// </summary>
/// <param name="origin">Origin of the server whose associated client certificate
/// must be removed from the cache.</param>
/// <param name="type">clientCertificate.</param>
public RemoveClientCertificate(string origin, string type)
{
Origin = origin;
Type = type;
}
}
}

View File

@@ -64,8 +64,7 @@ namespace ElectronNET.API
/// <summary>
/// Clears the sessions HTTP authentication cache.
/// </summary>
/// <param name="options"></param>
public Task ClearAuthCacheAsync(RemoveClientCertificate options)
public Task ClearAuthCacheAsync()
{
var taskCompletionSource = new TaskCompletionSource<object>();
string guid = Guid.NewGuid().ToString();
@@ -76,7 +75,7 @@ namespace ElectronNET.API
taskCompletionSource.SetResult(null);
});
BridgeConnector.Socket.Emit("webContents-session-clearAuthCache", Id, JObject.FromObject(options, _jsonSerializer), guid);
BridgeConnector.Socket.Emit("webContents-session-clearAuthCache", Id, guid);
return taskCompletionSource.Task;
}

View File

@@ -192,7 +192,6 @@ namespace ElectronNET.API
string browserViewId = id.ToString();
BrowserView browserView = new BrowserView(int.Parse(browserViewId));
browserView.Destroyed += (b) => _browserViews.Remove(b);
_browserViews.Add(browserView);