[GameKit] Apple removed the GKPeerPickerController[Delegate] types, so move them to compat code.

This commit is contained in:
Rolf Bjarne Kvinge 2022-06-22 23:00:21 +02:00
Родитель 62fa204225
Коммит 8df5f77eba
3 изменённых файлов: 187 добавлений и 49 удалений

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

@ -6,6 +6,10 @@ using ObjCRuntime;
#nullable enable #nullable enable
#if !NET
using NativeHandle = System.IntPtr;
#endif
namespace GameKit { namespace GameKit {
#if !XAMCORE_3_0 #if !XAMCORE_3_0
@ -64,4 +68,186 @@ namespace GameKit {
public static void DidSaveData (GKGameSession session, GKCloudPlayer player, Foundation.NSData data) {} public static void DidSaveData (GKGameSession session, GKCloudPlayer player, Foundation.NSData data) {}
} }
#endif #endif
#if !XAMCORE_5_0
#if __IOS__ || __MACCATALYST__
[Obsolete ("Use 'MCBrowserViewController' from the 'MultipeerConnectivity' framework instead.")]
#if NET
[UnsupportedOSPlatform ("macos")]
[UnsupportedOSPlatform ("tvos")]
[UnsupportedOSPlatform ("ios")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Unavailable (PlatformName.MacOSX)]
[Unavailable (PlatformName.WatchOS)]
[Unavailable (PlatformName.TvOS)]
[Unavailable (PlatformName.WatchOS)]
#endif
public interface IGKPeerPickerControllerDelegate : INativeObject, IDisposable
{
}
[Obsolete ("Use 'MCBrowserViewController' from the 'MultipeerConnectivity' framework instead.")]
#if NET
[UnsupportedOSPlatform ("macos")]
[UnsupportedOSPlatform ("tvos")]
[UnsupportedOSPlatform ("ios")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Unavailable (PlatformName.MacOSX)]
[Unavailable (PlatformName.WatchOS)]
[Unavailable (PlatformName.TvOS)]
[Unavailable (PlatformName.WatchOS)]
#endif
public static class GKPeerPickerControllerDelegate_Extensions {
public static void ConnectionTypeSelected (this IGKPeerPickerControllerDelegate This, GKPeerPickerController picker, GKPeerPickerConnectionType type)
{
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
public static GKSession GetSession (this IGKPeerPickerControllerDelegate This, GKPeerPickerController picker, GKPeerPickerConnectionType forType)
{
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
public static void PeerConnected (this IGKPeerPickerControllerDelegate This, GKPeerPickerController picker, string peerId, GKSession toSession)
{
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
public static void ControllerCancelled (this IGKPeerPickerControllerDelegate This, GKPeerPickerController picker)
{
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
}
[Obsolete ("Use 'MCBrowserViewController' from the 'MultipeerConnectivity' framework instead.")]
#if NET
[UnsupportedOSPlatform ("macos")]
[UnsupportedOSPlatform ("tvos")]
[UnsupportedOSPlatform ("ios")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Unavailable (PlatformName.MacOSX)]
[Unavailable (PlatformName.WatchOS)]
[Unavailable (PlatformName.TvOS)]
[Unavailable (PlatformName.WatchOS)]
#endif
public unsafe class GKPeerPickerControllerDelegate : NSObject, IGKPeerPickerControllerDelegate {
public GKPeerPickerControllerDelegate () : base (NSObjectFlag.Empty)
{
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
protected GKPeerPickerControllerDelegate (NSObjectFlag t) : base (t)
{
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
protected internal GKPeerPickerControllerDelegate (NativeHandle handle) : base (handle)
{
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
public virtual void ConnectionTypeSelected (GKPeerPickerController picker, GKPeerPickerConnectionType type)
{
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
public virtual void ControllerCancelled (GKPeerPickerController picker)
{
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
public virtual GKSession GetSession (GKPeerPickerController picker, GKPeerPickerConnectionType forType)
{
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
public virtual void PeerConnected (GKPeerPickerController picker, string peerId, GKSession toSession)
{
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
} /* class GKPeerPickerControllerDelegate */
[Obsolete ("Use 'MCBrowserViewController' from the 'MultipeerConnectivity' framework instead.")]
#if NET
[UnsupportedOSPlatform ("macos")]
[UnsupportedOSPlatform ("tvos")]
[UnsupportedOSPlatform ("ios")]
[UnsupportedOSPlatform ("maccatalyst")]
#else
[Unavailable (PlatformName.MacOSX)]
[Unavailable (PlatformName.WatchOS)]
[Unavailable (PlatformName.TvOS)]
[Unavailable (PlatformName.WatchOS)]
#endif
public class GKPeerPickerController : NSObject {
public override NativeHandle ClassHandle { get { throw new PlatformNotSupportedException (Constants.TypeUnavailable); } }
public GKPeerPickerController () : base (NSObjectFlag.Empty)
{
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
protected GKPeerPickerController (NSObjectFlag t) : base (t)
{
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
protected internal GKPeerPickerController (NativeHandle handle) : base (handle)
{
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
public virtual void Dismiss ()
{
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
public virtual void Show ()
{
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
public virtual GKPeerPickerConnectionType ConnectionTypesMask {
get {
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
set {
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
}
public IGKPeerPickerControllerDelegate Delegate {
get {
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
set {
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
}
public virtual bool Visible {
get {
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
}
public virtual NSObject? WeakDelegate {
get {
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
set {
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
}
protected override void Dispose (bool disposing)
{
throw new PlatformNotSupportedException (Constants.TypeUnavailable);
}
} /* class GKPeerPickerController */
#endif // __IOS__ || __MACCATALYST__
#endif // !XAMCORE_5_0
} }

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

@ -27,5 +27,6 @@ namespace ObjCRuntime {
internal const string RemovedFromChip = "This API has been removed from the 'CHIP' framework."; internal const string RemovedFromChip = "This API has been removed from the 'CHIP' framework.";
internal const string TypeUnavailable = "This type has been removed from the current platform.";
} }
} }

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

@ -70,55 +70,6 @@ namespace GameKit {
interface UINavigationController {} interface UINavigationController {}
interface UIWindow {} interface UIWindow {}
#endif #endif
[NoMac]
[NoWatch]
[NoTV]
[MacCatalyst (14,0)]
[BaseType (typeof (NSObject))]
[Model]
[Protocol]
interface GKPeerPickerControllerDelegate {
[Export ("peerPickerController:didSelectConnectionType:")]
void ConnectionTypeSelected (GKPeerPickerController picker, GKPeerPickerConnectionType type);
[Export ("peerPickerController:sessionForConnectionType:")]
GKSession GetSession (GKPeerPickerController picker, GKPeerPickerConnectionType forType);
[Export ("peerPickerController:didConnectPeer:toSession:")]
void PeerConnected (GKPeerPickerController picker, string peerId, GKSession toSession);
[Export ("peerPickerControllerDidCancel:")]
void ControllerCancelled (GKPeerPickerController picker);
}
[NoMac]
[NoWatch]
[NoTV]
[MacCatalyst (14,0)]
[BaseType (typeof (NSObject))]
[Deprecated (PlatformName.iOS, 7, 0, message: "Use 'MCBrowserViewController' from the 'MultipeerConnectivity' framework instead.")]
interface GKPeerPickerController {
[Export ("connectionTypesMask", ArgumentSemantic.Assign)]
GKPeerPickerConnectionType ConnectionTypesMask { get; set; }
[Export ("delegate", ArgumentSemantic.Assign)][NullAllowed]
NSObject WeakDelegate { get; set; }
[Wrap ("WeakDelegate")]
[Protocolize]
GKPeerPickerControllerDelegate Delegate { get; set; }
[Export ("show")]
void Show ();
[Export ("dismiss")]
void Dismiss ();
[Export ("visible")]
bool Visible { [Bind ("isVisible")] get; }
}
[NoMac] [NoMac]
[NoWatch] // only exposed thru GKVoiceChatService (not in 3.0) [NoWatch] // only exposed thru GKVoiceChatService (not in 3.0)