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;
_hasConsentCalled = true;
bool enableCountryCheck = _appServicesConfig.DMACountryCheck();
string dmaMapRule = _appServicesConfig.DMAMapRule();
bool enableCountryCheck = false;
string dmaMapRule = "";
if (_appServicesConfig != null && _appServicesConfig.parameters != null)
{
enableCountryCheck = _appServicesConfig.DMACountryCheck();
dmaMapRule = _appServicesConfig.DMAMapRule();
}
#if UNITY_IOS
InitAttStatus(); // Consent 启动前记录 ATT 初始值
#endif
Debug.Log($"{Tag} --- StartConsentFlow ---");
Debug.Log($"{Tag} --- Call:StartConsentFlow ---");
GuruConsent.StartConsent(OnGuruConsentOver, dmaMapRule:dmaMapRule, enableCountryCheck:enableCountryCheck);
}

View File

@ -155,16 +155,18 @@ namespace Guru
// 开始Remote Manager初始化
RemoteConfigManager.Init(BuildDefaultRemoteData(_initConfig.DefaultRemoteData));
RemoteConfigManager.OnFetchCompleted += OnFetchRemoteCallback;
// 延迟执行 SDK 回调
Delay(0, () =>
{
LogI($"--- SDK Init Complete -> Callback: { (_onCompleteCallback == null ? "Null" : "NotNull") } ---");
_onCompleteCallback?.Invoke(true);
});
LogI($"--- Apply online services config ---");
// 根据上次的云控配置来初始化参数
SetupServicesConfig();
LogI($"--- SDK Init Complete -> Callback: { (_onCompleteCallback == null ? "Null" : "NotNull") } ---");
_onCompleteCallback?.Invoke(true);
var sp = DateTime.Now.ToUniversalTime() - _initTime;
LogSDKInitTime(sp.TotalSeconds);
}
@ -243,9 +245,9 @@ namespace Guru
IPMConfig.UsingUUID = true; // 开始使用 UUID 作为 DeviceID 标识
}
#if UNITY_IOS
// 苹果审核标志位
appleReview = _appServicesConfig.IsAppReview();
#if UNITY_IOS
// 苹果审核标志位
appleReview = _appServicesConfig.IsAppReview();
#endif
if (null != GuruSettings)
@ -261,9 +263,6 @@ namespace Guru
_appServicesConfig.app_settings.ios_store);
}
}
//---------------------------------
}, ex =>
{
@ -305,14 +304,13 @@ namespace Guru
{
// StartAppleReviewFlow(); // 直接显示 ATT 弹窗, 跳过 Consent 流程
Try(() =>
{
LogI($"--- StartAppleReviewFlow ---");
StartAppleReviewFlow(); // 直接显示 ATT 弹窗, 跳过 Consent 流程
}, ex =>
{
Debug.LogError($"--- ERROR on StartAppleReviewFlow: {ex.Message}");
});
}
{
LogI($"--- StartAppleReviewFlow ---");
StartAppleReviewFlow(); // 直接显示 ATT 弹窗, 跳过 Consent 流程
}, ex =>
{
Debug.LogError($"--- ERROR on StartAppleReviewFlow: {ex.Message}");
});
return;
}
#endif
@ -322,7 +320,7 @@ namespace Guru
// StartConsentFlow();
Try(() =>
{
LogI($"--- StartConsentFlow ---");
LogI($"--- #1. StartConsentFlow ---");
StartConsentFlow();
}, ex =>
{