update: 接口兼容性修复, 添加废弃接口声明
parent
3de38bf384
commit
e956b89dd1
|
|
@ -6,7 +6,7 @@ namespace Guru
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启动参数配置
|
/// 启动参数配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class GuruSDKInitConfig
|
public class GuruSDKInitConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 使用自定义的ConsentFlow启动流程
|
/// 使用自定义的ConsentFlow启动流程
|
||||||
|
|
@ -23,7 +23,7 @@ namespace Guru
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自动记录完成的关卡
|
/// 自动记录完成的关卡
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AutoRecordFinishedLevels = true;
|
public bool AutoRecordFinishedLevels = false;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义 Service 云控 Key
|
/// 自定义 Service 云控 Key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -31,7 +31,7 @@ namespace Guru
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DeepLink 回调
|
/// DeepLink 回调
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Action<string> OnDeeplinkCallback;
|
public Action<string> OnAdjustDeeplinkCallback;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Banner 背景颜色 Hex 值
|
/// Banner 背景颜色 Hex 值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -62,11 +62,12 @@ namespace Guru
|
||||||
/// 构建启动配置
|
/// 构建启动配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
[Obsolete("此方法将在下个版本中被废弃, 请直接使用 GuruSDKInitConfig.Builder 来进行初始化。 例如:GuruSDKInitConfig.Builder().SetIsBuyNoAds(true).Build()")]
|
||||||
public static GuruSDKInitConfig Build(
|
public static GuruSDKInitConfig Build(
|
||||||
bool useCustomConsent = false,
|
bool useCustomConsent = false,
|
||||||
bool autoLoadAds = true,
|
bool autoLoadAds = true,
|
||||||
bool iapEnabled = true,
|
bool iapEnabled = true,
|
||||||
bool autoRecordFinishedLevels = true,
|
bool autoRecordFinishedLevels = false,
|
||||||
bool isBuyNoAds = false,
|
bool isBuyNoAds = false,
|
||||||
Action<string> onDeeplinkCallback = null,
|
Action<string> onDeeplinkCallback = null,
|
||||||
string bannerBackgroundColor = "#00000000",
|
string bannerBackgroundColor = "#00000000",
|
||||||
|
|
@ -87,7 +88,7 @@ namespace Guru
|
||||||
DebugMode = debugMode,
|
DebugMode = debugMode,
|
||||||
GoogleKeys = googleKeys,
|
GoogleKeys = googleKeys,
|
||||||
AppleRootCerts = appleRootCerts,
|
AppleRootCerts = appleRootCerts,
|
||||||
OnDeeplinkCallback = onDeeplinkCallback,
|
OnAdjustDeeplinkCallback = onDeeplinkCallback,
|
||||||
DefaultRemoteData = defaultRemoteData ?? new Dictionary<string, object>(),
|
DefaultRemoteData = defaultRemoteData ?? new Dictionary<string, object>(),
|
||||||
};
|
};
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
|
|
@ -107,14 +108,127 @@ namespace Guru
|
||||||
sb.AppendLine($"------- Custom init Config -------");
|
sb.AppendLine($"------- Custom init Config -------");
|
||||||
sb.AppendLine($"\tUseCustomConsent: {UseCustomConsent}");
|
sb.AppendLine($"\tUseCustomConsent: {UseCustomConsent}");
|
||||||
sb.AppendLine($"\tAutoLoadWhenAdsReady: {AutoLoadWhenAdsReady}");
|
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($"\tIAPEnabled: {IAPEnabled}");
|
||||||
sb.AppendLine($"\tShowDebugLog: {DebugMode}");
|
sb.AppendLine($"\tBannerBackgroundColor: {BannerBackgroundColor}");
|
||||||
|
sb.AppendLine($"\tCustomServiceKey: {CustomServiceKey}");
|
||||||
sb.AppendLine($"------- Custom init Config -------");
|
sb.AppendLine($"------- Custom init Config -------");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Builder
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 构造器
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static GuruSDKInitConfigBuilder Builder() => new GuruSDKInitConfigBuilder();
|
||||||
|
|
||||||
#endregion
|
#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;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete("BuildConfig 方法将在下个版本中被删除。 请使用 GuruInitConfig.Builder().Build() 来进行属性赋值和构造")]
|
||||||
public static GuruSDKInitConfig BuildConfig(
|
public static GuruSDKInitConfig BuildConfig(
|
||||||
bool useCustomConsent = false,
|
bool useCustomConsent = false,
|
||||||
bool autoLoadAds = true,
|
bool autoLoadAds = true,
|
||||||
bool iapEnabled = true,
|
bool iapEnabled = true,
|
||||||
bool autoRecordFinishedLevels = true,
|
bool autoRecordFinishedLevels = false,
|
||||||
bool debugMode = false,
|
bool debugMode = false,
|
||||||
bool isBuyNoAds = false,
|
bool isBuyNoAds = false,
|
||||||
Action<string> onDeeplinkCallback = null,
|
Action<string> onDeeplinkCallback = null,
|
||||||
|
|
@ -100,9 +101,19 @@ namespace Guru
|
||||||
byte[] googleKeys = null,
|
byte[] googleKeys = null,
|
||||||
byte[] appleRootCerts = null)
|
byte[] appleRootCerts = null)
|
||||||
{
|
{
|
||||||
var config = GuruSDKInitConfig.Build(useCustomConsent, autoLoadAds, iapEnabled,
|
var config = GuruSDKInitConfig.Builder()
|
||||||
autoRecordFinishedLevels, isBuyNoAds, onDeeplinkCallback, bannerColor,
|
.SetUseCustomConsent(useCustomConsent)
|
||||||
debugMode, defaultRemoteData, googleKeys, appleRootCerts);
|
.SetAutoLoadWhenAdsReady(autoLoadAds)
|
||||||
|
.SetIAPEnabled(iapEnabled)
|
||||||
|
.SetAutoRecordFinishedLevels(autoRecordFinishedLevels)
|
||||||
|
.SetDebugMode(debugMode)
|
||||||
|
.SetIsBuyNoAds(isBuyNoAds)
|
||||||
|
.SetOnAdjustDeeplinkCallback(onDeeplinkCallback)
|
||||||
|
.SetBannerBackgroundColor(bannerColor)
|
||||||
|
.SetDefaultRemoteData(defaultRemoteData)
|
||||||
|
.SetGoogleKeys(googleKeys)
|
||||||
|
.SetAppleRootCerts(appleRootCerts)
|
||||||
|
.Build();
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -165,7 +176,7 @@ namespace Guru
|
||||||
FirebaseUtil.onInitComplete += OnFirebaseReady;
|
FirebaseUtil.onInitComplete += OnFirebaseReady;
|
||||||
FirebaseUtil.OnUserAuthResult += OnUserAuthResult;
|
FirebaseUtil.OnUserAuthResult += OnUserAuthResult;
|
||||||
FirebaseUtil.OnFirebaseAuthResult += OnFirebaseAuthResult;
|
FirebaseUtil.OnFirebaseAuthResult += OnFirebaseAuthResult;
|
||||||
FirebaseUtil.InitFirebase(null, InitConfig.OnDeeplinkCallback); // 确保所有的逻辑提前被调用到
|
FirebaseUtil.InitFirebase(null, InitConfig.OnAdjustDeeplinkCallback); // 确保所有的逻辑提前被调用到
|
||||||
|
|
||||||
LogI($"#2.1 --- InitFacebook ---");
|
LogI($"#2.1 --- InitFacebook ---");
|
||||||
//---------- Start Facebook ------------
|
//---------- Start Facebook ------------
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue