From 5b1097464d9e30474b0c31c723dcc859478d2d4b Mon Sep 17 00:00:00 2001 From: huyufei Date: Fri, 24 May 2024 14:48:53 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=B7=BB=E5=8A=A0=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E6=B6=88=E6=81=AF=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Code/SDK/GuruSDK.cs | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Runtime/Code/SDK/GuruSDK.cs b/Runtime/Code/SDK/GuruSDK.cs index 16a3dcc..f5fb4e6 100644 --- a/Runtime/Code/SDK/GuruSDK.cs +++ b/Runtime/Code/SDK/GuruSDK.cs @@ -721,6 +721,33 @@ namespace Guru #endregion - + #region 推送管理 + + private static int _messageRetry = 0; + public static void SetPushNotificationEnabled(bool enabled) + { + DeviceInfoUploadRequest request = new DeviceInfoUploadRequest() + .SetRetryTimes(1) + .SetSuccessCallBack(() => + { + _messageRetry = 0; + Debug.Log($"[SDK] --- Set Push Enabled: {enabled} success"); + }) + .SetFailCallBack(() => + { + double retryDelay = Math.Pow(2, _messageRetry); + _messageRetry++; + CoroutineHelper.Instance.StartDelayed((float)retryDelay, ()=> SetPushNotificationEnabled(enabled)); + }) as DeviceInfoUploadRequest; + + if (request != null) + { + request.SetPushEnabled(enabled); + request.Send(); + } + } + + + #endregion } } \ No newline at end of file