update: 新增打点和 Firebase 回调逻辑
parent
e451155063
commit
60e6ae0716
|
|
@ -266,22 +266,35 @@ namespace Guru
|
|||
|
||||
#region SDK 打点
|
||||
|
||||
public const string EventUnitySDK = "guru_unity_sdk";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Log SDK boost time
|
||||
/// </summary>
|
||||
/// <param name="time"></param>
|
||||
private static void LogSDKInitTime(double time)
|
||||
{
|
||||
Analytics.Track("sdk_init_time", new Dictionary<string, dynamic>()
|
||||
Analytics.Track(EventUnitySDK, new Dictionary<string, dynamic>()
|
||||
{
|
||||
{"time", time.ToString("F6")},
|
||||
{"device_id", DeviceId},
|
||||
{ "init_time", time.ToString("F6") },
|
||||
{ Consts.PropertyDeviceID, DeviceId },
|
||||
}, new Analytics.EventSetting()
|
||||
{
|
||||
EnableFirebaseAnalytics = true,
|
||||
});
|
||||
}
|
||||
|
||||
private static void LogFirebaseDeps(bool success)
|
||||
{
|
||||
Analytics.Track(EventUnitySDK, new Dictionary<string, dynamic>()
|
||||
{
|
||||
{"firebase_deps", success? "true" : "false"},
|
||||
}, new Analytics.EventSetting()
|
||||
{
|
||||
EnableFirebaseAnalytics = true,
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,6 +158,17 @@ namespace Guru
|
|||
|
||||
}
|
||||
|
||||
|
||||
public static class SDK
|
||||
{
|
||||
internal static Action<bool> _onFirebaseReady;
|
||||
public static event Action<bool> OnFirebaseReady
|
||||
{
|
||||
add => _onFirebaseReady += value;
|
||||
remove => _onFirebaseReady -= value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -127,13 +127,15 @@ namespace Guru
|
|||
//---- Init All tools ----
|
||||
LogI($"#2 --- InitFirebase ---");
|
||||
//---------- Start Firebase ------------
|
||||
FirebaseUtil.InitFirebase(OnFirebaseReady); // 确保所有的逻辑提前被调用到
|
||||
FirebaseUtil.onInitComplete += OnFirebaseReady;
|
||||
FirebaseUtil.InitFirebase(null); // 确保所有的逻辑提前被调用到
|
||||
|
||||
LogI($"#2.1 --- InitFacebook ---");
|
||||
//---------- Start Facebook ------------
|
||||
FBService.Instance.StartService();
|
||||
|
||||
LogI($"#2.2 --- Call SDK init complete -> callback: { (_onCompleteCallback == null ? "Null" : _onCompleteCallback.ToString()) } ---");
|
||||
IsInitialSuccess = true;
|
||||
_onCompleteCallback?.Invoke(true);
|
||||
}
|
||||
|
||||
|
|
@ -141,12 +143,12 @@ namespace Guru
|
|||
/// <summary>
|
||||
/// 开始各种组件初始化
|
||||
/// </summary>
|
||||
private void OnFirebaseReady()
|
||||
private void OnFirebaseReady(bool success)
|
||||
{
|
||||
LogI($"#3 --- On FirebaseReady ---");
|
||||
IsInitialSuccess = true;
|
||||
|
||||
if(!string.IsNullOrEmpty(IPMConfig.IPM_UID)) SetUID(IPMConfig.IPM_UID); ;
|
||||
FirebaseUtil.onInitComplete -= OnFirebaseReady;
|
||||
LogI($"#3 --- On FirebaseDeps:{success} ---");
|
||||
Callbacks.SDK._onFirebaseReady?.Invoke(success);
|
||||
LogFirebaseDeps(success);
|
||||
|
||||
LogI($"#3.5 --- Call InitRemoteConfig ---");
|
||||
// 开始Remote Manager初始化
|
||||
|
|
|
|||
Loading…
Reference in New Issue