From d70c6eff8e2deedc69b6cb8890afedc64405384e Mon Sep 17 00:00:00 2001 From: huyufei Date: Tue, 19 Mar 2024 17:33:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20GuruServices=20?= =?UTF-8?q?=E5=9C=A8=E4=BD=BF=E7=94=A8=20CustomKey=20=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99,=20=E7=94=B1=E4=BA=8E=E9=A6=96=E6=AC=A1=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E6=97=A0=E6=B3=95=E8=8E=B7=E5=8F=96=E6=8A=A5=E7=A9=BA?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Code/SDK/GuruSDK.Ads.cs | 8 +++++--- Runtime/Code/SDK/GuruSDK.cs | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Runtime/Code/SDK/GuruSDK.Ads.cs b/Runtime/Code/SDK/GuruSDK.Ads.cs index 2704ba8..17ca30b 100644 --- a/Runtime/Code/SDK/GuruSDK.Ads.cs +++ b/Runtime/Code/SDK/GuruSDK.Ads.cs @@ -88,17 +88,19 @@ namespace Guru /// private void StartConsentFlow() { - if (!_adServiceHasStarted) + float time = 1; + if (!_adServiceHasStarted && _appServicesConfig != null) { - var time = _appServicesConfig.IsAdsCompliance() ? 10 : 1f; // 启动合规判定后, 延迟最多 10 秒后启动广告 - Delay(time, AdServiceHandler); // 广告延迟启动 + time = _appServicesConfig.IsAdsCompliance() ? 10 : 1f; // 启动合规判定后, 延迟最多 10 秒后启动广告 } + Delay(time, AdServiceHandler); // 广告延迟启动 if (_hasConsentCalled) return; _hasConsentCalled = true; bool enableCountryCheck = false; string dmaMapRule = ""; + if (_appServicesConfig != null && _appServicesConfig.parameters != null) { enableCountryCheck = _appServicesConfig.DMACountryCheck(); diff --git a/Runtime/Code/SDK/GuruSDK.cs b/Runtime/Code/SDK/GuruSDK.cs index ac9dcc5..9f318c4 100644 --- a/Runtime/Code/SDK/GuruSDK.cs +++ b/Runtime/Code/SDK/GuruSDK.cs @@ -342,16 +342,30 @@ namespace Guru /// private GuruServicesConfig GetRemoteServicesConfig() { + + string defaultJson = GetRemoteString(ServicesConfigKey); + + bool useCustomKey = false; string key = ServicesConfigKey; if (!string.IsNullOrEmpty(_initConfig.CustomServiceKey)) { key = _initConfig.CustomServiceKey; + useCustomKey = true; } - var json = GetRemoteString(key); + var json = GetRemoteString(key); // Cloud cached data + + if (string.IsNullOrEmpty(json) && useCustomKey && !string.IsNullOrEmpty(defaultJson)) + { + // No remote data fetched from cloud, should use default values + json = defaultJson; + Debug.Log($"{Tag} --- No remote data found with: {key} -> Using default key {ServicesConfigKey} and local data!!!"); + } + if (!string.IsNullOrEmpty(json)) { return JsonParser.ToObject(json); } + return null; }