From 0ba38e4a3afbf0425b12c298a73ab102313cf03d Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 15 May 2023 21:17:26 -0400 Subject: [PATCH] Fix handoff to iPad/Mac modally presenting new screen rather than pushing nav --- Tusker/Screens/Main/MainSplitViewController.swift | 8 ++++++++ Tusker/Screens/Utilities/SplitNavigationController.swift | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Tusker/Screens/Main/MainSplitViewController.swift b/Tusker/Screens/Main/MainSplitViewController.swift index a2f51f76..60425db7 100644 --- a/Tusker/Screens/Main/MainSplitViewController.swift +++ b/Tusker/Screens/Main/MainSplitViewController.swift @@ -115,6 +115,14 @@ class MainSplitViewController: UISplitViewController { } } + override func show(_ vc: UIViewController, sender: Any?) { + if traitCollection.horizontalSizeClass == .regular { + secondaryNavController.show(vc, sender: sender) + } else { + super.show(vc, sender: sender) + } + } + @objc func handleSidebarCommandTimelines() { sidebar.select(item: .tab(.timelines), animated: false) select(item: .tab(.timelines)) diff --git a/Tusker/Screens/Utilities/SplitNavigationController.swift b/Tusker/Screens/Utilities/SplitNavigationController.swift index 0d2c0a19..1953bf31 100644 --- a/Tusker/Screens/Utilities/SplitNavigationController.swift +++ b/Tusker/Screens/Utilities/SplitNavigationController.swift @@ -305,9 +305,11 @@ private class SplitSecondaryNavigationController: EnhancedNavigationViewControll } override func pushViewController(_ viewController: UIViewController, animated: Bool) { - super.pushViewController(viewController, animated: animated) + if viewControllers.isEmpty { + configureSecondarySplitCloseButton(for: viewController) + } - configureSecondarySplitCloseButton(for: viewControllers.first!) + super.pushViewController(viewController, animated: animated) } private func configureSecondarySplitCloseButton(for viewController: UIViewController) {