diff --git a/Runtime/Code/Config/GuruServicesConfig.cs b/Runtime/Code/Config/GuruServicesConfig.cs index a669a98..3428b26 100644 --- a/Runtime/Code/Config/GuruServicesConfig.cs +++ b/Runtime/Code/Config/GuruServicesConfig.cs @@ -36,6 +36,7 @@ namespace Guru ad_settings.moloco_ids_ios.Length > 0; public bool IsIAPEnabled() => app_settings != null && app_settings.enable_iap && products != null && products.Length > 0; + public bool IsKeywordsEnabled() => app_settings != null && app_settings.enable_keywords; //-------------------------------- 配置检测 ------------------------------- } @@ -52,7 +53,7 @@ namespace Guru public string ios_store; public int token_vaild_time = 604800; public int level_end_success_num = 50; - public bool use_keywords = true; + public bool enable_keywords = true; public bool enable_firebase = true; public bool enable_facebook = true; public bool enable_adjust = true; diff --git a/Runtime/Code/Core/GuruSDK.cs b/Runtime/Code/Core/GuruSDK.cs index 67d82be..8313277 100644 --- a/Runtime/Code/Core/GuruSDK.cs +++ b/Runtime/Code/Core/GuruSDK.cs @@ -1,9 +1,8 @@ -using System.Collections; - namespace Guru { using UnityEngine; using System; + using System.Collections; using System.Collections.Generic; using System.IO; @@ -121,25 +120,18 @@ namespace Guru /// private void OnFirebaseReady() { - LogI($"--- Firebase complete ---"); - if (_appServicesConfig.IsIAPEnabled()) - { - // LogI($"--- #2 Init IAP ---"); - InitIAP(_initConfig.GoogleKeys, _initConfig.AppleRootCerts); // 初始化IAP - } - if (!InitConfig.UseCustomConsent) { // LogI($"--- #3 Start Consent Flow ---"); StartConsentFlow(); } + + if(!string.IsNullOrEmpty(IPMConfig.IPM_UID)) SetUID(IPMConfig.IPM_UID); // 开始Remote Manager初始化 RemoteConfigManager.Init(BuildDefaultRemoteData(_initConfig.DefaultRemoteData)); RemoteConfigManager.OnFetchCompleted += OnFetchRemoteCallback; - if(!string.IsNullOrEmpty(IPMConfig.IPM_UID)) SetUID(IPMConfig.IPM_UID); - // 根据上次的云控配置来初始化参数 SetupServicesConfig(); @@ -181,15 +173,15 @@ namespace Guru private void SetupServicesConfig() { bool useKeywords = true; + bool useIAP = true; var guruSettings = GuruSettings.Instance; var services = GetRemoteServicesConfig(); if (services != null) { _appServicesConfig = services; - useKeywords = _appServicesConfig.app_settings.use_keywords; - - + useKeywords = _appServicesConfig.IsKeywordsEnabled(); + if (null != guruSettings) { if(_appServicesConfig.adjust_settings != null) @@ -201,12 +193,17 @@ namespace Guru guruSettings.UpdateAdjustEvents(_appServicesConfig.adjust_settings.events); } } - + useIAP = _appServicesConfig.IsIAPEnabled(); + } + AdjustService.StartService(); + + if(useIAP) { + InitIAP(_initConfig.GoogleKeys, _initConfig.AppleRootCerts); // 初始化IAP } - if(useKeywords) KeywordsManager.Install(Model.IsIAPUser, Model.SuccessLevelCount); // 启动Keyword管理器 - - AdjustService.StartService(); + if(useKeywords) { + KeywordsManager.Install(Model.IsIAPUser, Model.SuccessLevelCount); // 启动Keyword管理器 + } }