update: 更新加快 Push Token 上报的时间

Signed-off-by: huyufei <yufei.hu@castbox.fm>
胡宇飞 2024-09-08 16:52:37 +08:00
parent cb929ef187
commit 4a77e9afb9
1 changed files with 9 additions and 8 deletions

View File

@ -12,7 +12,8 @@ namespace Guru
public static partial class FirebaseUtil
{
private static int _messageRetry = 5;
private static int _retryDeviceCount = 1;
private const int _retryTokenDelay = 2;
// public static bool? IsInitMessage;
private static bool _isAutoFetchFcmToken = true;
private static bool _isFetchOnce = false;
@ -45,12 +46,12 @@ namespace Guru
/// </summary>
private static void GetFCMTokenAsync()
{
Debug.Log($"[Firebase] --- Start GetTokenAsync ---");
Debug.Log($"[SDK][Firebase] --- Start GetTokenAsync ---");
FirebaseMessaging.GetTokenAsync().ContinueWithOnMainThread(task =>
{
if (!task.IsCompletedSuccessfully)
{
DelayGetFCMToken(10);
DelayGetFCMToken(_retryTokenDelay);
return;
}
@ -58,7 +59,7 @@ namespace Guru
if (string.IsNullOrEmpty(token)
&& string.IsNullOrEmpty(IPMConfig.IPM_PUSH_TOKEN))
{
DelayGetFCMToken(10);
DelayGetFCMToken(_retryTokenDelay);
return;
}
@ -117,8 +118,8 @@ namespace Guru
{
if (!NetworkUtil.IsNetAvailable)
{
double retryDelay = Math.Pow(2, _messageRetry);
_messageRetry++;
double retryDelay = Math.Pow(2, _retryDeviceCount);
_retryDeviceCount++;
CoroutineHelper.Instance.StartDelayed((float) retryDelay, UploadDeviceInfo);
}
else
@ -133,8 +134,8 @@ namespace Guru
.SetFailCallBack(() =>
{
Debug.Log($"{LOG_TAG} --- UploadDeviceInfo:failed");
double retryDelay = Math.Pow(2, _messageRetry);
_messageRetry++;
double retryDelay = Math.Pow(2, _retryDeviceCount);
_retryDeviceCount++;
CoroutineHelper.Instance.StartDelayed((float) retryDelay, UploadDeviceInfo);
}).Send();
}