Fix bugs in automated routing on application launch

This commit is contained in:
Maurice Parker
2019-09-06 07:29:36 -05:00
parent 1e7ed5bf35
commit 9b17293f4e
2 changed files with 29 additions and 18 deletions

View File

@@ -259,7 +259,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
becomeFirstResponder()
coordinator.selectFeed(indexPath)
coordinator.selectFeed(indexPath, automated: false)
}
override func tableView(_ tableView: UITableView, targetIndexPathForMoveFromRowAt sourceIndexPath: IndexPath, toProposedIndexPath proposedDestinationIndexPath: IndexPath) -> IndexPath {
@@ -469,17 +469,20 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
func discloseFeed(_ feed: Feed, completion: (() -> Void)? = nil) {
guard let node = coordinator.rootNode.descendantNodeRepresentingObject(feed as AnyObject) else {
return
completion?()
return
}
if let indexPath = coordinator.indexPathFor(node) {
tableView.scrollToRow(at: indexPath, at: .middle, animated: true)
coordinator.selectFeed(indexPath)
completion?()
return
}
// It wasn't already visable, so expand its folder and try again
guard let parent = node.parent, let indexPath = coordinator.indexPathFor(parent) else {
completion?()
return
}