using UnityEngine;

namespace SGModule.Common.Helper {
    public static class DeviceHelper {
        private const string Idfv = "IDFV";

        public static string GetDeviceID(string deviceName = "TestUser001") {
#if UNITY_IOS && !UNITY_EDITOR
            deviceName = Keychain.Get(Idfv);
            if (string.IsNullOrEmpty(deviceName))
            {
                deviceName = SystemInfo.deviceUniqueIdentifier;
                Keychain.Save(Idfv, deviceName);
            }

            return deviceName;
#elif UNITY_EDITOR
            return deviceName;
#endif
            return SystemInfo.deviceUniqueIdentifier;
        }
    }
}
