Save and toggle full screen state. Issue #2053

This commit is contained in:
Maurice Parker 2020-05-09 14:14:46 -05:00
parent c173d086a0
commit faab33ab2e
2 changed files with 5 additions and 0 deletions

View File

@ -739,6 +739,7 @@ private extension MainWindowController {
func savableState() -> [AnyHashable : Any] { func savableState() -> [AnyHashable : Any] {
var state = [AnyHashable : Any]() var state = [AnyHashable : Any]()
state[UserInfoKey.windowFullScreenState] = window?.styleMask.contains(.fullScreen) ?? false
saveSplitViewState(to: &state) saveSplitViewState(to: &state)
sidebarViewController?.saveState(to: &state) sidebarViewController?.saveState(to: &state)
timelineContainerViewController?.saveState(to: &state) timelineContainerViewController?.saveState(to: &state)
@ -746,6 +747,9 @@ private extension MainWindowController {
} }
func restoreState(from state: [AnyHashable : Any]) { func restoreState(from state: [AnyHashable : Any]) {
if let fullScreen = state[UserInfoKey.windowFullScreenState] as? Bool, fullScreen {
window?.toggleFullScreen(self)
}
restoreSplitViewState(from: state) restoreSplitViewState(from: state)
sidebarViewController?.restoreState(from: state) sidebarViewController?.restoreState(from: state)
timelineContainerViewController?.restoreState(from: state) timelineContainerViewController?.restoreState(from: state)

View File

@ -16,6 +16,7 @@ struct UserInfoKey {
static let feedIdentifier = "feedIdentifier" static let feedIdentifier = "feedIdentifier"
static let windowState = "windowState" static let windowState = "windowState"
static let windowFullScreenState = "windowFullScreenState"
static let containerExpandedWindowState = "containerExpandedWindowState" static let containerExpandedWindowState = "containerExpandedWindowState"
static let readFeedsFilterState = "readFeedsFilterState" static let readFeedsFilterState = "readFeedsFilterState"
static let readArticlesFilterState = "readArticlesFilterState" static let readArticlesFilterState = "readArticlesFilterState"