From faab33ab2e0936fc76efc387d6c7275ee43ec9e6 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Sat, 9 May 2020 14:14:46 -0500 Subject: [PATCH] Save and toggle full screen state. Issue #2053 --- Mac/MainWindow/MainWindowController.swift | 4 ++++ Shared/UserInfoKey.swift | 1 + 2 files changed, 5 insertions(+) diff --git a/Mac/MainWindow/MainWindowController.swift b/Mac/MainWindow/MainWindowController.swift index 8e24bf155..01e7335c2 100644 --- a/Mac/MainWindow/MainWindowController.swift +++ b/Mac/MainWindow/MainWindowController.swift @@ -739,6 +739,7 @@ private extension MainWindowController { func savableState() -> [AnyHashable : Any] { var state = [AnyHashable : Any]() + state[UserInfoKey.windowFullScreenState] = window?.styleMask.contains(.fullScreen) ?? false saveSplitViewState(to: &state) sidebarViewController?.saveState(to: &state) timelineContainerViewController?.saveState(to: &state) @@ -746,6 +747,9 @@ private extension MainWindowController { } func restoreState(from state: [AnyHashable : Any]) { + if let fullScreen = state[UserInfoKey.windowFullScreenState] as? Bool, fullScreen { + window?.toggleFullScreen(self) + } restoreSplitViewState(from: state) sidebarViewController?.restoreState(from: state) timelineContainerViewController?.restoreState(from: state) diff --git a/Shared/UserInfoKey.swift b/Shared/UserInfoKey.swift index 31455b63e..dbd9900bb 100644 --- a/Shared/UserInfoKey.swift +++ b/Shared/UserInfoKey.swift @@ -16,6 +16,7 @@ struct UserInfoKey { static let feedIdentifier = "feedIdentifier" static let windowState = "windowState" + static let windowFullScreenState = "windowFullScreenState" static let containerExpandedWindowState = "containerExpandedWindowState" static let readFeedsFilterState = "readFeedsFilterState" static let readArticlesFilterState = "readArticlesFilterState"