update: 打点初始化重构,添加日志缓存功能
--story=1021118 --user=yufei.hu 【中台】【打点】打点初始化重构,添加日志缓存功能 https://www.tapd.cn/33527076/s/1159704dev
parent
3050b67a31
commit
b9291e7885
|
|
@ -44,6 +44,10 @@ namespace Guru
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool DebugMode = false;
|
public bool DebugMode = false;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Debug模式下开启打点(默认关闭)
|
||||||
|
/// </summary>
|
||||||
|
public bool EnableDebugLogEvent = false;
|
||||||
|
/// <summary>
|
||||||
/// 云控参数的默认配置
|
/// 云控参数的默认配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|
@ -76,7 +80,8 @@ namespace Guru
|
||||||
bool useAdjustDeeplink = false,
|
bool useAdjustDeeplink = false,
|
||||||
Dictionary<string, object> defaultRemoteData = null,
|
Dictionary<string, object> defaultRemoteData = null,
|
||||||
byte[] googleKeys = null,
|
byte[] googleKeys = null,
|
||||||
byte[] appleRootCerts = null)
|
byte[] appleRootCerts = null,
|
||||||
|
bool debugEnableEventLog = false)
|
||||||
{
|
{
|
||||||
// 创建启动用参数
|
// 创建启动用参数
|
||||||
GuruSDKInitConfig config = new GuruSDKInitConfig()
|
GuruSDKInitConfig config = new GuruSDKInitConfig()
|
||||||
|
|
@ -92,6 +97,7 @@ namespace Guru
|
||||||
GoogleKeys = googleKeys,
|
GoogleKeys = googleKeys,
|
||||||
AppleRootCerts = appleRootCerts,
|
AppleRootCerts = appleRootCerts,
|
||||||
DefaultRemoteData = defaultRemoteData ?? new Dictionary<string, object>(),
|
DefaultRemoteData = defaultRemoteData ?? new Dictionary<string, object>(),
|
||||||
|
EnableDebugLogEvent = debugEnableEventLog,
|
||||||
};
|
};
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
config.DebugMode = true;
|
config.DebugMode = true;
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ namespace Guru
|
||||||
}
|
}
|
||||||
|
|
||||||
private GuruSDKInitConfig _initConfig;
|
private GuruSDKInitConfig _initConfig;
|
||||||
private Action<bool> _onCompleteCallback;
|
|
||||||
|
|
||||||
internal static GuruSDKInitConfig InitConfig => Instance._initConfig;
|
internal static GuruSDKInitConfig InitConfig => Instance._initConfig;
|
||||||
internal static GuruSDKModel Model => GuruSDKModel.Instance;
|
internal static GuruSDKModel Model => GuruSDKModel.Instance;
|
||||||
|
|
@ -99,11 +98,12 @@ namespace Guru
|
||||||
string bannerColor = "#00000000",
|
string bannerColor = "#00000000",
|
||||||
Dictionary<string, object> defaultRemoteData = null,
|
Dictionary<string, object> defaultRemoteData = null,
|
||||||
byte[] googleKeys = null,
|
byte[] googleKeys = null,
|
||||||
byte[] appleRootCerts = null)
|
byte[] appleRootCerts = null,
|
||||||
|
bool debugEnableEventLog = false)
|
||||||
{
|
{
|
||||||
var config = GuruSDKInitConfig.Build(useCustomConsent, autoLoadAds, iapEnabled,
|
var config = GuruSDKInitConfig.Build(useCustomConsent, autoLoadAds, iapEnabled,
|
||||||
autoRecordFinishedLevels, isBuyNoAds, bannerColor,
|
autoRecordFinishedLevels, isBuyNoAds, bannerColor,
|
||||||
debugMode, useAdjustDeeplink, defaultRemoteData, googleKeys, appleRootCerts);
|
debugMode, useAdjustDeeplink, defaultRemoteData, googleKeys, appleRootCerts, debugEnableEventLog);
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -144,22 +144,20 @@ namespace Guru
|
||||||
|
|
||||||
IsInitialSuccess = false;
|
IsInitialSuccess = false;
|
||||||
_initConfig = config;
|
_initConfig = config;
|
||||||
_onCompleteCallback = onComplete;
|
|
||||||
_isDebugEnabled = config.DebugMode;
|
_isDebugEnabled = config.DebugMode;
|
||||||
|
|
||||||
InitAssets();
|
if (config.EnableDebugLogEvent) Analytics.EnableDebugAnalytics = true; // 允许 Debug 模式下打点
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void InitAssets()
|
|
||||||
{
|
|
||||||
InitUpdaters(); // Updaters
|
InitUpdaters(); // Updaters
|
||||||
InitThreadHandler(); // 初始化线程处理器
|
InitThreadHandler(); // 初始化线程处理器
|
||||||
|
InitServices();
|
||||||
|
|
||||||
|
onComplete?.Invoke(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void InitServices()
|
||||||
void Start()
|
|
||||||
{
|
{
|
||||||
|
Analytics.InitAnalytics(); // 打点提前初始化
|
||||||
//---- Start All tools ----
|
//---- Start All tools ----
|
||||||
LogI($"#2 --- InitFirebase ---");
|
LogI($"#2 --- InitFirebase ---");
|
||||||
//---------- Start Firebase ------------
|
//---------- Start Firebase ------------
|
||||||
|
|
@ -167,13 +165,13 @@ namespace Guru
|
||||||
|
|
||||||
LogI($"#2.1 --- InitFacebook ---");
|
LogI($"#2.1 --- InitFacebook ---");
|
||||||
//---------- Start Facebook ------------
|
//---------- Start Facebook ------------
|
||||||
FBService.Instance.StartService();
|
FBService.Instance.StartService(Analytics.OnFBInitComplete);
|
||||||
|
|
||||||
LogI($"#2.2 --- Call SDK init complete -> callback: { (_onCompleteCallback == null ? "Null" : _onCompleteCallback.ToString()) } ---");
|
|
||||||
IsInitialSuccess = true;
|
IsInitialSuccess = true;
|
||||||
_onCompleteCallback?.Invoke(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启动 Firebase 服务
|
/// 启动 Firebase 服务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -188,7 +186,7 @@ namespace Guru
|
||||||
FirebaseUtil.OnAdjustDeeplinkCallback = OnDeeplinkCallback; // 挂载 Deeplink 的回调
|
FirebaseUtil.OnAdjustDeeplinkCallback = OnDeeplinkCallback; // 挂载 Deeplink 的回调
|
||||||
}
|
}
|
||||||
|
|
||||||
FirebaseUtil.InitFirebase(null); // 确保所有的逻辑提前被调用到
|
FirebaseUtil.InitFirebase(Analytics.OnFirebaseInitCompleted); // 确保所有的逻辑提前被调用到
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnUserAuthResult(bool success)
|
private void OnUserAuthResult(bool success)
|
||||||
|
|
@ -318,7 +316,7 @@ namespace Guru
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
|
|
||||||
// 自打点设置错误上报
|
// 自打点设置错误上报
|
||||||
if(enableAnaErrorLog) GuruAnalytics.EnableErrorLog = true;
|
// if(enableAnaErrorLog) GuruAnalytics.EnableErrorLog = true;
|
||||||
|
|
||||||
// adjust 事件设置
|
// adjust 事件设置
|
||||||
if (null != _appServicesConfig.adjust_settings && null != GuruSettings)
|
if (null != _appServicesConfig.adjust_settings && null != GuruSettings)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue