macOS: Simplify detecting the type of an Apple event
Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
parent
40b1f0bac8
commit
70d19691a7
|
@ -13,9 +13,5 @@ class LaunchedAtLoginDetector {
|
|||
}
|
||||
|
||||
private func isOpenEvent(_ event: NSAppleEventDescriptor) -> Bool {
|
||||
if let eventClassDescriptor = event.attributeDescriptor(forKeyword: keyEventClassAttr),
|
||||
let eventIdDescriptor = event.attributeDescriptor(forKeyword: keyEventIDAttr) {
|
||||
return eventClassDescriptor.typeCodeValue == kCoreEventClass && eventIdDescriptor.typeCodeValue == kAEOpenApplication
|
||||
}
|
||||
return false
|
||||
return event.eventClass == kCoreEventClass && event.eventID == kAEOpenApplication
|
||||
}
|
||||
|
|
|
@ -19,11 +19,7 @@ class MacAppStoreUpdateDetector {
|
|||
}
|
||||
|
||||
private func isQuitEvent(_ event: NSAppleEventDescriptor) -> Bool {
|
||||
if let eventClassDescriptor = event.attributeDescriptor(forKeyword: keyEventClassAttr),
|
||||
let eventIdDescriptor = event.attributeDescriptor(forKeyword: keyEventIDAttr) {
|
||||
return eventClassDescriptor.typeCodeValue == kCoreEventClass && eventIdDescriptor.typeCodeValue == kAEQuitApplication
|
||||
}
|
||||
return false
|
||||
return event.eventClass == kCoreEventClass && event.eventID == kAEQuitApplication
|
||||
}
|
||||
|
||||
private func getExecutablePath(from pid: pid_t) -> String? {
|
||||
|
|
Loading…
Reference in New Issue