parent
							
								
									34ae9e3f0b
								
							
						
					
					
						commit
						cfe81b5583
					
				|  | @ -18,7 +18,6 @@ namespace Guru.Notification | |||
|          | ||||
|         private bool _initOnce = false; | ||||
|         private string _notiStatus; | ||||
|         private bool _isPluginsInited = false; | ||||
| 
 | ||||
|         private string SavedNotiPermStatus | ||||
|         { | ||||
|  | @ -38,7 +37,6 @@ namespace Guru.Notification | |||
|             if (!string.IsNullOrEmpty(SavedNotiPermStatus)) | ||||
|             { | ||||
|                 _notiStatus = SavedNotiPermStatus; | ||||
|                 return; | ||||
|             } | ||||
| 
 | ||||
| #if UNITY_ANDROID | ||||
|  | @ -108,8 +106,6 @@ namespace Guru.Notification | |||
|         { | ||||
|             AndroidNotificationCenter.Initialize(); | ||||
|             Debug.Log($"[Noti][AND] --- Notification Service InitPlugins"); | ||||
| 
 | ||||
|             _isPluginsInited = true; | ||||
|              | ||||
|             UpdateNotiStatus(); | ||||
|         } | ||||
|  | @ -119,8 +115,7 @@ namespace Guru.Notification | |||
|         /// </summary> | ||||
|         private void UpdateNotiStatus() | ||||
|         { | ||||
|             if (!_isPluginsInited) return; | ||||
|              | ||||
|            | ||||
|             TryExecute(() => | ||||
|             { | ||||
|                 _permissionStatus = AndroidNotificationCenter.UserPermissionToPost; | ||||
|  | @ -148,12 +143,6 @@ namespace Guru.Notification | |||
|         private PermissionCallbacks _permissionCallbacks; | ||||
|         private void RequestAndroidPermission(Action<string> callback = null) | ||||
|         { | ||||
|             if (!_isPluginsInited) | ||||
|             { | ||||
|                 callback?.Invoke(_notiStatus); | ||||
|                 return; | ||||
|             } | ||||
|              | ||||
|             UpdateNotiStatus(); | ||||
| 
 | ||||
|             if (_notiStatus == STATUS_GRANTED) | ||||
|  | @ -176,6 +165,14 @@ namespace Guru.Notification | |||
|                 else | ||||
|                 { | ||||
|                     // SDK 33 以上,请求弹窗 | ||||
|                      | ||||
|                     bool hasPermission = Permission.HasUserAuthorizedPermission(PERMISSION_POST_NOTIFICATION); | ||||
|                     if (hasPermission) | ||||
|                     { | ||||
|                         SetGrantStatus(STATUS_GRANTED); | ||||
|                         callback?.Invoke(STATUS_GRANTED); | ||||
|                         return; | ||||
|                     } | ||||
|                     Debug.Log($"[SDK][Noti] --- #4 SDK {sdkInt} :: Ask Post Permission"); | ||||
|                     Permission.RequestUserPermission(PERMISSION_POST_NOTIFICATION, SetupPermissionCallbacks()); | ||||
|                 } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue