Add functionality to clear the timeline and article views if their respective items get collapsed or filtered. Issue #1708
This commit is contained in:
parent
81e71051ef
commit
f2ac6ff1df
@ -594,6 +594,9 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||||||
func refreshTimeline(resetScroll: Bool) {
|
func refreshTimeline(resetScroll: Bool) {
|
||||||
fetchAndReplaceArticlesAsync(animated: true) {
|
fetchAndReplaceArticlesAsync(animated: true) {
|
||||||
self.masterTimelineViewController?.reinitializeArticles(resetScroll: resetScroll)
|
self.masterTimelineViewController?.reinitializeArticles(resetScroll: resetScroll)
|
||||||
|
if let article = self.currentArticle, self.articles.firstIndex(of: article) == nil {
|
||||||
|
self.selectArticle(nil)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -654,6 +657,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||||||
animatingChanges = true
|
animatingChanges = true
|
||||||
rebuildShadowTable()
|
rebuildShadowTable()
|
||||||
animatingChanges = false
|
animatingChanges = false
|
||||||
|
clearTimelineIfNoLongerAvailable()
|
||||||
}
|
}
|
||||||
|
|
||||||
func collapseAllFolders() {
|
func collapseAllFolders() {
|
||||||
@ -668,6 +672,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||||||
animatingChanges = true
|
animatingChanges = true
|
||||||
rebuildShadowTable()
|
rebuildShadowTable()
|
||||||
animatingChanges = false
|
animatingChanges = false
|
||||||
|
clearTimelineIfNoLongerAvailable()
|
||||||
}
|
}
|
||||||
|
|
||||||
func masterFeedIndexPathForCurrentTimeline() -> IndexPath? {
|
func masterFeedIndexPathForCurrentTimeline() -> IndexPath? {
|
||||||
@ -1224,6 +1229,7 @@ private extension SceneCoordinator {
|
|||||||
updateExpandedNodes?()
|
updateExpandedNodes?()
|
||||||
rebuildShadowTable()
|
rebuildShadowTable()
|
||||||
masterFeedViewController.reloadFeeds(initialLoad: initialLoad)
|
masterFeedViewController.reloadFeeds(initialLoad: initialLoad)
|
||||||
|
clearTimelineIfNoLongerAvailable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1262,6 +1268,12 @@ private extension SceneCoordinator {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func clearTimelineIfNoLongerAvailable() {
|
||||||
|
if let feed = timelineFeed, !shadowTableContains(feed) {
|
||||||
|
selectFeed(nil, animated: false, deselectArticle: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func nodeFor(_ indexPath: IndexPath) -> Node? {
|
func nodeFor(_ indexPath: IndexPath) -> Node? {
|
||||||
guard indexPath.section < shadowTable.count && indexPath.row < shadowTable[indexPath.section].count else {
|
guard indexPath.section < shadowTable.count && indexPath.row < shadowTable[indexPath.section].count else {
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user