From e88e9ea303938167cc7889f5273fe8ea9cc53909 Mon Sep 17 00:00:00 2001 From: huyufei Date: Tue, 10 Sep 2024 20:42:50 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E4=BC=98=E5=8C=96push=20token=20?= =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyufei --- .../Runtime/Firebase/FirebaseUtil.Message.cs | 43 +++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.Message.cs b/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.Message.cs index 13873f1..28a6dde 100644 --- a/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.Message.cs +++ b/Runtime/GuruCore/Runtime/Firebase/FirebaseUtil.Message.cs @@ -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; } - UploadDeviceInfo(); + + 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();