Skip to content

Commit

Permalink
checking status
Browse files Browse the repository at this point in the history
  • Loading branch information
kvyatkovskys committed Sep 11, 2023
1 parent fa5e7cc commit 2924898
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Sources/KVKCalendar/KVKCalendarView+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,18 @@ extension KVKCalendarView {
completion(access)
}
let status = EKEventStore.authorizationStatus(for: .event)
if #available(iOS 17.0, *) {
store.requestFullAccessToEvents { (access, error) in
proxyCompletion(access: access, status: status, error: error)
}
} else {
store.requestAccess(to: .event) { (access, error) in
proxyCompletion(access: access, status: status, error: error)
switch status {
case .fullAccess, .authorized:
completion(true)
default:
if #available(iOS 17.0, *) {
store.requestFullAccessToEvents { (access, error) in
proxyCompletion(access: access, status: status, error: error)
}
} else {
store.requestAccess(to: .event) { (access, error) in
proxyCompletion(access: access, status: status, error: error)
}
}
}
}
Expand Down

0 comments on commit 2924898

Please sign in to comment.