From 064edbd180662ef19870d196f2f2f78847892ede Mon Sep 17 00:00:00 2001 From: huyufei Date: Fri, 8 Mar 2024 19:27:55 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E5=AE=8C=E5=96=84=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E6=B5=81=E7=A8=8B,=20=E4=BF=AE=E5=A4=8D=E6=8A=A5?= =?UTF-8?q?=E7=A9=BA=E5=B8=A6=E6=9D=A5=E7=9A=84=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Code/SDK/GuruSDK.Ads.cs | 13 +++++++---- Runtime/Code/SDK/GuruSDK.cs | 38 ++++++++++++++++----------------- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/Runtime/Code/SDK/GuruSDK.Ads.cs b/Runtime/Code/SDK/GuruSDK.Ads.cs index 65aeb4a..64c9e46 100644 --- a/Runtime/Code/SDK/GuruSDK.Ads.cs +++ b/Runtime/Code/SDK/GuruSDK.Ads.cs @@ -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); } diff --git a/Runtime/Code/SDK/GuruSDK.cs b/Runtime/Code/SDK/GuruSDK.cs index ad0166d..14a1b80 100644 --- a/Runtime/Code/SDK/GuruSDK.cs +++ b/Runtime/Code/SDK/GuruSDK.cs @@ -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 => {