Compare commits
2 Commits
b9291e7885
...
1e59e5efa6
| Author | SHA1 | Date |
|---|---|---|
|
|
1e59e5efa6 | |
|
|
4721e027b2 |
|
|
@ -278,6 +278,8 @@ namespace Guru
|
|||
/// <param name="callback"></param>
|
||||
public static void RequestNotificationPermission(Action<string> callback = null)
|
||||
{
|
||||
FirebaseUtil.StartFetchFcmToken();
|
||||
|
||||
UnityEngine.Debug.Log($"[SDK] ---- RequestNotificationPermission");
|
||||
NotificationService.RequestPermission(status =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,8 +44,7 @@ namespace Guru
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region Android System
|
||||
|
||||
#if UNITY_ANDROID
|
||||
|
|
@ -78,7 +77,5 @@ namespace Guru
|
|||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ namespace Guru
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Debug = UnityEngine.Debug;
|
||||
using Guru.Network;
|
||||
|
||||
public partial class GuruSDK: MonoBehaviour
|
||||
{
|
||||
|
|
@ -147,11 +148,15 @@ namespace Guru
|
|||
_isDebugEnabled = config.DebugMode;
|
||||
|
||||
if (config.EnableDebugLogEvent) Analytics.EnableDebugAnalytics = true; // 允许 Debug 模式下打点
|
||||
if (!config.AutoNotificationPermission) FirebaseUtil.SetAutoFetchFcmToken(false); // 不允许自动启动获取 FCM Token
|
||||
|
||||
InitUpdaters(); // Updaters
|
||||
InitThreadHandler(); // 初始化线程处理器
|
||||
InitServices();
|
||||
|
||||
InitNetworkMonitor(); // 网络状态
|
||||
|
||||
|
||||
onComplete?.Invoke(true);
|
||||
}
|
||||
|
||||
|
|
@ -783,6 +788,34 @@ namespace Guru
|
|||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 网络状态上报
|
||||
|
||||
|
||||
private NetworkStatusMonitor _networkStatusMonitor;
|
||||
|
||||
private void InitNetworkMonitor()
|
||||
{
|
||||
_networkStatusMonitor = new NetworkStatusMonitor();
|
||||
_networkStatusMonitor.Init(OnNetworkMonitorInitComplete);
|
||||
}
|
||||
|
||||
private void OnNetworkMonitorInitComplete(bool success)
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
// 上报用户network属性
|
||||
var status = _networkStatusMonitor.GetNetworkStatus();
|
||||
SetUserProperty("network", status);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"[SDK] --- NetworkStatusMonitor init failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue