From 5c3be01eb3baa3bc55ff590bfc24e009a91ca841 Mon Sep 17 00:00:00 2001 From: huyufei Date: Wed, 7 Aug 2024 19:33:12 +0800 Subject: [PATCH] =?UTF-8?q?update=EF=BC=9A=E6=9B=B4=E6=96=B0Model=20?= =?UTF-8?q?=E5=86=85=20FirstOpenTime=20=E7=9A=84=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Code/Model/GuruSDKModel.cs | 12 ++++++++++-- Runtime/Code/SDK/GuruSDK.Analytics.cs | 7 ++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Runtime/Code/Model/GuruSDKModel.cs b/Runtime/Code/Model/GuruSDKModel.cs index d21f20e..be9c302 100644 --- a/Runtime/Code/Model/GuruSDKModel.cs +++ b/Runtime/Code/Model/GuruSDKModel.cs @@ -31,7 +31,7 @@ namespace Guru public int b_play = 0; public int buy_count = 0; public bool no_ads = false; - public string first_open_time = GetFirstOpenTime(); + public string first_open_time = ""; public List purchased; @@ -97,7 +97,15 @@ namespace Guru } } - public string FirstOpenTime => first_open_time; + public string FirstOpenTime + { + get => first_open_time; + set + { + first_open_time = value; + Save(); + } + } public bool IsIapUser => PurchasedCount > 0; diff --git a/Runtime/Code/SDK/GuruSDK.Analytics.cs b/Runtime/Code/SDK/GuruSDK.Analytics.cs index 8af4b45..7fe949f 100644 --- a/Runtime/Code/SDK/GuruSDK.Analytics.cs +++ b/Runtime/Code/SDK/GuruSDK.Analytics.cs @@ -395,6 +395,11 @@ namespace Guru public static void SetFirstOpenTime(string timestamp) { + if (string.IsNullOrEmpty(timestamp)) + { + timestamp = IPMConfig.FIRST_OPEN_TIME; + Model.FirstOpenTime = timestamp; + } SetUserProperty(Analytics.PropertyFirstOpenTime, timestamp); } @@ -431,7 +436,7 @@ namespace Guru if (_hasUserPropertiesInitiallyUpdated) return; _hasUserPropertiesInitiallyUpdated = true; - SetFirstOpenTime(Model?.FirstOpenTime ?? GuruSDKModel.GetFirstOpenTime()); // first_open_time + SetFirstOpenTime(Model?.FirstOpenTime ?? ""); // first_open_time SetUserIsIAP(Model?.IsIapUser ?? false); // is_iap_user SetUserBLevel(Model?.SuccessLevelId ?? 0); // b_level SetUserBLevel(Model?.TotalPlayedCount ?? 0); // b_play