update: 添加GuruSettings 的懒加载
parent
90b3aa4da6
commit
84ecdd1dfc
|
|
@ -38,7 +38,16 @@ namespace Guru
|
||||||
internal static GuruSDKModel Model => GuruSDKModel.Instance;
|
internal static GuruSDKModel Model => GuruSDKModel.Instance;
|
||||||
private static GuruServicesConfig _appServicesConfig;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Debug Mode
|
/// Debug Mode
|
||||||
|
|
@ -185,7 +194,6 @@ namespace Guru
|
||||||
{
|
{
|
||||||
bool useKeywords = true;
|
bool useKeywords = true;
|
||||||
bool useIAP = true;
|
bool useIAP = true;
|
||||||
guruSettings = GuruSettings.Instance;
|
|
||||||
|
|
||||||
var services = GetRemoteServicesConfig();
|
var services = GetRemoteServicesConfig();
|
||||||
if (services != null)
|
if (services != null)
|
||||||
|
|
@ -193,15 +201,15 @@ namespace Guru
|
||||||
_appServicesConfig = services;
|
_appServicesConfig = services;
|
||||||
useKeywords = _appServicesConfig.IsKeywordsEnabled();
|
useKeywords = _appServicesConfig.IsKeywordsEnabled();
|
||||||
|
|
||||||
if (null != guruSettings)
|
if (null != GuruSettings)
|
||||||
{
|
{
|
||||||
if(_appServicesConfig.adjust_settings != null)
|
if(_appServicesConfig.adjust_settings != null)
|
||||||
{
|
{
|
||||||
// 更新 Adjust Tokens
|
// 更新 Adjust Tokens
|
||||||
guruSettings.UpdateAdjustTokens(_appServicesConfig.adjust_settings.AndroidToken
|
GuruSettings.UpdateAdjustTokens(_appServicesConfig.adjust_settings.AndroidToken
|
||||||
,_appServicesConfig.adjust_settings.iOSToken);
|
,_appServicesConfig.adjust_settings.iOSToken);
|
||||||
// 更新 Adjust Events
|
// 更新 Adjust Events
|
||||||
guruSettings.UpdateAdjustEvents(_appServicesConfig.adjust_settings.events);
|
GuruSettings.UpdateAdjustEvents(_appServicesConfig.adjust_settings.events);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
useIAP = _appServicesConfig.IsIAPEnabled();
|
useIAP = _appServicesConfig.IsIAPEnabled();
|
||||||
|
|
@ -215,7 +223,7 @@ namespace Guru
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新和升级 GuruSettings 对应的值
|
// 更新和升级 GuruSettings 对应的值
|
||||||
guruSettings.UpdateAppSettings(
|
GuruSettings.UpdateAppSettings(
|
||||||
_appServicesConfig.app_settings.bundle_id,
|
_appServicesConfig.app_settings.bundle_id,
|
||||||
_appServicesConfig.fb_settings.fb_app_id,
|
_appServicesConfig.fb_settings.fb_app_id,
|
||||||
_appServicesConfig.app_settings.support_email,
|
_appServicesConfig.app_settings.support_email,
|
||||||
|
|
@ -260,7 +268,7 @@ namespace Guru
|
||||||
|
|
||||||
public static string UID => _model?.UserId ?? "";
|
public static string UID => _model?.UserId ?? "";
|
||||||
|
|
||||||
public static string SupportEmail => guruSettings?.SupportEmail ?? "";
|
public static string SupportEmail => GuruSettings.SupportEmail ?? "";
|
||||||
|
|
||||||
public static string StoreUrl
|
public static string StoreUrl
|
||||||
{
|
{
|
||||||
|
|
@ -270,9 +278,9 @@ namespace Guru
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
url = "test@com.guru.ai";
|
url = "test@com.guru.ai";
|
||||||
#elif UNITY_ANDROID
|
#elif UNITY_ANDROID
|
||||||
url = guruSettings?.AndroidStoreUrl ?? "";
|
url = GuruSettings?.AndroidStoreUrl ?? "";
|
||||||
#elif UNITY_IOS
|
#elif UNITY_IOS
|
||||||
url = guruSettings?.IOSStoreUrl ?? "";
|
url = GuruSettings?.IOSStoreUrl ?? "";
|
||||||
#endif
|
#endif
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue