Show list edit screen immediately upon creation

This commit is contained in:
Shadowfacts 2019-12-19 21:37:47 -05:00
parent ae6a0513e4
commit f92a2acc97
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 20 additions and 4 deletions

View File

@ -173,7 +173,9 @@ class ExploreViewController: EnhancedTableViewController {
self.reloadLists() self.reloadLists()
DispatchQueue.main.async { DispatchQueue.main.async {
self.show(ListTimelineViewController(for: list), sender: nil) let listTimelineController = ListTimelineViewController(for: list)
listTimelineController.presentEditOnAppear = true
self.show(listTimelineController, sender: nil)
} }
} }
})) }))

View File

@ -13,6 +13,8 @@ class ListTimelineViewController: TimelineTableViewController {
let list: List let list: List
var presentEditOnAppear = false
init(for list: List) { init(for list: List) {
self.list = list self.list = list
@ -31,13 +33,25 @@ class ListTimelineViewController: TimelineTableViewController {
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .edit, target: self, action: #selector(editButtonPressed)) 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) let editListAccountsController = EditListAccountsViewController(list: list)
editListAccountsController.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(doneButtonPressed)) editListAccountsController.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(doneButtonPressed))
let navController = UINavigationController(rootViewController: editListAccountsController) let navController = UINavigationController(rootViewController: editListAccountsController)
present(navController, animated: true) present(navController, animated: animated)
}
// MARK: - Interaction
@objc func editButtonPressed() {
presentEdit(animated: true)
} }
@objc func doneButtonPressed() { @objc func doneButtonPressed() {