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; }