Fix split view expand breaking when transferring trending statuses/hashtags/links VCs

This commit is contained in:
Shadowfacts 2023-01-22 14:01:44 -05:00
parent a47b9c0c75
commit e8b7446117
1 changed files with 5 additions and 6 deletions

View File

@ -277,6 +277,7 @@ extension MainSplitViewController: UISplitViewControllerDelegate {
case .explore: case .explore:
// The Explore tab is more complicated since it encapsulates a bunch of screens which have top-level sidebar items. // The Explore tab is more complicated since it encapsulates a bunch of screens which have top-level sidebar items.
var skipFirst = 1
var toPrepend: UIViewController? = nil var toPrepend: UIViewController? = nil
// If the tab navigation stack has only one item or the search controller is active, it corresponds to the Search item // If the tab navigation stack has only one item or the search controller is active, it corresponds to the Search item
@ -308,19 +309,17 @@ extension MainSplitViewController: UISplitViewControllerDelegate {
exploreItem = .savedHashtag(hashtagVC.hashtag) exploreItem = .savedHashtag(hashtagVC.hashtag)
case let instanceVC as InstanceTimelineViewController: case let instanceVC as InstanceTimelineViewController:
exploreItem = .savedInstance(instanceVC.instanceURL) exploreItem = .savedInstance(instanceVC.instanceURL)
case is TrendingStatusesViewController: case is TrendingStatusesViewController, is TrendingHashtagsViewController, is TrendingLinksViewController:
exploreItem = .explore
case is TrendingHashtagsViewController:
exploreItem = .explore
case is TrendingLinksViewController:
exploreItem = .explore exploreItem = .explore
// these three VCs are part of the root SearchViewController, so we don't need to transfer them
skipFirst = 2
case is ProfileDirectoryViewController: case is ProfileDirectoryViewController:
exploreItem = .profileDirectory exploreItem = .profileDirectory
default: default:
fatalError("unhandled second-level explore screen: \(tabNavigationStack[1])") fatalError("unhandled second-level explore screen: \(tabNavigationStack[1])")
} }
} }
transferNavigationStack(from: tabNavController, to: exploreItem!, skipFirst: 1, prepend: toPrepend) transferNavigationStack(from: tabNavController, to: exploreItem!, skipFirst: skipFirst, prepend: toPrepend)
case .compose: case .compose:
// The compose tab can't be activated, this is unreachable. // The compose tab can't be activated, this is unreachable.