#if UNITY_IOS using System.Runtime.InteropServices; using UnityEngine; namespace Ubisoft.Hotel.Device { public class NativeDeviceIOS : INativeDevice { [DllImport("__Internal")] private static extern long _NativeDeviceGetFreeDiskSpace(string path); [DllImport("__Internal")] private static extern bool _NativeDeviceGetIsLegitInstallation(); public long GetFreeDiskSpace(string path) { return _NativeDeviceGetFreeDiskSpace(path); } public AdvertisingInfo GetAdvertisingId() { AdvertisingInfo adInfo = new AdvertisingInfo(); _ = Application.RequestAdvertisingIdentifierAsync( (string advertisingId, bool trackingEnabled, string error) => { if (string.IsNullOrEmpty(error)) { DeviceLogger.Channel.LogInformation($"AdvertisingID {advertisingId} - TrackingEnabled {trackingEnabled}"); adInfo.RequestSuccess = true; adInfo.AdvertisingId = advertisingId; adInfo.TrackingEnabled = trackingEnabled; } else { DeviceLogger.Channel.LogWarning($"Error retrieving AdvertisingID: {error}"); } } ); return adInfo; } public void OpenAppInStore() { OpenAppInStore(Application.identifier); } public void OpenAppInStore(string appId) { Application.OpenURL($"itms-apps://itunes.apple.com/app/id{appId}"); } public bool IsLegitInstallation() { return _NativeDeviceGetIsLegitInstallation(); } } } #endif