From f5bfadfb338627ce01f421285d9cbcc418f50778 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 10 Feb 2018 13:00:53 -0800 Subject: [PATCH] Make the UnreadFeed conform to ArticleFetcher. It now displays articles in the timeline when selected. --- .../Timeline/TimelineViewController.swift | 7 ++----- Evergreen/SmartFeeds/UnreadFeed.swift | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Evergreen/MainWindow/Timeline/TimelineViewController.swift b/Evergreen/MainWindow/Timeline/TimelineViewController.swift index 9fad68058..993a8d8ba 100644 --- a/Evergreen/MainWindow/Timeline/TimelineViewController.swift +++ b/Evergreen/MainWindow/Timeline/TimelineViewController.swift @@ -679,11 +679,8 @@ private extension TimelineViewController { for object in representedObjects { - if let feed = object as? Feed { - fetchedArticles.formUnion(feed.fetchArticles()) - } - else if let folder = object as? Folder { - fetchedArticles.formUnion(folder.fetchArticles()) + if let articleFetcher = object as? ArticleFetcher { + fetchedArticles.formUnion(articleFetcher.fetchArticles()) } } diff --git a/Evergreen/SmartFeeds/UnreadFeed.swift b/Evergreen/SmartFeeds/UnreadFeed.swift index d80b0e07c..eae26a601 100644 --- a/Evergreen/SmartFeeds/UnreadFeed.swift +++ b/Evergreen/SmartFeeds/UnreadFeed.swift @@ -7,6 +7,8 @@ // import Foundation +import Account +import Data // This just shows the global unread count, which appDelegate already has. Easy. @@ -34,3 +36,20 @@ final class UnreadFeed: PseudoFeed { unreadCount = appDelegate.unreadCount } } + +extension UnreadFeed: ArticleFetcher { + + func fetchArticles() -> Set
{ + + return fetchUnreadArticles() + } + + func fetchUnreadArticles() -> Set
{ + + var articles = Set
() + for account in AccountManager.shared.accounts { + articles.formUnion(account.fetchUnreadArticles()) + } + return articles + } +}