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