From f92a2acc97c1fdacb314a01fdd5e48a269a442aa Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 19 Dec 2019 21:37:47 -0500 Subject: [PATCH] Show list edit screen immediately upon creation --- .../Explore/ExploreViewController.swift | 4 +++- .../Lists/ListTimelineViewController.swift | 20 ++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Tusker/Screens/Explore/ExploreViewController.swift b/Tusker/Screens/Explore/ExploreViewController.swift index 6a5d8607..4b3488bf 100644 --- a/Tusker/Screens/Explore/ExploreViewController.swift +++ b/Tusker/Screens/Explore/ExploreViewController.swift @@ -173,7 +173,9 @@ class ExploreViewController: EnhancedTableViewController { self.reloadLists() DispatchQueue.main.async { - self.show(ListTimelineViewController(for: list), sender: nil) + let listTimelineController = ListTimelineViewController(for: list) + listTimelineController.presentEditOnAppear = true + self.show(listTimelineController, sender: nil) } } })) diff --git a/Tusker/Screens/Lists/ListTimelineViewController.swift b/Tusker/Screens/Lists/ListTimelineViewController.swift index e1e5a9f6..664d65ee 100644 --- a/Tusker/Screens/Lists/ListTimelineViewController.swift +++ b/Tusker/Screens/Lists/ListTimelineViewController.swift @@ -13,6 +13,8 @@ class ListTimelineViewController: TimelineTableViewController { let list: List + var presentEditOnAppear = false + init(for list: List) { self.list = list @@ -31,13 +33,25 @@ class ListTimelineViewController: TimelineTableViewController { navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .edit, target: self, action: #selector(editButtonPressed)) } - // MARK: - Interaction + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + + if presentEditOnAppear { + presentEdit(animated: animated) + } + } - @objc func editButtonPressed() { + func presentEdit(animated: Bool) { let editListAccountsController = EditListAccountsViewController(list: list) editListAccountsController.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(doneButtonPressed)) let navController = UINavigationController(rootViewController: editListAccountsController) - present(navController, animated: true) + present(navController, animated: animated) + } + + // MARK: - Interaction + + @objc func editButtonPressed() { + presentEdit(animated: true) } @objc func doneButtonPressed() {