fix: 修复 GuruSDK.UID 初始化时为空值的 BUG

dev
胡宇飞 2024-07-08 19:10:33 +08:00
parent 2724683377
commit 6e5ede3958
2 changed files with 13 additions and 3 deletions

View File

@ -2,9 +2,17 @@ namespace Guru
{
public partial class GuruSDK
{
public static string UID => Model?.UserId ?? IPMConfig.IPM_UID;
public static string UUID => Model?.UserId ?? IPMConfig.IPM_UUID;
// UID
public static string UID
{
get
{
if(Model != null && !string.IsNullOrEmpty(Model.UserId))
return Model.UserId;
return IPMConfig.IPM_UID;
}
}
public static string UUID => IPMConfig.IPM_UUID ?? "";
public static string DeviceId => IPMConfig.IPM_DEVICE_ID ?? ""; // TODO: change it to _model member later.
public static string PushToken => IPMConfig.IPM_PUSH_TOKEN ?? ""; // TODO: change it to _model member later.
public static string AuthToken => IPMConfig.IPM_TOKEN ?? ""; // TODO: change it to _model member later.

View File

@ -180,6 +180,7 @@ namespace Guru
private void OnUserAuthResult(bool success)
{
if (success && string.IsNullOrEmpty(IPMConfig.IPM_UID))
{
success = false;
@ -188,6 +189,7 @@ namespace Guru
if (success)
{
Model.UserId = IPMConfig.IPM_UID;
if (GuruIAP.Instance != null)
{
GuruIAP.Instance.SetUID(UID);