You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
import EventKit
|
|
|
|
|
|
|
|
|
|
|
|
enum EventKitAuthorization {
|
|
|
|
|
|
static func allowsRead(status: EKAuthorizationStatus) -> Bool {
|
|
|
|
|
|
switch status {
|
|
|
|
|
|
case .authorized, .fullAccess:
|
|
|
|
|
|
return true
|
|
|
|
|
|
case .writeOnly:
|
|
|
|
|
|
return false
|
|
|
|
|
|
case .notDetermined:
|
|
|
|
|
|
// Don’t prompt during node.invoke; prompts block the invoke and lead to timeouts.
|
|
|
|
|
|
return false
|
|
|
|
|
|
case .restricted, .denied:
|
|
|
|
|
|
return false
|
|
|
|
|
|
@unknown default:
|
|
|
|
|
|
return false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static func allowsWrite(status: EKAuthorizationStatus) -> Bool {
|
|
|
|
|
|
switch status {
|
|
|
|
|
|
case .authorized, .fullAccess, .writeOnly:
|
|
|
|
|
|
return true
|
|
|
|
|
|
case .notDetermined:
|
|
|
|
|
|
// Don’t prompt during node.invoke; prompts block the invoke and lead to timeouts.
|
|
|
|
|
|
return false
|
|
|
|
|
|
case .restricted, .denied:
|
|
|
|
|
|
return false
|
|
|
|
|
|
@unknown default:
|
|
|
|
|
|
return false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|