Skip to content

Commit

Permalink
fix notifications permission request
Browse files Browse the repository at this point in the history
  • Loading branch information
osmanyildirim committed Feb 26, 2023
1 parent e9ecde5 commit 99ce00c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion OYPermission.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "OYPermission"
s.version = "1.0"
s.version = "1.0.1"
s.summary = "Swift SDK to help with Permission authorizations"

s.homepage = "https://github.com/osmanyildirim/OYPermission.git"
Expand Down
8 changes: 7 additions & 1 deletion Sources/Types/Notifications.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,14 @@ public final class Notifications: OYBaseRequestable {

let center = UNUserNotificationCenter.current()
center.requestAuthorization(options: [.badge, .alert, .sound]) { granted, error in
guard granted else {
closure?(false, error)
return
}

DispatchQueue.main.async {
closure?(granted, error)
UIApplication.shared.registerForRemoteNotifications()
closure?(granted, nil)
}
}
}
Expand Down

0 comments on commit 99ce00c

Please sign in to comment.