From abf252360c214fe5a929b35f95ca2b098fb500ee Mon Sep 17 00:00:00 2001 From: huyufei Date: Tue, 19 Mar 2024 16:19:39 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0=E5=B9=BF=E5=91=8A?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E9=80=BB=E8=BE=91,=20=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E4=BA=91=E6=8E=A7=E9=85=8D=E7=BD=AE=E5=90=AF=E5=8A=A8,=20?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=85=B3=E9=97=AD=E5=90=88=E8=A7=84=E6=80=A7?= =?UTF-8?q?,=20=E5=92=8C=20Consent=20=E5=90=8C=E6=97=B6=E5=90=AF=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Code/Config/GuruServicesConfig.cs | 2 ++ Runtime/Code/SDK/GuruSDK.Ads.cs | 21 +++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Runtime/Code/Config/GuruServicesConfig.cs b/Runtime/Code/Config/GuruServicesConfig.cs index 0f43e98..0ca4d99 100644 --- a/Runtime/Code/Config/GuruServicesConfig.cs +++ b/Runtime/Code/Config/GuruServicesConfig.cs @@ -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] diff --git a/Runtime/Code/SDK/GuruSDK.Ads.cs b/Runtime/Code/SDK/GuruSDK.Ads.cs index e9e774a..2704ba8 100644 --- a/Runtime/Code/SDK/GuruSDK.Ads.cs +++ b/Runtime/Code/SDK/GuruSDK.Ads.cs @@ -80,6 +80,7 @@ namespace Guru #region Guru Consent private bool _hasConsentCalled = false; + private bool _adServiceHasStarted = false; /// /// 启动Consent流程 @@ -87,6 +88,12 @@ namespace Guru /// 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); @@ -132,7 +139,17 @@ namespace Guru break; } } - + + /// + /// 启动广告服务 + /// + private void AdServiceHandler() + { + if (_adServiceHasStarted) return; + _adServiceHasStarted = true; + StartAdService(_adInitSpec); + } + #endregion #region IOS ATT 广告授权流程