update: 添加 iOS 标志位缓存, 请求时直接返回状态

Signed-off-by: huyufei <yufei.hu@castbox.fm>
main
胡宇飞 2024-06-21 16:46:42 +08:00
parent 80e38bf85d
commit 9e7e94ef36
1 changed files with 8 additions and 2 deletions

View File

@ -59,6 +59,14 @@ namespace Guru.Notification
public void RequestPermission(Action<string> callback = null)
{
if (!_initOnce) Init();
if (_notiStatus == STATUS_GRANTED || _notiStatus == STATUS_DENIDED)
{
Debug.Log($"[SDK][Noti][iOS] --- Already has Status: {_notiStatus}");
callback?.Invoke(_notiStatus); // 已获得授权, 直接返回结果
return;
}
#if UNITY_IOS
RequestIOSPermission(callback);
#endif
@ -70,10 +78,8 @@ namespace Guru.Notification
private void InitPlugins()
{
UpdateStatus();
}
/// <summary>
/// 更新状态
/// </summary>