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