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; }