diff --git a/plug-ins/Apple.Accessibility/Apple.Accessibility_Unity/Assets/Apple.Accessibility/Editor/AppleAccessibilityBuildStep.cs b/plug-ins/Apple.Accessibility/Apple.Accessibility_Unity/Assets/Apple.Accessibility/Editor/AppleAccessibilityBuildStep.cs index 18dedc01..31a6580e 100644 --- a/plug-ins/Apple.Accessibility/Apple.Accessibility_Unity/Assets/Apple.Accessibility/Editor/AppleAccessibilityBuildStep.cs +++ b/plug-ins/Apple.Accessibility/Apple.Accessibility_Unity/Assets/Apple.Accessibility/Editor/AppleAccessibilityBuildStep.cs @@ -4,7 +4,7 @@ using UnityEditor; using UnityEngine; -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) using UnityEditor.iOS.Xcode; #endif @@ -20,7 +20,7 @@ public class AppleAccessibilityBuildStep : AppleBuildStep {BuildTarget.tvOS, "AppleAccessibility.framework"}, }; -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) public override void OnProcessFrameworks(AppleBuildProfile _, BuildTarget buildTarget, string pathToBuiltTarget, PBXProject pbxProject) { if (_libraryTable.ContainsKey(buildTarget)) diff --git a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleBuild.cs b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleBuild.cs index 25c18f0e..e649a678 100644 --- a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleBuild.cs +++ b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleBuild.cs @@ -1,3 +1,4 @@ +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) using System.IO; using System.Text.RegularExpressions; using UnityEditor; @@ -422,3 +423,4 @@ public static void ProcessExportPlistOptions(AppleBuildProfile appleBuildProfile } } +#endif diff --git a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleBuildStep.cs b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleBuildStep.cs index d8ec8d1e..63fac631 100644 --- a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleBuildStep.cs +++ b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleBuildStep.cs @@ -5,7 +5,7 @@ using UnityEditor; using UnityEngine; -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) using UnityEditor.iOS.Xcode; #endif @@ -20,6 +20,7 @@ public class AppleBuildStep : ScriptableObject /// <summary> /// Returns an enumerable collection of all objects in the project which derive from AppleBuildStep /// </summary> + public static IEnumerable<Type> ProjectAppleBuildStepTypes() { var appleBuildStepTypes = from assembly in AppDomain.CurrentDomain.GetAssemblies() @@ -38,6 +39,8 @@ where typeof(AppleBuildStep).IsAssignableFrom(type) && type != typeof(AppleBuild /// <param name="pathToBuiltProject"></param> public virtual void OnBeginPostProcess(AppleBuildProfile appleBuildProfile, BuildTarget buildTarget, string pathToBuiltProject) { } +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) + /// <summary> /// Called when steps should modify the info plist. /// </summary> @@ -72,7 +75,7 @@ public virtual void OnProcessFrameworks(AppleBuildProfile appleBuildProfile, Bui /// <param name="buildTarget"></param> /// <param name="exportPlistOptions"></param> public virtual void OnProcessExportPlistOptions(AppleBuildProfile appleBuildProfile, BuildTarget buildTarget, string pathToBuiltProject, PlistDocument exportPlistOptions) { } - +#endif /// <summary> /// Called on all steps, in-order, as a final post process command. Any final signatures can be done here (if last step). /// </summary> diff --git a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleCoreBuildStep.cs b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleCoreBuildStep.cs index 45d488a9..82822a46 100644 --- a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleCoreBuildStep.cs +++ b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleCoreBuildStep.cs @@ -3,7 +3,7 @@ using UnityEngine; using UnityEditor; -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) using UnityEditor.iOS.Xcode; #endif @@ -20,7 +20,7 @@ public class AppleCoreBuildStep : AppleBuildStep {BuildTarget.StandaloneOSX, "AppleCoreNativeMac.bundle"} }; -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) public override void OnFinalizePostProcess(AppleBuildProfile appleBuildProfile, BuildTarget buildTarget, string pathToBuiltProject) { Debug.Log($"AppleBuild: disabling Bitcode for framework and app targets."); diff --git a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleFrameworkUtility.cs b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleFrameworkUtility.cs index a4020cda..aa044fed 100644 --- a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleFrameworkUtility.cs +++ b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleFrameworkUtility.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) using System; using System.IO; using UnityEditor; @@ -43,6 +43,21 @@ public static string GetPluginLibraryPathForBuildTarget(string libraryName, Buil } } + if( libraryName.EndsWith(".framework") ) + { + string libraryNameWithoutFramework = libraryName.Substring( 0, libraryName.LastIndexOf(".framework") ); + results = AssetDatabase.FindAssets(libraryNameWithoutFramework); + foreach (string currGUID in results) + { + string libraryPath = AssetDatabase.GUIDToAssetPath(currGUID); + string[] folders = libraryPath.Split('/'); + if (Array.IndexOf(folders, platformString) > -1) + { + return libraryPath; + } + } + + } return string.Empty; } diff --git a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleNativePluginProcessor.cs b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleNativePluginProcessor.cs index 2094f91b..cc55399f 100644 --- a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleNativePluginProcessor.cs +++ b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleNativePluginProcessor.cs @@ -1,3 +1,4 @@ +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) using System; using System.IO; using System.Collections; @@ -174,3 +175,4 @@ static void OnPostprocessAllAssets(string[] assetPaths, string[] _, string[] _1, } } } +#endif \ No newline at end of file diff --git a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleSecurityBuildStep.cs b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleSecurityBuildStep.cs index 449bce74..cc84acff 100644 --- a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleSecurityBuildStep.cs +++ b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleSecurityBuildStep.cs @@ -1,3 +1,4 @@ +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) using UnityEditor; using UnityEditor.iOS.Xcode; using UnityEngine; @@ -129,4 +130,5 @@ public override void OnProcessEntitlements(AppleBuildProfile appleBuildProfile, entitlements.root.SetBoolean("com.apple.security.assets.movies.read-write", true); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleUserManagementBuildStep.cs b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleUserManagementBuildStep.cs index 984290ce..ba013a79 100644 --- a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleUserManagementBuildStep.cs +++ b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/AppleUserManagementBuildStep.cs @@ -18,7 +18,7 @@ public void Reset() IsEnabled = false; } -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) public override void OnProcessEntitlements(AppleBuildProfile appleBuildProfile, BuildTarget buildTarget, string pathToBuiltTarget, PlistDocument entitlements) { if (buildTarget == BuildTarget.tvOS) diff --git a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/CodsignCommand.cs b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/CodsignCommand.cs index b68c2530..7f14a4f4 100644 --- a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/CodsignCommand.cs +++ b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/CodsignCommand.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) using System.Collections.Generic; using System.IO; diff --git a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/KeychainCommand.cs b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/KeychainCommand.cs index 89a781d8..c1c71742 100644 --- a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/KeychainCommand.cs +++ b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/KeychainCommand.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) using System.IO; diff --git a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/ProductBuildCommand.cs b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/ProductBuildCommand.cs index 609fda84..097d6666 100644 --- a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/ProductBuildCommand.cs +++ b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/ProductBuildCommand.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) using System.Collections.Generic; using System.IO; diff --git a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/ProductSignCommand.cs b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/ProductSignCommand.cs index 7be5d294..f0a62116 100644 --- a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/ProductSignCommand.cs +++ b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/ProductSignCommand.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) namespace Apple.Core { diff --git a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/ShellCommandRunner.cs b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/ShellCommandRunner.cs index f47712a7..80a07b1e 100644 --- a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/ShellCommandRunner.cs +++ b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/ShellCommandRunner.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) using System; using UnityEngine; diff --git a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/XcodeBuildCommand.cs b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/XcodeBuildCommand.cs index bf4f8880..160bd9cb 100644 --- a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/XcodeBuildCommand.cs +++ b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/XcodeBuildCommand.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) using System.Collections.Generic; using System.IO; diff --git a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/XcrunCommand.cs b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/XcrunCommand.cs index f749f5b9..2916ec11 100644 --- a/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/XcrunCommand.cs +++ b/plug-ins/Apple.Core/Apple.Core_Unity/Assets/Apple.Core/Editor/XcrunCommand.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) using System.Collections.Generic; using System.IO; diff --git a/plug-ins/Apple.CoreHaptics/Apple.CoreHaptics_Unity/Assets/Apple.CoreHaptics/Editor/CHBuildStep.cs b/plug-ins/Apple.CoreHaptics/Apple.CoreHaptics_Unity/Assets/Apple.CoreHaptics/Editor/CHBuildStep.cs index 4e1d89c1..1bd1ecb2 100644 --- a/plug-ins/Apple.CoreHaptics/Apple.CoreHaptics_Unity/Assets/Apple.CoreHaptics/Editor/CHBuildStep.cs +++ b/plug-ins/Apple.CoreHaptics/Apple.CoreHaptics_Unity/Assets/Apple.CoreHaptics/Editor/CHBuildStep.cs @@ -4,7 +4,7 @@ using UnityEditor; using UnityEngine; -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) using UnityEditor.iOS.Xcode; #endif @@ -21,7 +21,7 @@ public class CHBuildStep : AppleBuildStep {BuildTarget.StandaloneOSX, "CoreHapticsWrapper.bundle"} }; -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) public override void OnProcessFrameworks(AppleBuildProfile _, BuildTarget buildTarget, string pathToBuiltTarget, PBXProject pbxProject) { if (_libraryTable.ContainsKey(buildTarget)) diff --git a/plug-ins/Apple.GameController/Apple.GameController_Unity/Assets/Apple.GameController/Editor/AppleGameControllerBuildStep.cs b/plug-ins/Apple.GameController/Apple.GameController_Unity/Assets/Apple.GameController/Editor/AppleGameControllerBuildStep.cs index 6fb77d12..00c32816 100644 --- a/plug-ins/Apple.GameController/Apple.GameController_Unity/Assets/Apple.GameController/Editor/AppleGameControllerBuildStep.cs +++ b/plug-ins/Apple.GameController/Apple.GameController_Unity/Assets/Apple.GameController/Editor/AppleGameControllerBuildStep.cs @@ -4,7 +4,7 @@ using UnityEditor; using UnityEngine; -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) using UnityEditor.iOS.Xcode; #endif @@ -25,7 +25,7 @@ public class AppleGameControllerBuildStep : AppleBuildStep public bool SupportsMicroGamePad = true; public bool SupportsExtendedGamePad = true; -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) public override void OnProcessInfoPlist(AppleBuildProfile _, BuildTarget buildTarget, string pathToBuiltTarget, PlistDocument infoPlist) { // Notify that we support controllers... diff --git a/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/Editor/AppleGameKitBuildStep.cs b/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/Editor/AppleGameKitBuildStep.cs index a10677cd..cb44e557 100644 --- a/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/Editor/AppleGameKitBuildStep.cs +++ b/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/Editor/AppleGameKitBuildStep.cs @@ -4,7 +4,7 @@ using UnityEditor; using UnityEngine; -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) using UnityEditor.iOS.Xcode; #endif @@ -21,7 +21,7 @@ public class AppleGameKitBuildStep : AppleBuildStep {BuildTarget.StandaloneOSX, "GameKitWrapper.bundle"} }; -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) public override void OnProcessEntitlements(AppleBuildProfile _, BuildTarget buildTarget, string _1, PlistDocument entitlements) { if(buildTarget == BuildTarget.StandaloneOSX) diff --git a/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/Source/GKIdentityVerificationResponse.cs b/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/Source/GKIdentityVerificationResponse.cs index bd11d9bc..5cc985b6 100644 --- a/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/Source/GKIdentityVerificationResponse.cs +++ b/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/Source/GKIdentityVerificationResponse.cs @@ -9,38 +9,42 @@ public struct GKIdentityVerificationResponse /// <summary> /// The URL for the public encryption key. /// </summary> + //public string PublicKeyUrl; public string PublicKeyUrl; - internal IntPtr Signature; - internal int SignatureLength; - internal IntPtr Salt; - internal int SaltLength; - /// <summary> - /// The signature’s creation date and time. - /// </summary> - public ulong Timestamp; /// <summary> /// The verification signature data that GameKit generates. /// </summary> - /// <returns></returns> - public byte[] GetSignature() - { - var signature = new byte[SignatureLength]; - Marshal.Copy(Signature, signature, 0, SignatureLength); - - return signature; - } - + public byte[] Signature; + /// <summary> /// A random NSString that GameKit uses to compute the hash and randomize it. /// </summary> - /// <returns></returns> - public byte[] GetSalt() + public byte[] Salt; + + /// <summary> + /// The signature’s creation date and time. + /// </summary> + public ulong Timestamp; + + internal GKIdentityVerificationResponse(ulong timestamp, + IntPtr publicKeyUrl, int publicKeyUrlLength, + IntPtr signature, int signatureLength, + IntPtr salt, int saltLength) { - var salt = new byte[SaltLength]; - Marshal.Copy(Salt, salt, 0, SaltLength); + Timestamp = timestamp; + + var publicKeyUrlBytes = new byte[publicKeyUrlLength]; + Marshal.Copy(publicKeyUrl, publicKeyUrlBytes, 0, publicKeyUrlLength); + PublicKeyUrl = System.Text.Encoding.UTF8.GetString(publicKeyUrlBytes); + + Signature = new byte[signatureLength]; + Marshal.Copy(signature, Signature, 0, signatureLength); + + Salt = new byte[saltLength]; + Marshal.Copy(salt, Salt, 0, saltLength); - return salt; } + } } \ No newline at end of file diff --git a/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/Source/GKLocalPlayer.cs b/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/Source/GKLocalPlayer.cs index 8da0f3e0..0dab10d6 100644 --- a/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/Source/GKLocalPlayer.cs +++ b/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/Source/GKLocalPlayer.cs @@ -90,8 +90,13 @@ public static GKLocalPlayer Local #endregion #region FetchItems + private delegate void SuccessTaskFetchItemsCallback(long taskId, ulong timestamp, + IntPtr publicKeyUrl, int publicKeyUrlLength, + IntPtr signature, int signatureLength, + IntPtr salt, int saltLength); + [DllImport(InteropUtility.DLLName)] - private static extern void GKLocalPlayer_FetchItems(IntPtr pointer, long taskId, SuccessTaskCallback<GKIdentityVerificationResponse> onSuccess, NSErrorTaskCallback onError); + private static extern void GKLocalPlayer_FetchItems(IntPtr pointer, long taskId, SuccessTaskFetchItemsCallback onSuccess, NSErrorTaskCallback onError); /// <summary> /// Generates a signature so that a third-party server can authenticate the local player. @@ -104,9 +109,17 @@ public Task<GKIdentityVerificationResponse> FetchItems() return tcs.Task; } - [MonoPInvokeCallback(typeof(SuccessTaskCallback<GKIdentityVerificationResponse>))] - private static void OnFetchItems(long taskId, GKIdentityVerificationResponse response) + [MonoPInvokeCallback(typeof(SuccessTaskFetchItemsCallback))] + private static void OnFetchItems(long taskId, ulong timestamp, + IntPtr publicKeyUrl, int publicKeyUrlLength, + IntPtr signature, int signatureLength, + IntPtr salt, int saltLength) { + var response = new GKIdentityVerificationResponse(timestamp, + publicKeyUrl, publicKeyUrlLength, + signature, signatureLength, + salt, saltLength); + InteropTasks.TrySetResultAndRemove(taskId, response); } @@ -116,7 +129,7 @@ private static void OnFetchItemsError(long taskId, IntPtr errorPointer) InteropTasks.TrySetExceptionAndRemove<GKIdentityVerificationResponse>(taskId, new GameKitException(errorPointer)); } #endregion - + #region Authenticate [DllImport(InteropUtility.DLLName)] private static extern void GKLocalPlayer_Authenticate(long taskId, SuccessTaskCallback<IntPtr> onSuccess, NSErrorTaskCallback onError); @@ -240,4 +253,4 @@ private static void OnLoadRecentPlayersError(long taskId, IntPtr errorPointer) } #endregion } -} \ No newline at end of file +} diff --git a/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKLocalPlayer.swift b/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKLocalPlayer.swift index c0d99371..74703012 100644 --- a/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKLocalPlayer.swift +++ b/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKLocalPlayer.swift @@ -198,30 +198,38 @@ public func GKLocalPlayer_LoadFriendsAuthorizationStatus }; } -public typealias SuccessTaskFetchItemsCallback = @convention(c) (Int64, char_p, uchar_p, Int32, uchar_p, Int32, UInt) -> Void; +public typealias SuccessTaskFetchItemsCallback = @convention(c) (Int64, UInt, uchar_p, Int32, uchar_p, Int32, uchar_p, Int32) -> Void; @_cdecl("GKLocalPlayer_FetchItems") public func GKLocalPlayer_FetchItems ( + pointer: UnsafeMutableRawPointer, taskId: Int64, onSuccess: @escaping SuccessTaskFetchItemsCallback, onError: @escaping NSErrorCallback ) { if #available(macOS 10.15.5, iOS 13.5, tvOS 13.5, *) { - GKLocalPlayer.local.fetchItems(forIdentityVerificationSignature: { publicKeyUrl, signature, salt, timestamp, error in + let player = Unmanaged<GKLocalPlayer>.fromOpaque(pointer).takeUnretainedValue(); + player.fetchItems(forIdentityVerificationSignature: { publicKeyUrl, signature, salt, timestamp, error in if(error != nil) { onError(taskId, Unmanaged.passRetained(error! as NSError).toOpaque()); return; } - onSuccess(taskId, - publicKeyUrl!.absoluteString.toCharPCopy(), - signature!.toUCharP(), - Int32(signature!.count), - salt!.toUCharP(), - Int32(salt!.count), - UInt(timestamp)); + let publicKeyUrlData = publicKeyUrl!.absoluteString.data(using: .utf8) + + onSuccess( + taskId, + UInt(timestamp), + publicKeyUrlData!.toUCharP(), + Int32(publicKeyUrlData!.count), + signature!.toUCharP(), + Int32(signature!.count), + salt!.toUCharP(), + Int32(salt!.count) + ) + }) } else { let error = NSError.init(domain: "GKLocalPlayer", code: -7, userInfo: nil); diff --git a/plug-ins/Apple.PHASE/Apple.PHASE_Unity/Assets/Editor/PHASEBuildStep.cs b/plug-ins/Apple.PHASE/Apple.PHASE_Unity/Assets/Editor/PHASEBuildStep.cs index 5b7ca61b..a582338d 100644 --- a/plug-ins/Apple.PHASE/Apple.PHASE_Unity/Assets/Editor/PHASEBuildStep.cs +++ b/plug-ins/Apple.PHASE/Apple.PHASE_Unity/Assets/Editor/PHASEBuildStep.cs @@ -5,7 +5,7 @@ using UnityEditor; using UnityEngine; -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) using UnityEditor.iOS.Xcode; #endif @@ -21,7 +21,7 @@ public class PHASEBuildStep : AppleBuildStep {BuildTarget.StandaloneOSX, "AudioPluginPHASE.bundle"} }; -#if UNITY_EDITOR_OSX +#if UNITY_EDITOR_OSX && (UNITY_IOS || UNITY_TVOS || UNITY_STANDALONE_OSX) public override void OnProcessFrameworks(AppleBuildProfile _, BuildTarget buildTarget, string pathToBuiltTarget, PBXProject pbxProject) { if (_libraryTable.ContainsKey(buildTarget))