From 9256a6858a3ee2ab09448193ab07030ae0cec8d7 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Thu, 6 Aug 2026 13:05:39 -0700 Subject: [PATCH] Stop overriding UISplitViewController.show(_:) which causes issues with tapping timeline rows (and other issues). --- iOS/Article/ArticleViewController.swift | 2 +- .../MainTimelineModernViewController.swift | 2 +- iOS/RootSplitViewController.swift | 22 +++++++++---------- iOS/SceneCoordinator.swift | 20 ++++++++--------- 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/iOS/Article/ArticleViewController.swift b/iOS/Article/ArticleViewController.swift index c6ec82d65..0a7b8dc39 100644 --- a/iOS/Article/ArticleViewController.swift +++ b/iOS/Article/ArticleViewController.swift @@ -222,7 +222,7 @@ final class ArticleViewController: UIViewController { } override func viewDidAppear(_ animated: Bool) { - super.viewDidAppear(true) + super.viewDidAppear(animated) if #available(iOS 26, *) { navigationController?.navigationBar.topItem?.subtitle = nil } diff --git a/iOS/MainTimeline/MainTimelineModernViewController.swift b/iOS/MainTimeline/MainTimelineModernViewController.swift index 1322d3818..abcf1a5d6 100644 --- a/iOS/MainTimeline/MainTimelineModernViewController.swift +++ b/iOS/MainTimeline/MainTimelineModernViewController.swift @@ -234,7 +234,7 @@ final class MainTimelineModernViewController: UIViewController, UndoableCommandR override func viewDidAppear(_ animated: Bool) { Self.logger.debug("MainTimelineModernViewController: viewDidAppear") - super.viewDidAppear(true) + super.viewDidAppear(animated) isTimelineViewControllerPending = false if navigationController?.navigationBar.alpha == 0 { UIView.animate(withDuration: 0.5) { diff --git a/iOS/RootSplitViewController.swift b/iOS/RootSplitViewController.swift index 6b05f7a44..7763a7832 100644 --- a/iOS/RootSplitViewController.swift +++ b/iOS/RootSplitViewController.swift @@ -22,22 +22,20 @@ final class RootSplitViewController: UISplitViewController { } override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) coordinator.resetFocus() } - override func show(_ column: UISplitViewController.Column) { - show(column, bypassDisplayModeRestriction: false) - } - - /// Pass `bypassDisplayModeRestriction: true` for user-initiated keyboard navigation, so it can + /// Show a column for programmatic navigation. + /// Pass `bypassDisplayModeRestriction: true` for user-initiated navigation, so it can /// reveal a column the display-mode suppression below would otherwise keep hidden. /// - func show(_ column: UISplitViewController.Column, bypassDisplayModeRestriction: Bool) { + func showColumn(_ column: UISplitViewController.Column, bypassDisplayModeRestriction: Bool = false) { guard !coordinator.isNavigationDisabled else { return } /// Always show the column on iPhone if UIDevice.current.userInterfaceIdiom == .phone { - super.show(column) + show(column) return } @@ -46,18 +44,18 @@ final class RootSplitViewController: UISplitViewController { /// restoration of the feeds and timeline display modes. if !bypassDisplayModeRestriction { - /// Don't show primary when the preferred display mode is timeline + article or article only. - if column == .primary && (preferredDisplayMode == .oneBesideSecondary || preferredDisplayMode == .secondaryOnly) { + /// Don't show primary when the display mode is timeline + article or article only. + if column == .primary && (displayMode == .oneBesideSecondary || displayMode == .secondaryOnly) { return } - /// Don't show the timeline when the preferred display mode is article only. - if column == .supplementary && preferredDisplayMode == .secondaryOnly { + /// Don't show the timeline when the display mode is article only. + if column == .supplementary && displayMode == .secondaryOnly { return } } - super.show(column) + show(column) } // MARK: Keyboard Shortcuts diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 9f7348796..5ae3361c9 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -502,7 +502,7 @@ struct SidebarItemNode: Hashable, Sendable { func showSearch() { selectSidebarItem(indexPath: nil) { - self.rootSplitViewController.show(.supplementary) + self.rootSplitViewController.showColumn(.supplementary) DispatchQueue.main.asyncAfter(deadline: .now()) { self.mainTimelineViewController!.showSearchAll() } @@ -1008,7 +1008,7 @@ struct SidebarItemNode: Hashable, Sendable { guard tappedFeed !== timelineFeed as AnyObject? else { // Same feed — just make sure the timeline is showing. if indexPath != nil { - rootSplitViewController.show(.supplementary) + rootSplitViewController.showColumn(.supplementary) } completion?() return @@ -1024,7 +1024,7 @@ struct SidebarItemNode: Hashable, Sendable { if let ip = indexPath, let node = nodeFor(ip), let sidebarItem = node.representedObject as? SidebarItem { self.activityManager.selecting(sidebarItem: sidebarItem) - self.rootSplitViewController.show(.supplementary) + self.rootSplitViewController.showColumn(.supplementary) setTimelineFeed(sidebarItem, animated: false) { if self.isReadFeedsFiltered { self.rebuildBackingStores() @@ -1040,7 +1040,7 @@ struct SidebarItemNode: Hashable, Sendable { self.rebuildBackingStores() } self.activityManager.invalidateSelecting() - self.rootSplitViewController.show(.primary) + self.rootSplitViewController.showColumn(.primary) AppDefaults.shared.selectedSidebarItem = nil completion?() } @@ -1092,12 +1092,12 @@ struct SidebarItemNode: Hashable, Sendable { if article == nil { articleViewController?.article = nil - rootSplitViewController.show(.supplementary) + rootSplitViewController.showColumn(.supplementary) mainTimelineViewController?.updateArticleSelection(animations: animations) return } - rootSplitViewController.show(.secondary) + rootSplitViewController.showColumn(.secondary) mainTimelineViewController?.didPushArticleViewController = true // Mark article as read before navigating to it, so the read status does not flash unread/read on display @@ -1273,7 +1273,7 @@ struct SidebarItemNode: Hashable, Sendable { func markAsReadAndShowSidebar(_ articlesToMark: [Article], completion: (() -> Void)? = nil) { markAllAsRead(articlesToMark) { self.rootSplitViewController.preferredDisplayMode = .twoBesideSecondary - self.rootSplitViewController.show(.primary) + self.rootSplitViewController.showColumn(.primary, bypassDisplayModeRestriction: true) completion?() } } @@ -1572,7 +1572,7 @@ struct SidebarItemNode: Hashable, Sendable { func navigateToTimeline() { // Only auto-select the first article in three-pane mode, where it populates the // detail pane without hiding the timeline. - let displayMode = rootSplitViewController.preferredDisplayMode + let displayMode = rootSplitViewController.displayMode let isThreePane = !isRootSplitCollapsed && displayMode != .oneBesideSecondary && displayMode != .secondaryOnly if isThreePane && currentArticle == nil && articles.count > 0 { selectArticle(articles[0]) @@ -1728,7 +1728,7 @@ private extension SceneCoordinator { if isRootSplitCollapsed { revealColumnInCollapsedMode(column, thenFocus: focus) } else { - rootSplitViewController.show(column, bypassDisplayModeRestriction: true) + rootSplitViewController.showColumn(column, bypassDisplayModeRestriction: true) // Defer focus so becomeFirstResponder targets the revealed column, not the outgoing one. Task { @MainActor in focus() @@ -1767,7 +1767,7 @@ private extension SceneCoordinator { focusWhenTransitionCompletes(in: navController, thenFocus: focus) } else { // Forward navigation — push the destination column onto the stack. - rootSplitViewController.show(column) + rootSplitViewController.showColumn(column, bypassDisplayModeRestriction: true) focusWhenTransitionCompletes(in: navController, thenFocus: focus) } }