Add fetchUnreadArticles method to Account, which will be used by the All Unread smart feed.

This commit is contained in:
Brent Simmons 2018-02-10 13:00:16 -08:00
parent 9ac2d7d033
commit 00cf3934e5
1 changed files with 11 additions and 1 deletions

View File

@ -341,9 +341,19 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
return articles
}
public func fetchUnreadArticles() -> Set<Article> {
return fetchUnreadArticles(forContainer: self)
}
public func fetchArticles(folder: Folder) -> Set<Article> {
let feeds = folder.flattenedFeeds()
return fetchUnreadArticles(forContainer: folder)
}
public func fetchUnreadArticles(forContainer container: Container) -> Set<Article> {
let feeds = container.flattenedFeeds()
let articles = database.fetchUnreadArticles(for: feeds)
feeds.forEach { validateUnreadCount($0, articles) }
return articles