diff --git a/Runtime/Code/Config/GuruSDKInitConfig.cs b/Runtime/Code/Config/GuruSDKInitConfig.cs
index dd280c0..7d57e21 100644
--- a/Runtime/Code/Config/GuruSDKInitConfig.cs
+++ b/Runtime/Code/Config/GuruSDKInitConfig.cs
@@ -6,7 +6,7 @@ namespace Guru
///
/// 启动参数配置
///
- public partial class GuruSDKInitConfig
+ public class GuruSDKInitConfig
{
///
/// 使用自定义的ConsentFlow启动流程
@@ -23,7 +23,7 @@ namespace Guru
///
/// 自动记录完成的关卡
///
- public bool AutoRecordFinishedLevels = true;
+ public bool AutoRecordFinishedLevels = false;
///
/// 自定义 Service 云控 Key
///
@@ -31,7 +31,7 @@ namespace Guru
///
/// DeepLink 回调
///
- public Action OnDeeplinkCallback;
+ public Action OnAdjustDeeplinkCallback;
///
/// Banner 背景颜色 Hex 值
///
@@ -62,11 +62,12 @@ namespace Guru
/// 构建启动配置
///
///
+ [Obsolete("此方法将在下个版本中被废弃, 请直接使用 GuruSDKInitConfig.Builder 来进行初始化。 例如:GuruSDKInitConfig.Builder().SetIsBuyNoAds(true).Build()")]
public static GuruSDKInitConfig Build(
bool useCustomConsent = false,
bool autoLoadAds = true,
bool iapEnabled = true,
- bool autoRecordFinishedLevels = true,
+ bool autoRecordFinishedLevels = false,
bool isBuyNoAds = false,
Action onDeeplinkCallback = null,
string bannerBackgroundColor = "#00000000",
@@ -87,7 +88,7 @@ namespace Guru
DebugMode = debugMode,
GoogleKeys = googleKeys,
AppleRootCerts = appleRootCerts,
- OnDeeplinkCallback = onDeeplinkCallback,
+ OnAdjustDeeplinkCallback = onDeeplinkCallback,
DefaultRemoteData = defaultRemoteData ?? new Dictionary(),
};
#if UNITY_EDITOR
@@ -107,14 +108,127 @@ namespace Guru
sb.AppendLine($"------- Custom init Config -------");
sb.AppendLine($"\tUseCustomConsent: {UseCustomConsent}");
sb.AppendLine($"\tAutoLoadWhenAdsReady: {AutoLoadWhenAdsReady}");
+ sb.AppendLine($"\tAutoRecordFinishedLevels: {AutoRecordFinishedLevels}");
+ sb.AppendLine($"\tIsBuyNoAds: {IsBuyNoAds}");
+ sb.AppendLine($"\tOnDeeplinkCallback: {OnAdjustDeeplinkCallback}");
+ sb.AppendLine($"\tDefaultRemoteData: {DefaultRemoteData}");
+ sb.AppendLine($"\tGoogleKeys: {GoogleKeys}");
+ sb.AppendLine($"\tAppleRootCerts: {AppleRootCerts}");
+ sb.AppendLine($"\tDebugMode: {DebugMode}");
sb.AppendLine($"\tIAPEnabled: {IAPEnabled}");
- sb.AppendLine($"\tShowDebugLog: {DebugMode}");
+ sb.AppendLine($"\tBannerBackgroundColor: {BannerBackgroundColor}");
+ sb.AppendLine($"\tCustomServiceKey: {CustomServiceKey}");
sb.AppendLine($"------- Custom init Config -------");
return sb.ToString();
}
+ #endregion
+
+ #region Builder
+
+ ///
+ /// 构造器
+ ///
+ ///
+ public static GuruSDKInitConfigBuilder Builder() => new GuruSDKInitConfigBuilder();
+
#endregion
}
-}
\ No newline at end of file
+
+ ///
+ /// 构建器
+ ///
+ public class GuruSDKInitConfigBuilder
+ {
+
+ private GuruSDKInitConfig _config = new GuruSDKInitConfig();
+
+ ///
+ /// 构建配置
+ ///
+ ///
+ public GuruSDKInitConfig Build()
+ {
+ return _config;
+ }
+
+ public GuruSDKInitConfigBuilder SetUseCustomConsent(bool value)
+ {
+ _config.UseCustomConsent = value;
+ return this;
+ }
+ public GuruSDKInitConfigBuilder SetAutoLoadWhenAdsReady(bool value)
+ {
+ _config.AutoLoadWhenAdsReady = value;
+ return this;
+ }
+ public GuruSDKInitConfigBuilder SetIAPEnabled(bool value)
+ {
+ _config.IAPEnabled = value;
+ return this;
+ }
+ public GuruSDKInitConfigBuilder SetAutoRecordFinishedLevels(bool value)
+ {
+ _config.AutoRecordFinishedLevels = value;
+ return this;
+ }
+ public GuruSDKInitConfigBuilder SetIsBuyNoAds(bool value)
+ {
+ _config.IsBuyNoAds = value;
+ return this;
+ }
+ public GuruSDKInitConfigBuilder SetBannerBackgroundColor(string value)
+ {
+ _config.BannerBackgroundColor = value;
+ return this;
+ }
+ public GuruSDKInitConfigBuilder SetDebugMode(bool value)
+ {
+ _config.DebugMode = value;
+ return this;
+ }
+ public GuruSDKInitConfigBuilder SetOnAdjustDeeplinkCallback(Action callback)
+ {
+ _config.OnAdjustDeeplinkCallback = callback;
+ return this;
+ }
+ public GuruSDKInitConfigBuilder SetGoogleKeys(byte[] value)
+ {
+ _config.GoogleKeys = value;
+ return this;
+ }
+ public GuruSDKInitConfigBuilder SetAppleRootCerts(byte[] value)
+ {
+ _config.AppleRootCerts = value;
+ return this;
+ }
+ public GuruSDKInitConfigBuilder SetDefaultRemoteData(Dictionary value)
+ {
+ _config.DefaultRemoteData = value;
+ return this;
+ }
+ // public GuruSDKInitConfigBuilder SetEnableDebugLogEvent(bool value)
+ // {
+ // _config.EnableDebugLogEvent = value;
+ // return this;
+ // }
+ // public GuruSDKInitConfigBuilder SetCustomAnalyticsInitConfig(GuruAnalyticsInitConfig value)
+ // {
+ // _config.CustomAnalyticsInitConfig = value;
+ // return this;
+ // }
+ public GuruSDKInitConfigBuilder SetCustomServiceKey(string value)
+ {
+ _config.CustomServiceKey = value;
+ return this;
+ }
+ // public GuruSDKInitConfigBuilder SetAutoNotificationPermission(bool value)
+ // {
+ // _config.AutoNotificationPermission = value;
+ // return this;
+ // }
+ }
+}
+
diff --git a/Runtime/Code/SDK/GuruSDK.cs b/Runtime/Code/SDK/GuruSDK.cs
index c7f8985..124146b 100644
--- a/Runtime/Code/SDK/GuruSDK.cs
+++ b/Runtime/Code/SDK/GuruSDK.cs
@@ -87,11 +87,12 @@ namespace Guru
return _instance;
}
+ [Obsolete("BuildConfig 方法将在下个版本中被删除。 请使用 GuruInitConfig.Builder().Build() 来进行属性赋值和构造")]
public static GuruSDKInitConfig BuildConfig(
bool useCustomConsent = false,
bool autoLoadAds = true,
bool iapEnabled = true,
- bool autoRecordFinishedLevels = true,
+ bool autoRecordFinishedLevels = false,
bool debugMode = false,
bool isBuyNoAds = false,
Action onDeeplinkCallback = null,
@@ -100,9 +101,19 @@ namespace Guru
byte[] googleKeys = null,
byte[] appleRootCerts = null)
{
- var config = GuruSDKInitConfig.Build(useCustomConsent, autoLoadAds, iapEnabled,
- autoRecordFinishedLevels, isBuyNoAds, onDeeplinkCallback, bannerColor,
- debugMode, defaultRemoteData, googleKeys, appleRootCerts);
+ var config = GuruSDKInitConfig.Builder()
+ .SetUseCustomConsent(useCustomConsent)
+ .SetAutoLoadWhenAdsReady(autoLoadAds)
+ .SetIAPEnabled(iapEnabled)
+ .SetAutoRecordFinishedLevels(autoRecordFinishedLevels)
+ .SetDebugMode(debugMode)
+ .SetIsBuyNoAds(isBuyNoAds)
+ .SetOnAdjustDeeplinkCallback(onDeeplinkCallback)
+ .SetBannerBackgroundColor(bannerColor)
+ .SetDefaultRemoteData(defaultRemoteData)
+ .SetGoogleKeys(googleKeys)
+ .SetAppleRootCerts(appleRootCerts)
+ .Build();
return config;
}
@@ -165,7 +176,7 @@ namespace Guru
FirebaseUtil.onInitComplete += OnFirebaseReady;
FirebaseUtil.OnUserAuthResult += OnUserAuthResult;
FirebaseUtil.OnFirebaseAuthResult += OnFirebaseAuthResult;
- FirebaseUtil.InitFirebase(null, InitConfig.OnDeeplinkCallback); // 确保所有的逻辑提前被调用到
+ FirebaseUtil.InitFirebase(null, InitConfig.OnAdjustDeeplinkCallback); // 确保所有的逻辑提前被调用到
LogI($"#2.1 --- InitFacebook ---");
//---------- Start Facebook ------------