diff --git a/WireGuard/WireGuard/UI/macOS/LaunchedAtLoginDetector.swift b/WireGuard/WireGuard/UI/macOS/LaunchedAtLoginDetector.swift index 53a4dae..185aced 100644 --- a/WireGuard/WireGuard/UI/macOS/LaunchedAtLoginDetector.swift +++ b/WireGuard/WireGuard/UI/macOS/LaunchedAtLoginDetector.swift @@ -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 } diff --git a/WireGuard/WireGuard/UI/macOS/MacAppStoreUpdateDetector.swift b/WireGuard/WireGuard/UI/macOS/MacAppStoreUpdateDetector.swift index 7fbb011..68608ca 100644 --- a/WireGuard/WireGuard/UI/macOS/MacAppStoreUpdateDetector.swift +++ b/WireGuard/WireGuard/UI/macOS/MacAppStoreUpdateDetector.swift @@ -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? {