update: 完善初始化流程, 修复报空带来的异常

deeplink
胡宇飞 2024-03-08 19:27:55 +08:00
parent ffff79d012
commit 064edbd180
2 changed files with 27 additions and 24 deletions

View File

@ -65,13 +65,18 @@ namespace Guru
if (_hasConsentCalled) return; if (_hasConsentCalled) return;
_hasConsentCalled = true; _hasConsentCalled = true;
bool enableCountryCheck = _appServicesConfig.DMACountryCheck(); bool enableCountryCheck = false;
string dmaMapRule = _appServicesConfig.DMAMapRule(); string dmaMapRule = "";
if (_appServicesConfig != null && _appServicesConfig.parameters != null)
{
enableCountryCheck = _appServicesConfig.DMACountryCheck();
dmaMapRule = _appServicesConfig.DMAMapRule();
}
#if UNITY_IOS #if UNITY_IOS
InitAttStatus(); // Consent 启动前记录 ATT 初始值 InitAttStatus(); // Consent 启动前记录 ATT 初始值
#endif #endif
Debug.Log($"{Tag} --- StartConsentFlow ---"); Debug.Log($"{Tag} --- Call:StartConsentFlow ---");
GuruConsent.StartConsent(OnGuruConsentOver, dmaMapRule:dmaMapRule, enableCountryCheck:enableCountryCheck); GuruConsent.StartConsent(OnGuruConsentOver, dmaMapRule:dmaMapRule, enableCountryCheck:enableCountryCheck);
} }

View File

@ -156,15 +156,17 @@ namespace Guru
RemoteConfigManager.Init(BuildDefaultRemoteData(_initConfig.DefaultRemoteData)); RemoteConfigManager.Init(BuildDefaultRemoteData(_initConfig.DefaultRemoteData));
RemoteConfigManager.OnFetchCompleted += OnFetchRemoteCallback; RemoteConfigManager.OnFetchCompleted += OnFetchRemoteCallback;
// 延迟执行 SDK 回调
Delay(0, () =>
{
LogI($"--- SDK Init Complete -> Callback: { (_onCompleteCallback == null ? "Null" : "NotNull") } ---");
_onCompleteCallback?.Invoke(true);
});
LogI($"--- Apply online services config ---"); LogI($"--- Apply online services config ---");
// 根据上次的云控配置来初始化参数 // 根据上次的云控配置来初始化参数
SetupServicesConfig(); SetupServicesConfig();
LogI($"--- SDK Init Complete -> Callback: { (_onCompleteCallback == null ? "Null" : "NotNull") } ---");
_onCompleteCallback?.Invoke(true);
var sp = DateTime.Now.ToUniversalTime() - _initTime; var sp = DateTime.Now.ToUniversalTime() - _initTime;
LogSDKInitTime(sp.TotalSeconds); LogSDKInitTime(sp.TotalSeconds);
} }
@ -261,9 +263,6 @@ namespace Guru
_appServicesConfig.app_settings.ios_store); _appServicesConfig.app_settings.ios_store);
} }
} }
//--------------------------------- //---------------------------------
}, ex => }, ex =>
{ {
@ -312,7 +311,6 @@ namespace Guru
{ {
Debug.LogError($"--- ERROR on StartAppleReviewFlow: {ex.Message}"); Debug.LogError($"--- ERROR on StartAppleReviewFlow: {ex.Message}");
}); });
}
return; return;
} }
#endif #endif
@ -322,7 +320,7 @@ namespace Guru
// StartConsentFlow(); // StartConsentFlow();
Try(() => Try(() =>
{ {
LogI($"--- StartConsentFlow ---"); LogI($"--- #1. StartConsentFlow ---");
StartConsentFlow(); StartConsentFlow();
}, ex => }, ex =>
{ {