From 575166f5b4b5de8b1675d55ec255de45c8fb168c Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 1 Jun 2024 10:56:55 -0700 Subject: [PATCH] Fix Cmd+1/etc. resetting navigation stacks Closes #491 --- Tusker/Screens/Main/MainSplitViewController.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Tusker/Screens/Main/MainSplitViewController.swift b/Tusker/Screens/Main/MainSplitViewController.swift index 004620b3..f356cc93 100644 --- a/Tusker/Screens/Main/MainSplitViewController.swift +++ b/Tusker/Screens/Main/MainSplitViewController.swift @@ -180,26 +180,41 @@ class MainSplitViewController: UISplitViewController { } @objc func handleSidebarCommandTimelines() { + if let previous = sidebar.selectedItem { + navigationStacks[previous] = secondaryNavController.viewControllers + } sidebar.select(item: .tab(.timelines), animated: false) select(item: .tab(.timelines)) } @objc func handleSidebarCommandNotifications() { + if let previous = sidebar.selectedItem { + navigationStacks[previous] = secondaryNavController.viewControllers + } sidebar.select(item: .tab(.notifications), animated: false) select(item: .tab(.notifications)) } @objc func handleSidebarCommandExplore() { + if let previous = sidebar.selectedItem { + navigationStacks[previous] = secondaryNavController.viewControllers + } sidebar.select(item: .tab(.explore), animated: false) select(item: .tab(.explore)) } @objc func handleSidebarCommandBookmarks() { + if let previous = sidebar.selectedItem { + navigationStacks[previous] = secondaryNavController.viewControllers + } sidebar.select(item: .bookmarks, animated: false) select(item: .bookmarks) } @objc func handleSidebarCommandMyProfile() { + if let previous = sidebar.selectedItem { + navigationStacks[previous] = secondaryNavController.viewControllers + } sidebar.select(item: .tab(.myProfile), animated: false) select(item: .tab(.myProfile)) }