fix: 更新 PushToken 重试间隔为 8s, 添加无网络判定

Signed-off-by: huyufei <yufei.hu@castbox.fm>
胡宇飞 2024-09-09 16:05:28 +08:00
parent 7237dbfcae
commit 447740487e
1 changed files with 8 additions and 1 deletions

View File

@ -13,7 +13,7 @@ namespace Guru
public static partial class FirebaseUtil
{
private static int _retryDeviceCount = 1;
private const int _retryTokenDelay = 2;
private const int _retryTokenDelay = 8;
// public static bool? IsInitMessage;
private static bool _isAutoFetchFcmToken = true;
private static bool _isFetchOnce = false;
@ -52,6 +52,13 @@ namespace Guru
/// </summary>
private static void GetFCMTokenAsync()
{
if (!NetworkUtil.IsNetAvailable)
{
// 无网络直接重新获取
DelayGetFCMToken(_retryTokenDelay);
return;
}
Debug.Log($"{LOG_TAG}[SDK]--- Start GetTokenAsync ---");
FirebaseMessaging.GetTokenAsync().ContinueWithOnMainThread(task =>
{