-
Notifications
You must be signed in to change notification settings - Fork 511
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GameKit] Implement Xcode 16.0 beta 1-6 changes. (#20880)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
- Loading branch information
1 parent
6302fe7
commit 19b925e
Showing
22 changed files
with
188 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#if !WATCH | ||
using System; | ||
|
||
using Foundation; | ||
using ObjCRuntime; | ||
|
||
namespace GameKit { | ||
/// <summary>This enum is used to select how to initialize a new instance of a <see cref="GKGameCenterViewController" />.</summary> | ||
public enum GKGameCenterViewControllerInitializationOption { | ||
/// <summary>The <c>id</c> parameter passed to the constructor is an achievement ID.</summary> | ||
Achievement, | ||
/// <summary>The <c>id</c> parameter passed to the constructor is a leaderboard set ID.</summary> | ||
LeaderboardSet, | ||
} | ||
|
||
public partial class GKGameCenterViewController { | ||
/// <summary>Create a new GKGameCenterViewController instance that presents an achievement.</summary> | ||
/// <param name="achievementId">The ID of the achievement to show.</param> | ||
#if NET | ||
[SupportedOSPlatform ("ios14.0")] | ||
[SupportedOSPlatform ("maccatalyst14.0")] | ||
[SupportedOSPlatform ("macos11.0")] | ||
[SupportedOSPlatform ("tvos14.0")] | ||
#else | ||
[TV (14, 0), Mac (11, 0), iOS (14, 0), MacCatalyst (14, 0)] | ||
#endif | ||
public GKGameCenterViewController (string achievementId) | ||
: this (achievementId, GKGameCenterViewControllerInitializationOption.Achievement) | ||
{ | ||
} | ||
|
||
/// <summary>Create a new GKGameCenterViewController instance that presents an achievement or a leaderboard set.</summary> | ||
/// <param name="id">The ID of the achievement or the leaderboard set to show.</param> | ||
/// <param name="option">Use this option to specify whether the GKGameCenterViewController shows an achievement or a leader board set.</param> | ||
#if NET | ||
[SupportedOSPlatform ("ios18.0")] | ||
[SupportedOSPlatform ("maccatalyst18.0")] | ||
[SupportedOSPlatform ("macos15.0")] | ||
[SupportedOSPlatform ("tvos18.0")] | ||
#else | ||
[TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)] | ||
#endif | ||
public GKGameCenterViewController (string id, GKGameCenterViewControllerInitializationOption option) | ||
: base (NSObjectFlag.Empty) | ||
{ | ||
switch (option) { | ||
case GKGameCenterViewControllerInitializationOption.Achievement: | ||
InitializeHandle (_InitWithAchievementId (id)); | ||
break; | ||
case GKGameCenterViewControllerInitializationOption.LeaderboardSet: | ||
InitializeHandle (_InitWithLeaderboardSetId (id)); | ||
break; | ||
default: | ||
throw new ArgumentOutOfRangeException (nameof (option), option, "Invalid enum value."); | ||
} | ||
} | ||
} | ||
} | ||
#endif // !WATCH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
tests/monotouch-test/GameKit/GKGameCenterViewControllerTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// Unit tests for GKGameCenterViewControllerTest | ||
// | ||
|
||
#if !__WATCHOS__ | ||
|
||
using System; | ||
using Foundation; | ||
using ObjCRuntime; | ||
#if MONOMAC | ||
using AppKit; | ||
#else | ||
using UIKit; | ||
#endif | ||
using GameKit; | ||
using NUnit.Framework; | ||
using Xamarin.Utils; | ||
|
||
namespace MonoTouchFixtures.GameKit { | ||
|
||
[TestFixture] | ||
[Preserve (AllMembers = true)] | ||
public class GKGameCenterViewControllerTest { | ||
[Test] | ||
public void StringCtor () | ||
{ | ||
TestRuntime.AssertXcodeVersion (12, 0); | ||
using var controller = new GKGameCenterViewController ("achievementId"); | ||
Assert.AreEqual (controller.ViewState, GKGameCenterViewControllerState.Achievements, "ViewState"); | ||
} | ||
|
||
[Test] | ||
public void StringOptionCtor_AchievementId () | ||
{ | ||
TestRuntime.AssertXcodeVersion (12, 0); | ||
using var controller = new GKGameCenterViewController ("achievementId", GKGameCenterViewControllerInitializationOption.Achievement); | ||
Assert.AreEqual (controller.ViewState, GKGameCenterViewControllerState.Achievements, "ViewState"); | ||
} | ||
|
||
[Test] | ||
public void StringOptionCtor_LeaderboardSetId () | ||
{ | ||
TestRuntime.AssertXcodeVersion (16, 0); | ||
using var controller = new GKGameCenterViewController ("achievementId", GKGameCenterViewControllerInitializationOption.LeaderboardSet); | ||
Assert.AreEqual (controller.ViewState, GKGameCenterViewControllerState.Leaderboards, "ViewState"); | ||
} | ||
} | ||
} | ||
|
||
#endif // !__WATCHOS__ |
7 changes: 0 additions & 7 deletions
7
tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-GameKit.ignore
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-GameKit.todo
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
tests/xtro-sharpie/api-annotations-dotnet/macOS-GameKit.ignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,7 @@ | ||
# The parent enum GKVoiceChatService is not available in macOS | ||
# so to be honest it does not make much sense to expose this constant on macOS | ||
# nor the below protocols | ||
|
||
# This selector does not exist in macOS, confirmed by intro. | ||
|
||
# Deprecated | ||
!missing-protocol-member! GKInviteEventListener::player:didRequestMatchWithPlayers: not found | ||
!missing-protocol-member! GKTurnBasedEventListener::player:didRequestMatchWithPlayers: not found | ||
|
||
# We have bound GKVoiceChatServiceError as GKVoiceChatServiceError which has no support for macOS | ||
!missing-field! GKVoiceChatServiceErrorDomain not bound | ||
# https://developer.apple.com/documentation/gamekit/gkvoicechatserviceerror?language=objc | ||
|
||
# This selector does not exist (respond?) in macOS either | ||
!missing-selector! GKLeaderboardSet::loadImageWithCompletionHandler: not bound | ||
|
||
# NullAllowed makes sense | ||
!extra-null-allowed! 'System.Void GameKit.GKMatchmaker::FindMatchedPlayers(GameKit.GKMatchRequest,System.Action`2<GameKit.GKMatchedPlayers,Foundation.NSError>)' has a extraneous [NullAllowed] on parameter #1 |
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
tests/xtro-sharpie/api-annotations-dotnet/tvOS-GameKit.ignore
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.