forked from shadowfacts/Tusker
Fix crash on split VC collapse/expand while in explore tab
Also fix iPad explore VC resetting when leaving/reopening the app Closes #351
This commit is contained in:
parent
37847a2f9f
commit
597dd56032
|
@ -285,7 +285,9 @@ extension MainSplitViewController: UISplitViewControllerDelegate {
|
|||
// Search screen has special considerations, all others can be transferred directly.
|
||||
if tabNavigationStack.count == 1 || ((tabNavigationStack.first as? ExploreViewController)?.searchController?.isActive ?? false) {
|
||||
exploreItem = .explore
|
||||
let searchVC = SearchViewController(mastodonController: mastodonController)
|
||||
// reuse the existing VC, if there is one
|
||||
let searchVC = getOrCreateNavigationStack(item: .explore).first! as! SearchViewController
|
||||
// load the view so that the search controller is accessible
|
||||
searchVC.loadViewIfNeeded()
|
||||
let explore = tabNavigationStack.first as! ExploreViewController
|
||||
if let exploreSearchControler = explore.searchController,
|
||||
|
@ -316,7 +318,10 @@ extension MainSplitViewController: UISplitViewControllerDelegate {
|
|||
case is ProfileDirectoryViewController:
|
||||
exploreItem = .profileDirectory
|
||||
default:
|
||||
fatalError("unhandled second-level explore screen: \(tabNavigationStack[1])")
|
||||
// transfer the navigation stack prepending, the existing explore VC
|
||||
// if there was other stuff on the explore stack, it will get discarded
|
||||
toPrepend = getOrCreateNavigationStack(item: .explore).first!
|
||||
exploreItem = .explore
|
||||
}
|
||||
}
|
||||
transferNavigationStack(from: tabNavController, to: exploreItem!, skipFirst: skipFirst, prepend: toPrepend)
|
||||
|
|
Loading…
Reference in New Issue