Convert parameter usages of automated to animated

This commit is contained in:
Maurice Parker 2019-10-09 21:24:56 -05:00
parent d80b83eaf3
commit ba8d1dfa83
3 changed files with 15 additions and 17 deletions

View File

@ -277,7 +277,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
becomeFirstResponder() becomeFirstResponder()
coordinator.selectFeed(indexPath, automated: false) coordinator.selectFeed(indexPath, animated: true)
} }
override func tableView(_ tableView: UITableView, targetIndexPathForMoveFromRowAt sourceIndexPath: IndexPath, toProposedIndexPath proposedDestinationIndexPath: IndexPath) -> IndexPath { override func tableView(_ tableView: UITableView, targetIndexPathForMoveFromRowAt sourceIndexPath: IndexPath, toProposedIndexPath proposedDestinationIndexPath: IndexPath) -> IndexPath {

View File

@ -147,13 +147,13 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
applyChanges(animate: animate) applyChanges(animate: animate)
} }
func updateArticleSelection(animate: Bool) { func updateArticleSelection(animated: Bool) {
if let article = coordinator.currentArticle, let indexPath = dataSource.indexPath(for: article) { if let article = coordinator.currentArticle, let indexPath = dataSource.indexPath(for: article) {
if tableView.indexPathForSelectedRow != indexPath { if tableView.indexPathForSelectedRow != indexPath {
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: true, deselect: coordinator.isRootSplitCollapsed) tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: true, deselect: coordinator.isRootSplitCollapsed)
} }
} else { } else {
tableView.selectRow(at: nil, animated: animate, scrollPosition: .none) tableView.selectRow(at: nil, animated: animated, scrollPosition: .none)
} }
updateUI() updateUI()
@ -293,7 +293,7 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
becomeFirstResponder() becomeFirstResponder()
let article = dataSource.itemIdentifier(for: indexPath) let article = dataSource.itemIdentifier(for: indexPath)
coordinator.selectArticle(article, automated: false) coordinator.selectArticle(article, animated: true)
} }
// MARK: Notifications // MARK: Notifications

View File

@ -513,7 +513,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
return indexPathFor(node) return indexPathFor(node)
} }
func selectFeed(_ indexPath: IndexPath?, automated: Bool = true) { func selectFeed(_ indexPath: IndexPath?, animated: Bool = false) {
guard indexPath != currentFeedIndexPath else { return } guard indexPath != currentFeedIndexPath else { return }
selectArticle(nil) selectArticle(nil)
@ -524,12 +524,12 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
if let ip = indexPath, let node = nodeFor(ip), let fetcher = node.representedObject as? ArticleFetcher { if let ip = indexPath, let node = nodeFor(ip), let fetcher = node.representedObject as? ArticleFetcher {
timelineFetcher = fetcher timelineFetcher = fetcher
updateSelectingActivity(with: node) updateSelectingActivity(with: node)
installTimelineControllerIfNecessary(animated: !automated) installTimelineControllerIfNecessary(animated: animated)
} else { } else {
timelineFetcher = nil timelineFetcher = nil
activityManager.invalidateSelecting() activityManager.invalidateSelecting()
if rootSplitViewController.isCollapsed && navControllerForTimeline().viewControllers.last is MasterTimelineViewController { if rootSplitViewController.isCollapsed && navControllerForTimeline().viewControllers.last is MasterTimelineViewController {
navControllerForTimeline().popViewController(animated: !automated) navControllerForTimeline().popViewController(animated: animated)
} }
} }
@ -565,7 +565,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
} }
} }
func selectArticle(_ article: Article?, automated: Bool = true) { func selectArticle(_ article: Article?, animated: Bool = false) {
guard article != currentArticle else { return } guard article != currentArticle else { return }
stopArticleExtractor() stopArticleExtractor()
@ -575,12 +575,12 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
if article == nil { if article == nil {
if rootSplitViewController.isCollapsed { if rootSplitViewController.isCollapsed {
if masterNavigationController.children.last is ArticleViewController { if masterNavigationController.children.last is ArticleViewController {
masterNavigationController.popViewController(animated: !automated) masterNavigationController.popViewController(animated: animated)
} }
} else { } else {
articleViewController?.state = .noSelection articleViewController?.state = .noSelection
} }
masterTimelineViewController?.updateArticleSelection(animate: !automated) masterTimelineViewController?.updateArticleSelection(animated: animated)
return return
} }
@ -588,14 +588,12 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
if articleViewController == nil { if articleViewController == nil {
currentArticleViewController = UIStoryboard.main.instantiateController(ofType: ArticleViewController.self) currentArticleViewController = UIStoryboard.main.instantiateController(ofType: ArticleViewController.self)
currentArticleViewController.coordinator = self currentArticleViewController.coordinator = self
installArticleController(currentArticleViewController, automated: automated) installArticleController(currentArticleViewController, animated: animated)
} else { } else {
currentArticleViewController = articleViewController! currentArticleViewController = articleViewController!
} }
if automated { masterTimelineViewController?.updateArticleSelection(animated: animated)
masterTimelineViewController?.updateArticleSelection(animate: false)
}
if article!.feed?.isArticleExtractorAlwaysOn ?? false { if article!.feed?.isArticleExtractorAlwaysOn ?? false {
startArticleExtractorForCurrentLink() startArticleExtractorForCurrentLink()
@ -1200,7 +1198,7 @@ private extension SceneCoordinator {
for i in startingRow..<articles.count { for i in startingRow..<articles.count {
let article = articles[i] let article = articles[i]
if !article.status.read { if !article.status.read {
selectArticle(article, automated: false) selectArticle(article, animated: true)
return true return true
} }
} }
@ -1454,7 +1452,7 @@ private extension SceneCoordinator {
} }
} }
func installArticleController(_ articleController: UIViewController, automated: Bool) { func installArticleController(_ articleController: UIViewController, animated: Bool) {
isArticleViewControllerPending = true isArticleViewControllerPending = true
@ -1463,7 +1461,7 @@ private extension SceneCoordinator {
subSplit.showDetailViewController(controller, sender: self) subSplit.showDetailViewController(controller, sender: self)
} else if rootSplitViewController.isCollapsed { } else if rootSplitViewController.isCollapsed {
let controller = addNavControllerIfNecessary(articleController, showButton: false) let controller = addNavControllerIfNecessary(articleController, showButton: false)
masterNavigationController.pushViewController(controller, animated: !automated) masterNavigationController.pushViewController(controller, animated: animated)
} else { } else {
let controller = addNavControllerIfNecessary(articleController, showButton: true) let controller = addNavControllerIfNecessary(articleController, showButton: true)
rootSplitViewController.showDetailViewController(controller, sender: self) rootSplitViewController.showDetailViewController(controller, sender: self)