From fcb0f0c439b441cfadfa67fb205179341953bb25 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 13 Oct 2019 19:23:36 -0700 Subject: [PATCH] =?UTF-8?q?Remove=20a=20no-longer-used=20Account.update=20?= =?UTF-8?q?function=20=E2=80=94=20we=20have=20a=20new=20one=20that?= =?UTF-8?q?=E2=80=99s=20way=20faster.=20Also:=20assert=20that=20we?= =?UTF-8?q?=E2=80=99re=20in=20the=20main=20thread=20in=20that=20new=20upda?= =?UTF-8?q?te=20function.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frameworks/Account/Account.swift | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/Frameworks/Account/Account.swift b/Frameworks/Account/Account.swift index b28ff6c53..b4b1ff707 100644 --- a/Frameworks/Account/Account.swift +++ b/Frameworks/Account/Account.swift @@ -580,6 +580,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container, } func update(feedIDsAndItems: [String: Set], defaultRead: Bool, completion: @escaping (() -> Void)) { + assert(Thread.isMainThread) guard !feedIDsAndItems.isEmpty else { completion() return @@ -604,25 +605,6 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container, } } - func update(_ feed: Feed, parsedItems: Set, defaultRead: Bool = false, _ completion: @escaping (() -> Void)) { - let feedIDsAndItems = [feed.feedID: parsedItems] - database.update(feedIDsAndItems: feedIDsAndItems, defaultRead: defaultRead) { (newArticles, updatedArticles) in - var userInfo = [String: Any]() - if let newArticles = newArticles, !newArticles.isEmpty { - self.updateUnreadCounts(for: Set([feed])) - userInfo[UserInfoKey.newArticles] = newArticles - } - if let updatedArticles = updatedArticles, !updatedArticles.isEmpty { - userInfo[UserInfoKey.updatedArticles] = updatedArticles - } - userInfo[UserInfoKey.feeds] = Set([feed]) - - completion() - - NotificationCenter.default.post(name: .AccountDidDownloadArticles, object: self, userInfo: userInfo) - } - } - @discardableResult func update(_ articles: Set
, statusKey: ArticleStatus.Key, flag: Bool) -> Set
? { // Returns set of Articles whose statuses did change.