update: 更新 DeviceID 的获取方式, 添加缓存功能

feature/Inventory
胡宇飞 2024-01-30 14:24:11 +08:00
parent e38f854347
commit dfd4b633b7
2 changed files with 23 additions and 2 deletions

View File

@ -88,7 +88,6 @@ namespace Guru
if(!string.IsNullOrEmpty(content))
{
string[] infos = content.Split('$');
IPMConfig.IPM_DEVICE_ID = SystemInfo.deviceUniqueIdentifier;
IPMConfig.IPM_BRAND = infos[0];
IPMConfig.IPM_LANGUAGE = infos[1];
IPMConfig.IPM_MODEL = infos[2];

View File

@ -28,7 +28,6 @@ namespace Guru
public static readonly string POST_Param_TokenSecret = "tokenSecret";
public static string IPM_APP_PACKAGE_NAME = Application.identifier;
public static string IPM_DEVICE_ID = SystemInfo.deviceUniqueIdentifier;
public static string IPM_APP_VERSION = Application.version;
public static string IPM_IOS_APP_GROUP = "group." + Application.identifier;
public static string IPM_BRAND = "";
@ -39,6 +38,29 @@ namespace Guru
public static string IPM_COUNTRY_CODE = RegionInfo.CurrentRegion.TwoLetterISORegionName;
public static bool IPM_NEWUSER = true;
/// <summary>
/// 中台设备 ID
/// </summary>
public static string IPM_DEVICE_ID
{
get
{
if (string.IsNullOrEmpty(SavedDeviceId))
{
SavedDeviceId = SystemInfo.deviceUniqueIdentifier; // 目前使用 UNITY 接口来生成对应的 DeviceID
}
return SavedDeviceId; // 优先使用缓存的 DeviceID
}
}
/// <summary>
/// 缓存设备 ID
/// </summary>
private static string SavedDeviceId
{
get => PlayerPrefs.GetString(nameof(SavedDeviceId), "");
set => PlayerPrefs.SetString(nameof(SavedDeviceId), value);
}
#if DEBUG
public static readonly string IPM_URL = "https://dev.saas.castbox.fm/";
#else