From 9d168cdd46989ee895511e787e60bf0ddf6dd147 Mon Sep 17 00:00:00 2001 From: huyufei Date: Mon, 8 Jul 2024 19:10:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20GuruSDK.UID=20?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E6=97=B6=E4=B8=BA=E7=A9=BA=E5=80=BC?= =?UTF-8?q?=E7=9A=84=20BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Code/SDK/GuruSDK.Properties.cs | 14 +++++++++++--- Runtime/Code/SDK/GuruSDK.cs | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Runtime/Code/SDK/GuruSDK.Properties.cs b/Runtime/Code/SDK/GuruSDK.Properties.cs index 1e2f07b..3d04253 100644 --- a/Runtime/Code/SDK/GuruSDK.Properties.cs +++ b/Runtime/Code/SDK/GuruSDK.Properties.cs @@ -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. diff --git a/Runtime/Code/SDK/GuruSDK.cs b/Runtime/Code/SDK/GuruSDK.cs index 50b6cba..bb4f9e4 100644 --- a/Runtime/Code/SDK/GuruSDK.cs +++ b/Runtime/Code/SDK/GuruSDK.cs @@ -178,6 +178,7 @@ namespace Guru private void OnUserAuthResult(bool success) { + if (success && string.IsNullOrEmpty(IPMConfig.IPM_UID)) { success = false; @@ -186,6 +187,7 @@ namespace Guru if (success) { + Model.UserId = IPMConfig.IPM_UID; if (GuruIAP.Instance != null) { GuruIAP.Instance.SetUID(UID);