mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-12 17:54:05 +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 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 {
|
if articles != sortedArticles {
|
||||||
articles = sortedArticles
|
articles = sortedArticles
|
||||||
}
|
}
|
||||||
@ -667,20 +672,27 @@ private extension TimelineViewController {
|
|||||||
|
|
||||||
func fetchAndMergeArticles() {
|
func fetchAndMergeArticles() {
|
||||||
|
|
||||||
|
guard let representedObjects = representedObjects else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
let selectedArticleIDs = selectedArticles.articleIDs()
|
let selectedArticleIDs = selectedArticles.articleIDs()
|
||||||
|
|
||||||
|
var unsortedArticles = fetchUnsortedArticles(for: representedObjects)
|
||||||
|
unsortedArticles.formUnion(Set(articles))
|
||||||
|
updateArticles(with: unsortedArticles)
|
||||||
|
|
||||||
selectArticles(selectedArticleIDs)
|
selectArticles(selectedArticleIDs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func selectArticles(_ articleIDs: [String]) {
|
func selectArticles(_ articleIDs: [String]) {
|
||||||
|
|
||||||
// let indexesToSelect = indexesOf(articleIDs)
|
let indexesToSelect = articles.indexesForArticleIDs(Set(articleIDs))
|
||||||
// if indexesToSelect.isEmpty {
|
if indexesToSelect.isEmpty {
|
||||||
// tableView.deselectAll(self)
|
tableView.deselectAll(self)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// tableView.selectRowIndexes(indexesToSelect, byExtendingSelection: false)
|
tableView.selectRowIndexes(indexesToSelect, byExtendingSelection: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func invalidateFetchAndMergeArticlesTimer() {
|
func invalidateFetchAndMergeArticlesTimer() {
|
||||||
|
Loading…
Reference in New Issue
Block a user