Skip to content

Commit 7ce2155

Browse files
authored
feat: add status property to permissions (#17)
1 parent 922d20a commit 7ce2155

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/AmplifyUtilsNotifications/AUNotificationPermissions.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,17 @@ public class AUNotificationPermissions {
2626

2727
/// Check if notifications are allowed
2828
public static var allowed: Bool {
29+
get async {
30+
await status == .authorized ? true : false
31+
}
32+
}
33+
34+
/// Check the notification permission status
35+
public static var status: UNAuthorizationStatus {
2936
get async {
3037
await withCheckedContinuation { continuation in
3138
UNUserNotificationCenter.current().getNotificationSettings { settings in
32-
continuation.resume(returning: settings.authorizationStatus == .authorized ? true : false)
39+
continuation.resume(returning: settings.authorizationStatus)
3340
}
3441
}
3542
}

0 commit comments

Comments
 (0)