update: 更新Status默认值获取

Signed-off-by: huyufei <yufei.hu@castbox.fm>
main
胡宇飞 2024-06-21 14:01:33 +08:00
parent eba48e4a75
commit 34ae9e3f0b
2 changed files with 8 additions and 2 deletions

View File

@ -12,7 +12,7 @@ namespace Guru.Notification
public const string FCM_DEFAULT_CHANNEL_ID = "fcm_default_channel"; public const string FCM_DEFAULT_CHANNEL_ID = "fcm_default_channel";
private const string STATUS_GRANTED = "granted"; private const string STATUS_GRANTED = "granted";
private const string STATUS_DENIDED = "denied"; private const string STATUS_DENIDED = "denied";
private const string STATUS_NOT_DETERMINED = "not_determined"; // private const string STATUS_NOT_DETERMINED = "not_determined";
private const int REQUEST_PERMISSION_SDK_VERSION = 33; private const int REQUEST_PERMISSION_SDK_VERSION = 33;
private const string PERMISSION_POST_NOTIFICATION = "android.permission.POST_NOTIFICATIONS"; private const string PERMISSION_POST_NOTIFICATION = "android.permission.POST_NOTIFICATIONS";

View File

@ -77,6 +77,7 @@ namespace Guru.Notification
Agent.RequestPermission(callback); Agent.RequestPermission(callback);
return; return;
} }
Debug.LogError($"[SDK][Noti] --- Agent is missing, return default status: {DEFAULT_USER_STATUS}");
callback?.Invoke(DEFAULT_USER_STATUS); callback?.Invoke(DEFAULT_USER_STATUS);
} }
@ -87,7 +88,12 @@ namespace Guru.Notification
public static string GetStatus() public static string GetStatus()
{ {
return Agent?.GetStatus() ?? DEFAULT_USER_STATUS; if(!_initOnce) Initialize();
if(Agent != null) return Agent.GetStatus();
Debug.LogError($"[SDK][Noti] --- Agent is missing, return default status: {DEFAULT_USER_STATUS}");
return DEFAULT_USER_STATUS;
} }
#endregion #endregion