update: 接口兼容性修复, 添加废弃接口声明
parent
3de38bf384
commit
e956b89dd1
|
|
@ -6,7 +6,7 @@ namespace Guru
|
|||
/// <summary>
|
||||
/// 启动参数配置
|
||||
/// </summary>
|
||||
public partial class GuruSDKInitConfig
|
||||
public class GuruSDKInitConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// 使用自定义的ConsentFlow启动流程
|
||||
|
|
@ -23,7 +23,7 @@ namespace Guru
|
|||
/// <summary>
|
||||
/// 自动记录完成的关卡
|
||||
/// </summary>
|
||||
public bool AutoRecordFinishedLevels = true;
|
||||
public bool AutoRecordFinishedLevels = false;
|
||||
/// <summary>
|
||||
/// 自定义 Service 云控 Key
|
||||
/// </summary>
|
||||
|
|
@ -31,7 +31,7 @@ namespace Guru
|
|||
/// <summary>
|
||||
/// DeepLink 回调
|
||||
/// </summary>
|
||||
public Action<string> OnDeeplinkCallback;
|
||||
public Action<string> OnAdjustDeeplinkCallback;
|
||||
/// <summary>
|
||||
/// Banner 背景颜色 Hex 值
|
||||
/// </summary>
|
||||
|
|
@ -62,11 +62,12 @@ namespace Guru
|
|||
/// 构建启动配置
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[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<string> 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<string, object>(),
|
||||
};
|
||||
#if UNITY_EDITOR
|
||||
|
|
@ -107,8 +108,16 @@ 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();
|
||||
}
|
||||
|
|
@ -116,5 +125,110 @@ namespace Guru
|
|||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Builder
|
||||
|
||||
/// <summary>
|
||||
/// 构造器
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static GuruSDKInitConfigBuilder Builder() => new GuruSDKInitConfigBuilder();
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 构建器
|
||||
/// </summary>
|
||||
public class GuruSDKInitConfigBuilder
|
||||
{
|
||||
|
||||
private GuruSDKInitConfig _config = new GuruSDKInitConfig();
|
||||
|
||||
/// <summary>
|
||||
/// 构建配置
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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<string> 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<string, object> 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;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<string> 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 ------------
|
||||
|
|
|
|||
Loading…
Reference in New Issue