[Network] Fix binding mistake in NWConnection. (#21174)

The 'nw_connection_set_viability_changed_handler' P/Invoke was originally
bound as 'SetBooleanChangeHandler', which isn't quite right.

So now bind it as 'SetViabilityChangeHandler', obsolete the old version and
remove it in XAMCORE_5_0.
This commit is contained in:
Rolf Bjarne Kvinge 2024-09-04 23:14:07 +02:00 коммит произвёл GitHub
Родитель a854ebe1b8
Коммит b2a5fd4199
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -9,6 +9,7 @@
#nullable enable
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using ObjCRuntime;
using Foundation;
@ -157,8 +158,20 @@ namespace Network {
[DllImport (Constants.NetworkLibrary)]
static extern unsafe void nw_connection_set_viability_changed_handler (IntPtr handle, void* callback);
#if !XAMCORE_5_0
[Obsolete ("Use 'SetViabilityChangeHandler' instead.")]
[EditorBrowsable (EditorBrowsableState.Never)]
[BindingImpl (BindingImplOptions.Optimizable)]
public unsafe void SetBooleanChangeHandler (Action<bool> callback)
{
SetViabilityChangeHandler (callback);
}
#endif // !XAMCORE_5_0
/// <summary>Set a handler that is called when data can be sent or received.</summary>
/// <param name="callback">The callback to call when data can be sent or received.</param>
[BindingImpl (BindingImplOptions.Optimizable)]
public unsafe void SetViabilityChangeHandler (Action<bool> callback)
{
if (callback is null) {
nw_connection_set_viability_changed_handler (GetCheckedHandle (), null);

Просмотреть файл

@ -42193,7 +42193,6 @@ M:Network.NWConnection.Send(System.Byte[],System.Int32,System.Int32,Network.NWCo
M:Network.NWConnection.SendIdempotent(CoreFoundation.DispatchData,Network.NWContentContext,System.Boolean)
M:Network.NWConnection.SendIdempotent(System.Byte[],Network.NWContentContext,System.Boolean)
M:Network.NWConnection.SetBetterPathAvailableHandler(System.Action{System.Boolean})
M:Network.NWConnection.SetBooleanChangeHandler(System.Action{System.Boolean})
M:Network.NWConnection.SetPathChangedHandler(System.Action{Network.NWPath})
M:Network.NWConnection.SetQueue(CoreFoundation.DispatchQueue)
M:Network.NWConnection.SetStateChangeHandler(System.Action{Network.NWConnectionState,Network.NWError})