From 84ecdd1dfcf91e6bfc10127956d09c6db811e271 Mon Sep 17 00:00:00 2001 From: huyfei Date: Wed, 10 Jan 2024 19:16:10 +0800 Subject: [PATCH] =?UTF-8?q?update=EF=BC=9A=20=E6=B7=BB=E5=8A=A0GuruSetting?= =?UTF-8?q?s=20=E7=9A=84=E6=87=92=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Code/SDK/GuruSDK.cs | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/Runtime/Code/SDK/GuruSDK.cs b/Runtime/Code/SDK/GuruSDK.cs index 13e1a8f..321b061 100644 --- a/Runtime/Code/SDK/GuruSDK.cs +++ b/Runtime/Code/SDK/GuruSDK.cs @@ -38,7 +38,16 @@ namespace Guru internal static GuruSDKModel Model => GuruSDKModel.Instance; private static GuruServicesConfig _appServicesConfig; - private static GuruSettings guruSettings; + private static GuruSettings _guruSettings; + + private static GuruSettings GuruSettings + { + get + { + if (_guruSettings == null) _guruSettings = GuruSettings.Instance; + return _guruSettings; + } + } /// /// Debug Mode @@ -185,7 +194,6 @@ namespace Guru { bool useKeywords = true; bool useIAP = true; - guruSettings = GuruSettings.Instance; var services = GetRemoteServicesConfig(); if (services != null) @@ -193,15 +201,15 @@ namespace Guru _appServicesConfig = services; useKeywords = _appServicesConfig.IsKeywordsEnabled(); - if (null != guruSettings) + if (null != GuruSettings) { if(_appServicesConfig.adjust_settings != null) { // 更新 Adjust Tokens - guruSettings.UpdateAdjustTokens(_appServicesConfig.adjust_settings.AndroidToken + GuruSettings.UpdateAdjustTokens(_appServicesConfig.adjust_settings.AndroidToken ,_appServicesConfig.adjust_settings.iOSToken); // 更新 Adjust Events - guruSettings.UpdateAdjustEvents(_appServicesConfig.adjust_settings.events); + GuruSettings.UpdateAdjustEvents(_appServicesConfig.adjust_settings.events); } } useIAP = _appServicesConfig.IsIAPEnabled(); @@ -215,7 +223,7 @@ namespace Guru } // 更新和升级 GuruSettings 对应的值 - guruSettings.UpdateAppSettings( + GuruSettings.UpdateAppSettings( _appServicesConfig.app_settings.bundle_id, _appServicesConfig.fb_settings.fb_app_id, _appServicesConfig.app_settings.support_email, @@ -260,7 +268,7 @@ namespace Guru public static string UID => _model?.UserId ?? ""; - public static string SupportEmail => guruSettings?.SupportEmail ?? ""; + public static string SupportEmail => GuruSettings.SupportEmail ?? ""; public static string StoreUrl { @@ -270,9 +278,9 @@ namespace Guru #if UNITY_EDITOR url = "test@com.guru.ai"; #elif UNITY_ANDROID - url = guruSettings?.AndroidStoreUrl ?? ""; + url = GuruSettings?.AndroidStoreUrl ?? ""; #elif UNITY_IOS - url = guruSettings?.IOSStoreUrl ?? ""; + url = GuruSettings?.IOSStoreUrl ?? ""; #endif return url; }