update: 更新SDK版本号-> 1.0.8, 修复ATT 点位上报的判定问题
parent
7044f87d3b
commit
98c025a285
|
|
@ -65,33 +65,43 @@ namespace Guru
|
|||
if (_hasConsentCalled) return;
|
||||
_hasConsentCalled = true;
|
||||
|
||||
_attType = InitConfig.UseCustomConsent ? ATTManager.GUIDE_TYPE_CUSTOM : ATTManager.GUIDE_TYPE_ADMOB; // 点位属性确定
|
||||
|
||||
bool enableCountryCheck = _appServicesConfig.DMACountryCheck();
|
||||
string dmaMapRule = _appServicesConfig.DMAMapRule();
|
||||
|
||||
#if UNITY_IOS
|
||||
InitAttStatus(); // Consent 启动前记录 ATT 初始值
|
||||
#endif
|
||||
Debug.Log($"{Tag} --- StartConsentFlow ---");
|
||||
GuruConsent.StartConsent(OnConsentOver, dmaMapRule:dmaMapRule, enableCountryCheck:enableCountryCheck);
|
||||
GuruConsent.StartConsent(OnGuruConsentOver, dmaMapRule:dmaMapRule, enableCountryCheck:enableCountryCheck);
|
||||
}
|
||||
|
||||
|
||||
private void OnConsentOver(int code)
|
||||
/// <summary>
|
||||
/// Guru Consent flow is Over
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
private void OnGuruConsentOver(int code)
|
||||
{
|
||||
#if UNITY_IOS
|
||||
InitAttStatus();
|
||||
#endif
|
||||
// 无论状态如何, 都在回调内启动广告初始化
|
||||
StartAdService();
|
||||
|
||||
// 调用回调
|
||||
Callbacks.ConsentFlow._onConsentResult?.Invoke(code);
|
||||
|
||||
#if UNITY_IOS
|
||||
CheckAttStatus(); // [iOS] Consent 启动后检查 ATT 初始值
|
||||
#endif
|
||||
|
||||
// 内部处理后继逻辑
|
||||
switch(code)
|
||||
{
|
||||
case GuruConsent.StatusCode.OBTAINED:
|
||||
case GuruConsent.StatusCode.NOT_AVAILABLE:
|
||||
// 已获取授权, 或者地区不可用, ATT 尚未启动
|
||||
// #if UNITY_IOS
|
||||
// CheckAttStatus(); // 删除主动触发的逻辑
|
||||
// #endif
|
||||
// TODO: 添加后继处理逻辑
|
||||
break;
|
||||
}
|
||||
|
||||
// 无论状态如何, 都在回调内启动广告初始化
|
||||
StartAdService();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -102,7 +112,7 @@ namespace Guru
|
|||
|
||||
private static string _initialAttStatus;
|
||||
private static String _attType = "admob";
|
||||
|
||||
private static bool _autoReCallAtt = false;
|
||||
|
||||
/// <summary>
|
||||
/// 显示系统的 ATT 弹窗
|
||||
|
|
@ -125,15 +135,19 @@ namespace Guru
|
|||
/// <summary>
|
||||
/// iOS 平台检查 ATT 状态
|
||||
/// </summary>
|
||||
private static void CheckAttStatus() => ATTManager.CheckStatus(ReportAttStatus);
|
||||
private static void CheckAttStatus(bool autoReCall = false)
|
||||
{
|
||||
_autoReCallAtt = autoReCall;
|
||||
ATTManager.CheckStatus(ReportAttStatus);
|
||||
}
|
||||
|
||||
private static void ReportAttStatus(string status)
|
||||
{
|
||||
LogI($"{Tag} --- Get Att status: {status}");
|
||||
LogI($"{Tag} --- Get Att status:{status} att Type:{_attType} recall:{_autoReCallAtt}");
|
||||
SetUserProperty(Analytics.ParameterATTStatus, status); // 当前的状态
|
||||
if (!string.IsNullOrEmpty(_initialAttStatus)
|
||||
&& status != ATTManager.ATT_STATUS_NOT_DETERMINED
|
||||
&& _initialAttStatus != status)
|
||||
&& _initialAttStatus != status
|
||||
&& status != ATTManager.ATT_STATUS_NOT_DETERMINED)
|
||||
{
|
||||
// 上报点位:
|
||||
Analytics.AttResult(status, _attType);
|
||||
|
|
@ -143,7 +157,7 @@ namespace Guru
|
|||
{
|
||||
case ATTManager.ATT_STATUS_NOT_DETERMINED:
|
||||
// ATT 状态未知, 请求弹窗
|
||||
RequestAttDialog();
|
||||
if(_autoReCallAtt) RequestAttDialog();
|
||||
break;
|
||||
case ATTManager.ATT_STATUS_RESTRICTED:
|
||||
case ATTManager.ATT_STATUS_DENIED:
|
||||
|
|
|
|||
|
|
@ -280,11 +280,6 @@ namespace Guru
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Apple 审核流程逻辑
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "com.guru.unity.sdk",
|
||||
"displayName": "Guru SDK",
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.8",
|
||||
"description": "Guru SDK for unity project",
|
||||
"unity": "2020.3",
|
||||
"author":{
|
||||
|
|
|
|||
Loading…
Reference in New Issue