fix: 修复 GuruServices 在使用 CustomKey 的时候, 由于首次加载无法获取报空的问题
parent
abf252360c
commit
d70c6eff8e
|
|
@ -88,17 +88,19 @@ namespace Guru
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void StartConsentFlow()
|
private void StartConsentFlow()
|
||||||
{
|
{
|
||||||
if (!_adServiceHasStarted)
|
float time = 1;
|
||||||
|
if (!_adServiceHasStarted && _appServicesConfig != null)
|
||||||
{
|
{
|
||||||
var time = _appServicesConfig.IsAdsCompliance() ? 10 : 1f; // 启动合规判定后, 延迟最多 10 秒后启动广告
|
time = _appServicesConfig.IsAdsCompliance() ? 10 : 1f; // 启动合规判定后, 延迟最多 10 秒后启动广告
|
||||||
Delay(time, AdServiceHandler); // 广告延迟启动
|
|
||||||
}
|
}
|
||||||
|
Delay(time, AdServiceHandler); // 广告延迟启动
|
||||||
|
|
||||||
if (_hasConsentCalled) return;
|
if (_hasConsentCalled) return;
|
||||||
_hasConsentCalled = true;
|
_hasConsentCalled = true;
|
||||||
|
|
||||||
bool enableCountryCheck = false;
|
bool enableCountryCheck = false;
|
||||||
string dmaMapRule = "";
|
string dmaMapRule = "";
|
||||||
|
|
||||||
if (_appServicesConfig != null && _appServicesConfig.parameters != null)
|
if (_appServicesConfig != null && _appServicesConfig.parameters != null)
|
||||||
{
|
{
|
||||||
enableCountryCheck = _appServicesConfig.DMACountryCheck();
|
enableCountryCheck = _appServicesConfig.DMACountryCheck();
|
||||||
|
|
|
||||||
|
|
@ -342,16 +342,30 @@ namespace Guru
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private GuruServicesConfig GetRemoteServicesConfig()
|
private GuruServicesConfig GetRemoteServicesConfig()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
string defaultJson = GetRemoteString(ServicesConfigKey);
|
||||||
|
|
||||||
|
bool useCustomKey = false;
|
||||||
string key = ServicesConfigKey;
|
string key = ServicesConfigKey;
|
||||||
if (!string.IsNullOrEmpty(_initConfig.CustomServiceKey))
|
if (!string.IsNullOrEmpty(_initConfig.CustomServiceKey))
|
||||||
{
|
{
|
||||||
key = _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))
|
if (!string.IsNullOrEmpty(json))
|
||||||
{
|
{
|
||||||
return JsonParser.ToObject<GuruServicesConfig>(json);
|
return JsonParser.ToObject<GuruServicesConfig>(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue