Fix creating list on iPad not showing Edit List screen immediately

This commit is contained in:
Shadowfacts 2022-11-30 16:33:39 -05:00
parent b515664db3
commit e005b70071
3 changed files with 13 additions and 2 deletions

View File

@ -48,7 +48,7 @@ class ListTimelineViewController: TimelineViewController {
super.viewDidAppear(animated) super.viewDidAppear(animated)
if presentEditOnAppear { if presentEditOnAppear {
presentEdit(animated: animated) presentEdit(animated: true)
presentEditOnAppear = false presentEditOnAppear = false
} }
} }

View File

@ -13,6 +13,7 @@ import Combine
protocol MainSidebarViewControllerDelegate: AnyObject { protocol MainSidebarViewControllerDelegate: AnyObject {
func sidebarRequestPresentCompose(_ sidebarViewController: MainSidebarViewController) func sidebarRequestPresentCompose(_ sidebarViewController: MainSidebarViewController)
func sidebar(_ sidebarViewController: MainSidebarViewController, didSelectItem item: MainSidebarViewController.Item) func sidebar(_ sidebarViewController: MainSidebarViewController, didSelectItem item: MainSidebarViewController.Item)
func sidebar(_ sidebarViewController: MainSidebarViewController, showViewController viewController: UIViewController)
} }
class MainSidebarViewController: UIViewController { class MainSidebarViewController: UIViewController {
@ -281,7 +282,10 @@ class MainSidebarViewController: UIViewController {
private func showAddList() { private func showAddList() {
let service = CreateListService(mastodonController: mastodonController, present: { self.present($0, animated: true let service = CreateListService(mastodonController: mastodonController, present: { self.present($0, animated: true
) }) { list in ) }) { list in
self.sidebarDelegate?.sidebar(self, didSelectItem: .list(list)) self.select(item: .list(list), animated: false)
let list = ListTimelineViewController(for: list, mastodonController: self.mastodonController)
list.presentEditOnAppear = true
self.sidebarDelegate?.sidebar(self, showViewController: list)
} }
service.run() service.run()
} }

View File

@ -358,6 +358,13 @@ extension MainSplitViewController: MainSidebarViewControllerDelegate {
} }
select(item: item) select(item: item)
} }
func sidebar(_ sidebarViewController: MainSidebarViewController, showViewController viewController: UIViewController) {
if let previous = sidebar.previouslySelectedItem {
navigationStacks[previous] = secondaryNavController.viewControllers
}
secondaryNavController.viewControllers = [viewController]
}
} }
fileprivate extension MainSidebarViewController.Item { fileprivate extension MainSidebarViewController.Item {