From f8c8fc5f3424193e999af78f326749c602ef676a Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Mon, 12 Aug 2019 09:43:29 -0700 Subject: [PATCH] Fix crashing bug with marking all as read via contextual menu. Implement feed.fetchUnreadArticles. --- Frameworks/Account/ArticleFetcher.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Frameworks/Account/ArticleFetcher.swift b/Frameworks/Account/ArticleFetcher.swift index a4f6b3978..4a5987a56 100644 --- a/Frameworks/Account/ArticleFetcher.swift +++ b/Frameworks/Account/ArticleFetcher.swift @@ -33,11 +33,16 @@ extension Feed: ArticleFetcher { } public func fetchUnreadArticles() -> Set
{ - preconditionFailure("feed.fetchUnreadArticles is unused.") + return fetchArticles().unreadArticles() } 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
()) + return + } + account.fetchArticlesAsync(.feed(self)) { callback($0.unreadArticles()) } } }