update: 更新广告启动逻辑, 改为云控配置启动, 默认关闭合规性, 和 Consent 同时启动
parent
7f9263045b
commit
abf252360c
|
|
@ -55,6 +55,7 @@ namespace Guru
|
|||
public double Tch02Value() => parameters?.tch_020 ?? 0;
|
||||
public bool IsAppReview() => parameters?.apple_review ?? false;
|
||||
public bool EnableErrorLog() => parameters?.enable_errorlog ?? false;
|
||||
public bool IsAdsCompliance() => parameters?.ads_compliance ?? false;
|
||||
public bool DMACountryCheck() => parameters?.dma_country_check ?? false;
|
||||
public string DMAMapRule() => parameters?.dma_map_rule ?? "";
|
||||
public bool UseUUID() => parameters?.using_uuid ?? false;
|
||||
|
|
@ -95,6 +96,7 @@ namespace Guru
|
|||
public bool dma_country_check = false;
|
||||
public bool apple_review = false; // 苹果审核标志位
|
||||
public bool enable_errorlog = false;
|
||||
public bool ads_compliance = false;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ namespace Guru
|
|||
#region Guru Consent
|
||||
|
||||
private bool _hasConsentCalled = false;
|
||||
private bool _adServiceHasStarted = false;
|
||||
|
||||
/// <summary>
|
||||
/// 启动Consent流程
|
||||
|
|
@ -87,6 +88,12 @@ namespace Guru
|
|||
/// </summary>
|
||||
private void StartConsentFlow()
|
||||
{
|
||||
if (!_adServiceHasStarted)
|
||||
{
|
||||
var time = _appServicesConfig.IsAdsCompliance() ? 10 : 1f; // 启动合规判定后, 延迟最多 10 秒后启动广告
|
||||
Delay(time, AdServiceHandler); // 广告延迟启动
|
||||
}
|
||||
|
||||
if (_hasConsentCalled) return;
|
||||
_hasConsentCalled = true;
|
||||
|
||||
|
|
@ -113,7 +120,7 @@ namespace Guru
|
|||
{
|
||||
|
||||
// 无论状态如何, 都在回调内启动广告初始化
|
||||
StartAdService(_adInitSpec);
|
||||
AdServiceHandler();
|
||||
|
||||
// 调用回调
|
||||
Callbacks.ConsentFlow._onConsentResult?.Invoke(code);
|
||||
|
|
@ -133,6 +140,16 @@ namespace Guru
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 启动广告服务
|
||||
/// </summary>
|
||||
private void AdServiceHandler()
|
||||
{
|
||||
if (_adServiceHasStarted) return;
|
||||
_adServiceHasStarted = true;
|
||||
StartAdService(_adInitSpec);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IOS ATT 广告授权流程
|
||||
|
|
|
|||
Loading…
Reference in New Issue