mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-25 09:11:13 +01:00
Add new articles to the timeline when a feed that affects the timeline gets new articles. Fix #166.
This commit is contained in:
parent
982b2d2d3f
commit
807ad99aad
@ -642,7 +642,12 @@ private extension TimelineViewController {
|
||||
}
|
||||
|
||||
let fetchedArticles = fetchUnsortedArticles(for: representedObjects)
|
||||
let sortedArticles = Array(fetchedArticles).sortedByDate()
|
||||
updateArticles(with: fetchedArticles)
|
||||
}
|
||||
|
||||
func updateArticles(with unsortedArticles: Set<Article>) {
|
||||
|
||||
let sortedArticles = Array(unsortedArticles).sortedByDate()
|
||||
if articles != sortedArticles {
|
||||
articles = sortedArticles
|
||||
}
|
||||
@ -667,20 +672,27 @@ private extension TimelineViewController {
|
||||
|
||||
func fetchAndMergeArticles() {
|
||||
|
||||
guard let representedObjects = representedObjects else {
|
||||
return
|
||||
}
|
||||
|
||||
let selectedArticleIDs = selectedArticles.articleIDs()
|
||||
|
||||
var unsortedArticles = fetchUnsortedArticles(for: representedObjects)
|
||||
unsortedArticles.formUnion(Set(articles))
|
||||
updateArticles(with: unsortedArticles)
|
||||
|
||||
selectArticles(selectedArticleIDs)
|
||||
}
|
||||
|
||||
func selectArticles(_ articleIDs: [String]) {
|
||||
|
||||
// let indexesToSelect = indexesOf(articleIDs)
|
||||
// if indexesToSelect.isEmpty {
|
||||
// tableView.deselectAll(self)
|
||||
// return
|
||||
// }
|
||||
// tableView.selectRowIndexes(indexesToSelect, byExtendingSelection: false)
|
||||
let indexesToSelect = articles.indexesForArticleIDs(Set(articleIDs))
|
||||
if indexesToSelect.isEmpty {
|
||||
tableView.deselectAll(self)
|
||||
return
|
||||
}
|
||||
tableView.selectRowIndexes(indexesToSelect, byExtendingSelection: false)
|
||||
}
|
||||
|
||||
func invalidateFetchAndMergeArticlesTimer() {
|
||||
|
Loading…
Reference in New Issue
Block a user