File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -36,11 +36,12 @@ typedef void (^OSNotificationWillShowInForegroundBlock)(OSNotification * _Nonnul
3636typedef void (^OSNotificationOpenedBlock)(OSNotificationOpenedResult * _Nonnull result);
3737
3838/* *
39- Public API.
39+ Public API for the Notifications namespace .
4040 */
4141@protocol OSNotifications <NSObject >
4242+ (BOOL )permission NS_REFINED_FOR_SWIFT;
4343+ (BOOL )canRequestPermission NS_REFINED_FOR_SWIFT;
44+ + (OSNotificationPermission)permissionNative NS_REFINED_FOR_SWIFT;
4445+ (void )setNotificationWillShowInForegroundHandler : (OSNotificationWillShowInForegroundBlock _Nullable)block ;
4546+ (void )setNotificationOpenedHandler : (OSNotificationOpenedBlock _Nullable)block ;
4647+ (void )requestPermission : (OSUserResponseBlock _Nullable )block ;
Original file line number Diff line number Diff line change @@ -232,6 +232,10 @@ + (BOOL)canRequestPermission {
232232 return !self.currentPermissionState .answeredPrompt ;
233233}
234234
235+ + (OSNotificationPermission)permissionNative {
236+ return self.currentPermissionState .status ;
237+ }
238+
235239+ (void )requestPermission : (OSUserResponseBlock)block {
236240 // return if the user has not granted privacy permissions
237241 if ([OSPrivacyConsentController shouldLogMissingPrivacyConsentErrorWithMethodName: @" requestPermission:" ])
Original file line number Diff line number Diff line change @@ -93,6 +93,10 @@ public extension OSNotifications {
9393 return __canRequestPermission ( )
9494 }
9595
96+ static var permissionNative : OSNotificationPermission {
97+ return __permissionNative ( )
98+ }
99+
96100 static func registerForProvisionalAuthorization( _ block: OSUserResponseBlock ? ) {
97101 return __register ( forProvisionalAuthorization: block)
98102 }
You can’t perform that action at this time.
0 commit comments