Make the UnreadFeed conform to ArticleFetcher. It now displays articles in the timeline when selected.

This commit is contained in:
Brent Simmons 2018-02-10 13:00:53 -08:00
parent 00cf3934e5
commit f5bfadfb33
2 changed files with 21 additions and 5 deletions

View File

@ -679,11 +679,8 @@ private extension TimelineViewController {
for object in representedObjects { for object in representedObjects {
if let feed = object as? Feed { if let articleFetcher = object as? ArticleFetcher {
fetchedArticles.formUnion(feed.fetchArticles()) fetchedArticles.formUnion(articleFetcher.fetchArticles())
}
else if let folder = object as? Folder {
fetchedArticles.formUnion(folder.fetchArticles())
} }
} }

View File

@ -7,6 +7,8 @@
// //
import Foundation import Foundation
import Account
import Data
// This just shows the global unread count, which appDelegate already has. Easy. // This just shows the global unread count, which appDelegate already has. Easy.
@ -34,3 +36,20 @@ final class UnreadFeed: PseudoFeed {
unreadCount = appDelegate.unreadCount unreadCount = appDelegate.unreadCount
} }
} }
extension UnreadFeed: ArticleFetcher {
func fetchArticles() -> Set<Article> {
return fetchUnreadArticles()
}
func fetchUnreadArticles() -> Set<Article> {
var articles = Set<Article>()
for account in AccountManager.shared.accounts {
articles.formUnion(account.fetchUnreadArticles())
}
return articles
}
}