From b32d45cd60abf0f1018577262d987e879c999b2a Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 27 Jan 2018 15:04:45 -0800 Subject: [PATCH] Add isOpen property to MainWindowController. --- Evergreen/MainWindow/MainWindowController.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Evergreen/MainWindow/MainWindowController.swift b/Evergreen/MainWindow/MainWindowController.swift index 5a7959c84..cf0898bec 100644 --- a/Evergreen/MainWindow/MainWindowController.swift +++ b/Evergreen/MainWindow/MainWindowController.swift @@ -14,7 +14,11 @@ private let kWindowFrameKey = "MainWindow" class MainWindowController : NSWindowController, NSUserInterfaceValidations { - // MARK: NSWindowController + var isOpen: Bool { + return isWindowLoaded && window!.isVisible + } + + // MARK: NSWindowController private let windowAutosaveName = NSWindow.FrameAutosaveName(rawValue: kWindowFrameKey) private var unreadCount: Int = 0 { @@ -291,7 +295,7 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations { sidebarViewController?.gotoStarred(sender) } - + @IBAction func toolbarShowShareMenu(_ sender: Any?) { guard let selectedArticles = selectedArticles, !selectedArticles.isEmpty else {