update: 优化push token 上报逻辑

Signed-off-by: huyufei <yufei.hu@castbox.fm>
1.1.1
胡宇飞 2024-09-10 20:42:50 +08:00
parent 924165d72d
commit e88e9ea303
1 changed files with 31 additions and 12 deletions

View File

@ -70,21 +70,39 @@ namespace Guru
}
var token = task.Result;
if (string.IsNullOrEmpty(token)
&& string.IsNullOrEmpty(IPMConfig.IPM_PUSH_TOKEN))
{
// 拉取到了空值, 且无缓存值
DelayGetFCMToken(_retryTokenDelay);
return;
}
Debug.Log($"{LOG_TAG}[SDK] --- GetPushToken:{token}");
// 取到的值不为空
if (!string.IsNullOrEmpty(token))
{
IPMConfig.IPM_PUSH_TOKEN = token;
}
UploadDeviceInfo();
return;
}
DelayGetFCMToken(_retryTokenDelay);
// 缓存值不为空
if (!string.IsNullOrEmpty(IPMConfig.IPM_PUSH_TOKEN))
{
UploadDeviceInfo();
}
// if (string.IsNullOrEmpty(token)
// && string.IsNullOrEmpty(IPMConfig.IPM_PUSH_TOKEN))
// {
// // 拉取到了空值, 且无缓存值
// DelayGetFCMToken(_retryTokenDelay);
// return;
// }
//
//
// Debug.Log($"{LOG_TAG}[SDK] --- GetPushToken:{token}");
// if (!string.IsNullOrEmpty(token))
// {
// IPMConfig.IPM_PUSH_TOKEN = token;
// }
// UploadDeviceInfo();
});
}
@ -142,6 +160,7 @@ namespace Guru
Debug.Log($"{LOG_TAG} --- UploadDeviceInfo ---");
//延时重试
new DeviceInfoUploadRequest()
.SetRetryTimes(1)
.SetSuccessCallBack(() =>
{
Debug.Log($"{LOG_TAG} --- UploadDeviceInfo:Success");
@ -149,7 +168,7 @@ namespace Guru
.SetFailCallBack(() =>
{
Debug.Log($"{LOG_TAG} --- UploadDeviceInfo:failed");
double retryDelay = Math.Pow(2, Mathf.Min(_retryDeviceCount, 6));
double retryDelay = Math.Pow(2, _retryDeviceCount);
_retryDeviceCount++;
CoroutineHelper.Instance.StartDelayed((float) retryDelay, UploadDeviceInfo);
}).Send();