Fix crashing bug with marking all as read via contextual menu. Implement feed.fetchUnreadArticles.

This commit is contained in:
Brent Simmons 2019-08-12 09:43:29 -07:00
parent 495662f888
commit f8c8fc5f34
1 changed files with 7 additions and 2 deletions

View File

@ -33,11 +33,16 @@ extension Feed: ArticleFetcher {
} }
public func fetchUnreadArticles() -> Set<Article> { public func fetchUnreadArticles() -> Set<Article> {
preconditionFailure("feed.fetchUnreadArticles is unused.") return fetchArticles().unreadArticles()
} }
public func fetchUnreadArticlesAsync(_ callback: @escaping ArticleSetBlock) { public func fetchUnreadArticlesAsync(_ callback: @escaping ArticleSetBlock) {
preconditionFailure("feed.fetchUnreadArticlesAsync is unused.") guard let account = account else {
assertionFailure("Expected feed.account, but got nil.")
callback(Set<Article>())
return
}
account.fetchArticlesAsync(.feed(self)) { callback($0.unreadArticles()) }
} }
} }