Animate Select Feed context menu result. Issue #1220
This commit is contained in:
parent
ebed17ed2f
commit
b78b996e88
|
@ -129,7 +129,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
|||
guard let feed = notification.userInfo?[UserInfoKey.feed] as? Feed else {
|
||||
return
|
||||
}
|
||||
discloseFeed(feed)
|
||||
discloseFeed(feed, animated: true)
|
||||
}
|
||||
|
||||
@objc func contentSizeCategoryDidChange(_ note: Notification) {
|
||||
|
@ -481,7 +481,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
|||
}
|
||||
}
|
||||
|
||||
func discloseFeed(_ feed: Feed, completion: (() -> Void)? = nil) {
|
||||
func discloseFeed(_ feed: Feed, animated: Bool, completion: (() -> Void)? = nil) {
|
||||
|
||||
guard let node = coordinator.rootNode.descendantNodeRepresentingObject(feed as AnyObject) else {
|
||||
completion?()
|
||||
|
@ -490,7 +490,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
|||
|
||||
if let indexPath = dataSource.indexPath(for: node) {
|
||||
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: true)
|
||||
coordinator.selectFeed(indexPath)
|
||||
coordinator.selectFeed(indexPath, animated: animated)
|
||||
completion?()
|
||||
return
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
|||
|
||||
self.applyChanges(animate: true, adjustScroll: true) { [weak self] in
|
||||
if let indexPath = self?.dataSource.indexPath(for: node) {
|
||||
self?.coordinator.selectFeed(indexPath)
|
||||
self?.coordinator.selectFeed(indexPath, animated: animated)
|
||||
completion?()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -586,7 +586,8 @@ private extension MasterTimelineViewController {
|
|||
|
||||
let title = NSLocalizedString("Select Feed", comment: "Select Feed")
|
||||
let action = UIAction(title: title, image: AppAssets.openInSidebarImage) { [weak self] action in
|
||||
self?.coordinator.discloseFeed(feed)
|
||||
self?.coordinator.selectFeed(nil, animated: true)
|
||||
self?.coordinator.discloseFeed(feed, animated: true)
|
||||
}
|
||||
return action
|
||||
}
|
||||
|
@ -596,7 +597,8 @@ private extension MasterTimelineViewController {
|
|||
|
||||
let title = NSLocalizedString("Select Feed", comment: "Select Feed")
|
||||
let action = UIAlertAction(title: title, style: .default) { [weak self] action in
|
||||
self?.coordinator.discloseFeed(feed)
|
||||
self?.coordinator.selectFeed(nil, animated: true)
|
||||
self?.coordinator.discloseFeed(feed, animated: true)
|
||||
completionHandler(true)
|
||||
}
|
||||
return action
|
||||
|
|
|
@ -65,6 +65,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||
private var lastSearchScope: SearchScope? = nil
|
||||
private var isSearching: Bool = false
|
||||
private var searchArticleIds: Set<String>? = nil
|
||||
private var isTimelineViewControllerPending = false
|
||||
private var isArticleViewControllerPending = false
|
||||
|
||||
private(set) var sortDirection = AppDefaults.timelineSortDirection {
|
||||
|
@ -782,8 +783,8 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||
markArticlesWithUndo([article], statusKey: .starred, flag: !article.status.starred)
|
||||
}
|
||||
|
||||
func discloseFeed(_ feed: Feed, completion: (() -> Void)? = nil) {
|
||||
masterFeedViewController.discloseFeed(feed) {
|
||||
func discloseFeed(_ feed: Feed, animated: Bool, completion: (() -> Void)? = nil) {
|
||||
masterFeedViewController.discloseFeed(feed, animated: animated) {
|
||||
completion?()
|
||||
}
|
||||
}
|
||||
|
@ -952,12 +953,16 @@ extension SceneCoordinator: UINavigationControllerDelegate {
|
|||
}
|
||||
|
||||
// If we are showing the Feeds and only the feeds start clearing stuff
|
||||
if viewController === masterFeedViewController && !isThreePanelMode {
|
||||
if viewController === masterFeedViewController && !isThreePanelMode && !isTimelineViewControllerPending {
|
||||
activityManager.invalidateCurrentActivities()
|
||||
selectFeed(nil)
|
||||
return
|
||||
}
|
||||
|
||||
if viewController is MasterTimelineViewController {
|
||||
isTimelineViewControllerPending = false
|
||||
}
|
||||
|
||||
// If we are using a phone and navigate away from the detail, clear up the article resources (including activity).
|
||||
// Don't clear it if we have pushed an ArticleViewController, but don't yet see it on the navigation stack.
|
||||
// This happens when we are going to the next unread and we need to grab another timeline to continue. The
|
||||
|
@ -1473,6 +1478,9 @@ private extension SceneCoordinator {
|
|||
// MARK: Double Split
|
||||
|
||||
func installTimelineControllerIfNecessary(animated: Bool) {
|
||||
|
||||
isTimelineViewControllerPending = true
|
||||
|
||||
if navControllerForTimeline().viewControllers.filter({ $0 is MasterTimelineViewController }).count < 1 {
|
||||
masterTimelineViewController = UIStoryboard.main.instantiateController(ofType: MasterTimelineViewController.self)
|
||||
masterTimelineViewController!.coordinator = self
|
||||
|
@ -1654,7 +1662,7 @@ private extension SceneCoordinator {
|
|||
return
|
||||
}
|
||||
if let feed = feedNode.representedObject as? Feed {
|
||||
discloseFeed(feed)
|
||||
discloseFeed(feed, animated: false)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1663,7 +1671,7 @@ private extension SceneCoordinator {
|
|||
return
|
||||
}
|
||||
|
||||
discloseFeed(feedNode.representedObject as! Feed) {
|
||||
discloseFeed(feedNode.representedObject as! Feed, animated: false) {
|
||||
|
||||
guard let articleID = userInfo?[DeepLinkKey.articleID.rawValue] as? String else { return }
|
||||
if let article = self.articles.first(where: { $0.articleID == articleID }) {
|
||||
|
|
Loading…
Reference in New Issue