diff --git a/Frameworks/Account/Account.swift b/Frameworks/Account/Account.swift index 44b7d1e47..a32cad41d 100644 --- a/Frameworks/Account/Account.swift +++ b/Frameworks/Account/Account.swift @@ -642,45 +642,45 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container, } } - public func fetchArticlesAsync(_ fetchType: FetchType, _ callback: @escaping ArticleSetBlock) { + public func fetchArticlesAsync(_ fetchType: FetchType, _ completion: @escaping ArticleSetBlock) { switch fetchType { case .starred: - fetchStarredArticlesAsync(callback) + fetchStarredArticlesAsync(completion) case .unread: - fetchUnreadArticlesAsync(callback) + fetchUnreadArticlesAsync(completion) case .today: - fetchTodayArticlesAsync(callback) + fetchTodayArticlesAsync(completion) case .folder(let folder, let readFilter): if readFilter { - return fetchUnreadArticlesAsync(folder: folder, callback) + return fetchUnreadArticlesAsync(folder: folder, completion) } else { - return fetchArticlesAsync(folder: folder, callback) + return fetchArticlesAsync(folder: folder, completion) } case .webFeed(let webFeed): - fetchArticlesAsync(webFeed: webFeed, callback) + fetchArticlesAsync(webFeed: webFeed, completion) case .articleIDs(let articleIDs): - fetchArticlesAsync(articleIDs: articleIDs, callback) + fetchArticlesAsync(articleIDs: articleIDs, completion) case .search(let searchString): - fetchArticlesMatchingAsync(searchString, callback) + fetchArticlesMatchingAsync(searchString, completion) case .searchWithArticleIDs(let searchString, let articleIDs): - return fetchArticlesMatchingWithArticleIDsAsync(searchString, articleIDs, callback) + return fetchArticlesMatchingWithArticleIDsAsync(searchString, articleIDs, completion) } } - public func fetchUnreadCountForToday(_ callback: @escaping (Int) -> Void) { - database.fetchUnreadCountForToday(for: flattenedWebFeeds().webFeedIDs(), callback: callback) + public func fetchUnreadCountForToday(_ completion: @escaping (Int) -> Void) { + database.fetchUnreadCountForToday(for: flattenedWebFeeds().webFeedIDs(), completion: completion) } - public func fetchUnreadCountForStarredArticles(_ callback: @escaping (Int) -> Void) { - database.fetchStarredAndUnreadCount(for: flattenedWebFeeds().webFeedIDs(), callback: callback) + public func fetchUnreadCountForStarredArticles(_ completion: @escaping (Int) -> Void) { + database.fetchStarredAndUnreadCount(for: flattenedWebFeeds().webFeedIDs(), completion: completion) } - public func fetchUnreadArticleIDs(_ callback: @escaping (Set) -> Void) { - database.fetchUnreadArticleIDsAsync(webFeedIDs: flattenedWebFeeds().webFeedIDs(), callback: callback) + public func fetchUnreadArticleIDs(_ completion: @escaping (Set) -> Void) { + database.fetchUnreadArticleIDsAsync(webFeedIDs: flattenedWebFeeds().webFeedIDs(), completion: completion) } - public func fetchStarredArticleIDs(_ callback: @escaping (Set) -> Void) { - database.fetchStarredArticleIDsAsync(webFeedIDs: flattenedWebFeeds().webFeedIDs(), callback: callback) + public func fetchStarredArticleIDs(_ completion: @escaping (Set) -> Void) { + database.fetchStarredArticleIDsAsync(webFeedIDs: flattenedWebFeeds().webFeedIDs(), completion: completion) } public func fetchArticleIDsForStatusesWithoutArticles() -> Set { @@ -770,7 +770,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container, /// Fetch statuses for the specified articleIDs. The completion handler will get nil if the app is suspended. /// To update the properties in the database, call the update method that takes Set as first parameter. func fetchStatuses(articleIDs: Set, createIfNeeded: Bool, completion: @escaping (Set?) -> Void) { - database.fetchStatuses(articleIDs: articleIDs, createIfNeeded: createIfNeeded, callback: completion) + database.fetchStatuses(articleIDs: articleIDs, createIfNeeded: createIfNeeded, completion: completion) } /// Empty caches that can reasonably be emptied. Call when the app goes in the background, for instance. @@ -923,40 +923,40 @@ private extension Account { return database.fetchStarredArticles(flattenedWebFeeds().webFeedIDs()) } - func fetchStarredArticlesAsync(_ callback: @escaping ArticleSetBlock) { - database.fetchedStarredArticlesAsync(flattenedWebFeeds().webFeedIDs(), callback) + func fetchStarredArticlesAsync(_ completion: @escaping ArticleSetBlock) { + database.fetchedStarredArticlesAsync(flattenedWebFeeds().webFeedIDs(), completion) } func fetchUnreadArticles() -> Set
{ return fetchUnreadArticles(forContainer: self) } - func fetchUnreadArticlesAsync(_ callback: @escaping ArticleSetBlock) { - fetchUnreadArticlesAsync(forContainer: self, callback) + func fetchUnreadArticlesAsync(_ completion: @escaping ArticleSetBlock) { + fetchUnreadArticlesAsync(forContainer: self, completion) } func fetchTodayArticles() -> Set
{ return database.fetchTodayArticles(flattenedWebFeeds().webFeedIDs()) } - func fetchTodayArticlesAsync(_ callback: @escaping ArticleSetBlock) { - database.fetchTodayArticlesAsync(flattenedWebFeeds().webFeedIDs(), callback) + func fetchTodayArticlesAsync(_ completion: @escaping ArticleSetBlock) { + database.fetchTodayArticlesAsync(flattenedWebFeeds().webFeedIDs(), completion) } func fetchArticles(folder: Folder) -> Set
{ return fetchArticles(forContainer: folder) } - func fetchArticlesAsync(folder: Folder, _ callback: @escaping ArticleSetBlock) { - fetchArticlesAsync(forContainer: folder, callback) + func fetchArticlesAsync(folder: Folder, _ completion: @escaping ArticleSetBlock) { + fetchArticlesAsync(forContainer: folder, completion) } func fetchUnreadArticles(folder: Folder) -> Set
{ return fetchUnreadArticles(forContainer: folder) } - func fetchUnreadArticlesAsync(folder: Folder, _ callback: @escaping ArticleSetBlock) { - fetchUnreadArticlesAsync(forContainer: folder, callback) + func fetchUnreadArticlesAsync(folder: Folder, _ completion: @escaping ArticleSetBlock) { + fetchUnreadArticlesAsync(forContainer: folder, completion) } func fetchArticles(webFeed: WebFeed) -> Set
{ @@ -965,10 +965,10 @@ private extension Account { return articles } - func fetchArticlesAsync(webFeed: WebFeed, _ callback: @escaping ArticleSetBlock) { + func fetchArticlesAsync(webFeed: WebFeed, _ completion: @escaping ArticleSetBlock) { database.fetchArticlesAsync(webFeed.webFeedID) { [weak self] (articles) in self?.validateUnreadCount(webFeed, articles) - callback(articles) + completion(articles) } } @@ -980,20 +980,20 @@ private extension Account { return database.fetchArticlesMatchingWithArticleIDs(searchString, articleIDs) } - func fetchArticlesMatchingAsync(_ searchString: String, _ callback: @escaping ArticleSetBlock) { - database.fetchArticlesMatchingAsync(searchString, flattenedWebFeeds().webFeedIDs(), callback) + func fetchArticlesMatchingAsync(_ searchString: String, _ completion: @escaping ArticleSetBlock) { + database.fetchArticlesMatchingAsync(searchString, flattenedWebFeeds().webFeedIDs(), completion) } - func fetchArticlesMatchingWithArticleIDsAsync(_ searchString: String, _ articleIDs: Set, _ callback: @escaping ArticleSetBlock) { - database.fetchArticlesMatchingWithArticleIDsAsync(searchString, articleIDs, callback) + func fetchArticlesMatchingWithArticleIDsAsync(_ searchString: String, _ articleIDs: Set, _ completion: @escaping ArticleSetBlock) { + database.fetchArticlesMatchingWithArticleIDsAsync(searchString, articleIDs, completion) } func fetchArticles(articleIDs: Set) -> Set
{ return database.fetchArticles(articleIDs: articleIDs) } - func fetchArticlesAsync(articleIDs: Set, _ callback: @escaping ArticleSetBlock) { - return database.fetchArticlesAsync(articleIDs: articleIDs, callback) + func fetchArticlesAsync(articleIDs: Set, _ completion: @escaping ArticleSetBlock) { + return database.fetchArticlesAsync(articleIDs: articleIDs, completion) } func fetchUnreadArticles(webFeed: WebFeed) -> Set
{ @@ -1002,7 +1002,7 @@ private extension Account { return articles } - func fetchUnreadArticlesAsync(for webFeed: WebFeed, callback: @escaping (Set
) -> Void) { + func fetchUnreadArticlesAsync(for webFeed: WebFeed, completion: @escaping (Set
) -> Void) { // database.fetchUnreadArticlesAsync(for: Set([feed.feedID])) { [weak self] (articles) in // self?.validateUnreadCount(feed, articles) // callback(articles) @@ -1017,11 +1017,11 @@ private extension Account { return articles } - func fetchArticlesAsync(forContainer container: Container, _ callback: @escaping ArticleSetBlock) { + func fetchArticlesAsync(forContainer container: Container, _ completion: @escaping ArticleSetBlock) { let webFeeds = container.flattenedWebFeeds() database.fetchArticlesAsync(webFeeds.webFeedIDs()) { [weak self] (articles) in self?.validateUnreadCountsAfterFetchingUnreadArticles(webFeeds, articles) - callback(articles) + completion(articles) } } @@ -1032,11 +1032,11 @@ private extension Account { return articles } - func fetchUnreadArticlesAsync(forContainer container: Container, _ callback: @escaping ArticleSetBlock) { + func fetchUnreadArticlesAsync(forContainer container: Container, _ completion: @escaping ArticleSetBlock) { let webFeeds = container.flattenedWebFeeds() database.fetchUnreadArticlesAsync(webFeeds.webFeedIDs()) { [weak self] (articles) in self?.validateUnreadCountsAfterFetchingUnreadArticles(webFeeds, articles) - callback(articles) + completion(articles) } } diff --git a/Frameworks/Account/AccountManager.swift b/Frameworks/Account/AccountManager.swift index 49133a52b..f3badd13d 100644 --- a/Frameworks/Account/AccountManager.swift +++ b/Frameworks/Account/AccountManager.swift @@ -265,7 +265,7 @@ public final class AccountManager: UnreadCountProvider { return articles } - public func fetchArticlesAsync(_ fetchType: FetchType, _ callback: @escaping ArticleSetBlock) { + public func fetchArticlesAsync(_ fetchType: FetchType, _ completion: @escaping ArticleSetBlock) { precondition(Thread.isMainThread) var allFetchedArticles = Set
() @@ -277,7 +277,7 @@ public final class AccountManager: UnreadCountProvider { allFetchedArticles.formUnion(articles) accountsReporting += 1 if accountsReporting == numberOfAccounts { - callback(allFetchedArticles) + completion(allFetchedArticles) } } } diff --git a/Frameworks/Account/ArticleFetcher.swift b/Frameworks/Account/ArticleFetcher.swift index bf4b08dac..a92d1e928 100644 --- a/Frameworks/Account/ArticleFetcher.swift +++ b/Frameworks/Account/ArticleFetcher.swift @@ -12,9 +12,9 @@ import Articles public protocol ArticleFetcher { func fetchArticles() -> Set
- func fetchArticlesAsync(_ callback: @escaping ArticleSetBlock) + func fetchArticlesAsync(_ completion: @escaping ArticleSetBlock) func fetchUnreadArticles() -> Set
- func fetchUnreadArticlesAsync(_ callback: @escaping ArticleSetBlock) + func fetchUnreadArticlesAsync(_ completion: @escaping ArticleSetBlock) } extension WebFeed: ArticleFetcher { @@ -23,26 +23,26 @@ extension WebFeed: ArticleFetcher { return account?.fetchArticles(.webFeed(self)) ?? Set
() } - public func fetchArticlesAsync(_ callback: @escaping ArticleSetBlock) { + public func fetchArticlesAsync(_ completion: @escaping ArticleSetBlock) { guard let account = account else { assertionFailure("Expected feed.account, but got nil.") - callback(Set
()) + completion(Set
()) return } - account.fetchArticlesAsync(.webFeed(self), callback) + account.fetchArticlesAsync(.webFeed(self), completion) } public func fetchUnreadArticles() -> Set
{ return fetchArticles().unreadArticles() } - public func fetchUnreadArticlesAsync(_ callback: @escaping ArticleSetBlock) { + public func fetchUnreadArticlesAsync(_ completion: @escaping ArticleSetBlock) { guard let account = account else { assertionFailure("Expected feed.account, but got nil.") - callback(Set
()) + completion(Set
()) return } - account.fetchArticlesAsync(.webFeed(self)) { callback($0.unreadArticles()) } + account.fetchArticlesAsync(.webFeed(self)) { completion($0.unreadArticles()) } } } @@ -56,13 +56,13 @@ extension Folder: ArticleFetcher { return account.fetchArticles(.folder(self, false)) } - public func fetchArticlesAsync(_ callback: @escaping ArticleSetBlock) { + public func fetchArticlesAsync(_ completion: @escaping ArticleSetBlock) { guard let account = account else { assertionFailure("Expected folder.account, but got nil.") - callback(Set
()) + completion(Set
()) return } - account.fetchArticlesAsync(.folder(self, false), callback) + account.fetchArticlesAsync(.folder(self, false), completion) } public func fetchUnreadArticles() -> Set
{ @@ -73,12 +73,12 @@ extension Folder: ArticleFetcher { return account.fetchArticles(.folder(self, true)) } - public func fetchUnreadArticlesAsync(_ callback: @escaping ArticleSetBlock) { + public func fetchUnreadArticlesAsync(_ completion: @escaping ArticleSetBlock) { guard let account = account else { assertionFailure("Expected folder.account, but got nil.") - callback(Set
()) + completion(Set
()) return } - account.fetchArticlesAsync(.folder(self, true), callback) + account.fetchArticlesAsync(.folder(self, true), completion) } } diff --git a/Frameworks/Account/SingleArticleFetcher.swift b/Frameworks/Account/SingleArticleFetcher.swift index 960a136e4..d600c52b5 100644 --- a/Frameworks/Account/SingleArticleFetcher.swift +++ b/Frameworks/Account/SingleArticleFetcher.swift @@ -23,16 +23,16 @@ public struct SingleArticleFetcher: ArticleFetcher { return account.fetchArticles(.articleIDs(Set([articleID]))) } - public func fetchArticlesAsync(_ callback: @escaping ArticleSetBlock) { - return account.fetchArticlesAsync(.articleIDs(Set([articleID])), callback) + public func fetchArticlesAsync(_ completion: @escaping ArticleSetBlock) { + return account.fetchArticlesAsync(.articleIDs(Set([articleID])), completion) } public func fetchUnreadArticles() -> Set
{ return account.fetchArticles(.articleIDs(Set([articleID]))) } - public func fetchUnreadArticlesAsync(_ callback: @escaping ArticleSetBlock) { - return account.fetchArticlesAsync(.articleIDs(Set([articleID])), callback) + public func fetchUnreadArticlesAsync(_ completion: @escaping ArticleSetBlock) { + return account.fetchArticlesAsync(.articleIDs(Set([articleID])), completion) } } diff --git a/Frameworks/ArticlesDatabase/ArticlesDatabase.swift b/Frameworks/ArticlesDatabase/ArticlesDatabase.swift index 5d3bee42a..2ba95bdcf 100644 --- a/Frameworks/ArticlesDatabase/ArticlesDatabase.swift +++ b/Frameworks/ArticlesDatabase/ArticlesDatabase.swift @@ -87,58 +87,58 @@ public final class ArticlesDatabase { // MARK: - Fetching Articles Async - public func fetchArticlesAsync(_ webFeedID: String, _ callback: @escaping ArticleSetBlock) { - articlesTable.fetchArticlesAsync(webFeedID, callback) + public func fetchArticlesAsync(_ webFeedID: String, _ completion: @escaping ArticleSetBlock) { + articlesTable.fetchArticlesAsync(webFeedID, completion) } - public func fetchArticlesAsync(_ webFeedIDs: Set, _ callback: @escaping ArticleSetBlock) { - articlesTable.fetchArticlesAsync(webFeedIDs, callback) + public func fetchArticlesAsync(_ webFeedIDs: Set, _ completion: @escaping ArticleSetBlock) { + articlesTable.fetchArticlesAsync(webFeedIDs, completion) } - public func fetchArticlesAsync(articleIDs: Set, _ callback: @escaping ArticleSetBlock) { - articlesTable.fetchArticlesAsync(articleIDs: articleIDs, callback) + public func fetchArticlesAsync(articleIDs: Set, _ completion: @escaping ArticleSetBlock) { + articlesTable.fetchArticlesAsync(articleIDs: articleIDs, completion) } - public func fetchUnreadArticlesAsync(_ webFeedIDs: Set, _ callback: @escaping ArticleSetBlock) { - articlesTable.fetchUnreadArticlesAsync(webFeedIDs, callback) + public func fetchUnreadArticlesAsync(_ webFeedIDs: Set, _ completion: @escaping ArticleSetBlock) { + articlesTable.fetchUnreadArticlesAsync(webFeedIDs, completion) } - public func fetchTodayArticlesAsync(_ webFeedIDs: Set, _ callback: @escaping ArticleSetBlock) { - articlesTable.fetchArticlesSinceAsync(webFeedIDs, todayCutoffDate(), callback) + public func fetchTodayArticlesAsync(_ webFeedIDs: Set, _ completion: @escaping ArticleSetBlock) { + articlesTable.fetchArticlesSinceAsync(webFeedIDs, todayCutoffDate(), completion) } - public func fetchedStarredArticlesAsync(_ webFeedIDs: Set, _ callback: @escaping ArticleSetBlock) { - articlesTable.fetchStarredArticlesAsync(webFeedIDs, callback) + public func fetchedStarredArticlesAsync(_ webFeedIDs: Set, _ completion: @escaping ArticleSetBlock) { + articlesTable.fetchStarredArticlesAsync(webFeedIDs, completion) } - public func fetchArticlesMatchingAsync(_ searchString: String, _ webFeedIDs: Set, _ callback: @escaping ArticleSetBlock) { - articlesTable.fetchArticlesMatchingAsync(searchString, webFeedIDs, callback) + public func fetchArticlesMatchingAsync(_ searchString: String, _ webFeedIDs: Set, _ completion: @escaping ArticleSetBlock) { + articlesTable.fetchArticlesMatchingAsync(searchString, webFeedIDs, completion) } - public func fetchArticlesMatchingWithArticleIDsAsync(_ searchString: String, _ articleIDs: Set, _ callback: @escaping ArticleSetBlock) { - articlesTable.fetchArticlesMatchingWithArticleIDsAsync(searchString, articleIDs, callback) + public func fetchArticlesMatchingWithArticleIDsAsync(_ searchString: String, _ articleIDs: Set, _ completion: @escaping ArticleSetBlock) { + articlesTable.fetchArticlesMatchingWithArticleIDsAsync(searchString, articleIDs, completion) } // MARK: - Unread Counts - public func fetchUnreadCounts(for webFeedIDs: Set, _ callback: @escaping UnreadCountCompletionBlock) { - articlesTable.fetchUnreadCounts(webFeedIDs, callback) + public func fetchUnreadCounts(for webFeedIDs: Set, _ completion: @escaping UnreadCountCompletionBlock) { + articlesTable.fetchUnreadCounts(webFeedIDs, completion) } - public func fetchUnreadCountForToday(for webFeedIDs: Set, callback: @escaping (Int) -> Void) { - fetchUnreadCount(for: webFeedIDs, since: todayCutoffDate(), callback: callback) + public func fetchUnreadCountForToday(for webFeedIDs: Set, completion: @escaping (Int) -> Void) { + fetchUnreadCount(for: webFeedIDs, since: todayCutoffDate(), completion: completion) } - public func fetchUnreadCount(for webFeedIDs: Set, since: Date, callback: @escaping (Int) -> Void) { - articlesTable.fetchUnreadCount(webFeedIDs, since, callback) + public func fetchUnreadCount(for webFeedIDs: Set, since: Date, completion: @escaping (Int) -> Void) { + articlesTable.fetchUnreadCount(webFeedIDs, since, completion) } - public func fetchStarredAndUnreadCount(for webFeedIDs: Set, callback: @escaping (Int) -> Void) { - articlesTable.fetchStarredAndUnreadCount(webFeedIDs, callback) + public func fetchStarredAndUnreadCount(for webFeedIDs: Set, completion: @escaping (Int) -> Void) { + articlesTable.fetchStarredAndUnreadCount(webFeedIDs, completion) } - public func fetchAllNonZeroUnreadCounts(_ callback: @escaping UnreadCountCompletionBlock) { - articlesTable.fetchAllUnreadCounts(callback) + public func fetchAllNonZeroUnreadCounts(_ completion: @escaping UnreadCountCompletionBlock) { + articlesTable.fetchAllUnreadCounts(completion) } // MARK: - Saving and Updating Articles @@ -155,13 +155,13 @@ public final class ArticlesDatabase { // MARK: - Status /// Fetch the articleIDs of unread articles in feeds specified by webFeedIDs. - public func fetchUnreadArticleIDsAsync(webFeedIDs: Set, callback: @escaping (Set) -> Void) { - articlesTable.fetchUnreadArticleIDsAsync(webFeedIDs, callback) + public func fetchUnreadArticleIDsAsync(webFeedIDs: Set, completion: @escaping (Set) -> Void) { + articlesTable.fetchUnreadArticleIDsAsync(webFeedIDs, completion) } /// Fetch the articleIDs of starred articles in feeds specified by webFeedIDs. - public func fetchStarredArticleIDsAsync(webFeedIDs: Set, callback: @escaping (Set) -> Void) { - articlesTable.fetchStarredArticleIDsAsync(webFeedIDs, callback) + public func fetchStarredArticleIDsAsync(webFeedIDs: Set, completion: @escaping (Set) -> Void) { + articlesTable.fetchStarredArticleIDsAsync(webFeedIDs, completion) } public func fetchArticleIDsForStatusesWithoutArticles() -> Set { @@ -172,8 +172,8 @@ public final class ArticlesDatabase { return articlesTable.mark(articles, statusKey, flag) } - public func fetchStatuses(articleIDs: Set, createIfNeeded: Bool, callback: @escaping (Set?) -> Void) { - articlesTable.fetchStatuses(articleIDs, createIfNeeded, callback) + public func fetchStatuses(articleIDs: Set, createIfNeeded: Bool, completion: @escaping (Set?) -> Void) { + articlesTable.fetchStatuses(articleIDs, createIfNeeded, completion) } // MARK: - Suspend and Resume (for iOS) diff --git a/Frameworks/ArticlesDatabase/ArticlesTable.swift b/Frameworks/ArticlesDatabase/ArticlesTable.swift index c94990191..5e661f240 100644 --- a/Frameworks/ArticlesDatabase/ArticlesTable.swift +++ b/Frameworks/ArticlesDatabase/ArticlesTable.swift @@ -47,8 +47,8 @@ final class ArticlesTable: DatabaseTable { return fetchArticles{ self.fetchArticlesForFeedID(webFeedID, withLimits: true, $0) } } - func fetchArticlesAsync(_ webFeedID: String, _ callback: @escaping ArticleSetBlock) { - fetchArticlesAsync({ self.fetchArticlesForFeedID(webFeedID, withLimits: true, $0) }, callback) + func fetchArticlesAsync(_ webFeedID: String, _ completion: @escaping ArticleSetBlock) { + fetchArticlesAsync({ self.fetchArticlesForFeedID(webFeedID, withLimits: true, $0) }, completion) } private func fetchArticlesForFeedID(_ webFeedID: String, withLimits: Bool, _ database: FMDatabase) -> Set
{ @@ -59,8 +59,8 @@ final class ArticlesTable: DatabaseTable { return fetchArticles{ self.fetchArticles(webFeedIDs, $0) } } - func fetchArticlesAsync(_ webFeedIDs: Set, _ callback: @escaping ArticleSetBlock) { - fetchArticlesAsync({ self.fetchArticles(webFeedIDs, $0) }, callback) + func fetchArticlesAsync(_ webFeedIDs: Set, _ completion: @escaping ArticleSetBlock) { + fetchArticlesAsync({ self.fetchArticles(webFeedIDs, $0) }, completion) } private func fetchArticles(_ webFeedIDs: Set, _ database: FMDatabase) -> Set
{ @@ -80,8 +80,8 @@ final class ArticlesTable: DatabaseTable { return fetchArticles{ self.fetchArticles(articleIDs: articleIDs, $0) } } - func fetchArticlesAsync(articleIDs: Set, _ callback: @escaping ArticleSetBlock) { - return fetchArticlesAsync({ self.fetchArticles(articleIDs: articleIDs, $0) }, callback) + func fetchArticlesAsync(articleIDs: Set, _ completion: @escaping ArticleSetBlock) { + return fetchArticlesAsync({ self.fetchArticles(articleIDs: articleIDs, $0) }, completion) } private func fetchArticles(articleIDs: Set, _ database: FMDatabase) -> Set
{ @@ -100,8 +100,8 @@ final class ArticlesTable: DatabaseTable { return fetchArticles{ self.fetchUnreadArticles(webFeedIDs, $0) } } - func fetchUnreadArticlesAsync(_ webFeedIDs: Set, _ callback: @escaping ArticleSetBlock) { - fetchArticlesAsync({ self.fetchUnreadArticles(webFeedIDs, $0) }, callback) + func fetchUnreadArticlesAsync(_ webFeedIDs: Set, _ completion: @escaping ArticleSetBlock) { + fetchArticlesAsync({ self.fetchUnreadArticles(webFeedIDs, $0) }, completion) } private func fetchUnreadArticles(_ webFeedIDs: Set, _ database: FMDatabase) -> Set
{ @@ -121,8 +121,8 @@ final class ArticlesTable: DatabaseTable { return fetchArticles{ self.fetchArticlesSince(webFeedIDs, cutoffDate, $0) } } - func fetchArticlesSinceAsync(_ webFeedIDs: Set, _ cutoffDate: Date, _ callback: @escaping ArticleSetBlock) { - fetchArticlesAsync({ self.fetchArticlesSince(webFeedIDs, cutoffDate, $0) }, callback) + func fetchArticlesSinceAsync(_ webFeedIDs: Set, _ cutoffDate: Date, _ completion: @escaping ArticleSetBlock) { + fetchArticlesAsync({ self.fetchArticlesSince(webFeedIDs, cutoffDate, $0) }, completion) } private func fetchArticlesSince(_ webFeedIDs: Set, _ cutoffDate: Date, _ database: FMDatabase) -> Set
{ @@ -144,8 +144,8 @@ final class ArticlesTable: DatabaseTable { return fetchArticles{ self.fetchStarredArticles(webFeedIDs, $0) } } - func fetchStarredArticlesAsync(_ webFeedIDs: Set, _ callback: @escaping ArticleSetBlock) { - fetchArticlesAsync({ self.fetchStarredArticles(webFeedIDs, $0) }, callback) + func fetchStarredArticlesAsync(_ webFeedIDs: Set, _ completion: @escaping ArticleSetBlock) { + fetchArticlesAsync({ self.fetchStarredArticles(webFeedIDs, $0) }, completion) } private func fetchStarredArticles(_ webFeedIDs: Set, _ database: FMDatabase) -> Set
{ @@ -184,12 +184,12 @@ final class ArticlesTable: DatabaseTable { return articles } - func fetchArticlesMatchingAsync(_ searchString: String, _ webFeedIDs: Set, _ callback: @escaping ArticleSetBlock) { - fetchArticlesAsync({ self.fetchArticlesMatching(searchString, webFeedIDs, $0) }, callback) + func fetchArticlesMatchingAsync(_ searchString: String, _ webFeedIDs: Set, _ completion: @escaping ArticleSetBlock) { + fetchArticlesAsync({ self.fetchArticlesMatching(searchString, webFeedIDs, $0) }, completion) } - func fetchArticlesMatchingWithArticleIDsAsync(_ searchString: String, _ articleIDs: Set, _ callback: @escaping ArticleSetBlock) { - fetchArticlesAsync({ self.fetchArticlesMatchingWithArticleIDs(searchString, articleIDs, $0) }, callback) + func fetchArticlesMatchingWithArticleIDsAsync(_ searchString: String, _ articleIDs: Set, _ completion: @escaping ArticleSetBlock) { + fetchArticlesAsync({ self.fetchArticlesMatchingWithArticleIDs(searchString, articleIDs, $0) }, completion) } private func fetchArticlesMatching(_ searchString: String, _ webFeedIDs: Set, _ database: FMDatabase) -> Set
{ @@ -311,9 +311,9 @@ final class ArticlesTable: DatabaseTable { } } - func fetchStatuses(_ articleIDs: Set, _ createIfNeeded: Bool, _ callback: @escaping (Set?) -> Void) { + func fetchStatuses(_ articleIDs: Set, _ createIfNeeded: Bool, _ completion: @escaping (Set?) -> Void) { guard !queue.isSuspended else { - callback(nil) + completion(nil) return } @@ -327,7 +327,7 @@ final class ArticlesTable: DatabaseTable { } let statuses = Set(statusesDictionary.values) DispatchQueue.main.async { - callback(statuses) + completion(statuses) } } } @@ -357,11 +357,11 @@ final class ArticlesTable: DatabaseTable { } } - func fetchUnreadCount(_ webFeedIDs: Set, _ since: Date, _ callback: @escaping (Int) -> Void) { + func fetchUnreadCount(_ webFeedIDs: Set, _ since: Date, _ completion: @escaping (Int) -> Void) { // Get unread count for today, for instance. if webFeedIDs.isEmpty || queue.isSuspended { - callback(0) + completion(0) return } @@ -377,7 +377,7 @@ final class ArticlesTable: DatabaseTable { let unreadCount = self.numberWithSQLAndParameters(sql, parameters, in: database) DispatchQueue.main.async { - callback(unreadCount) + completion(unreadCount) } } } @@ -416,9 +416,9 @@ final class ArticlesTable: DatabaseTable { } } - func fetchStarredAndUnreadCount(_ webFeedIDs: Set, _ callback: @escaping (Int) -> Void) { + func fetchStarredAndUnreadCount(_ webFeedIDs: Set, _ completion: @escaping (Int) -> Void) { if webFeedIDs.isEmpty || queue.isSuspended { - callback(0) + completion(0) return } @@ -430,19 +430,19 @@ final class ArticlesTable: DatabaseTable { let unreadCount = self.numberWithSQLAndParameters(sql, parameters, in: database) DispatchQueue.main.async { - callback(unreadCount) + completion(unreadCount) } } } // MARK: - Statuses - func fetchUnreadArticleIDsAsync(_ webFeedIDs: Set, _ callback: @escaping (Set) -> Void) { - fetchArticleIDsAsync(.read, false, webFeedIDs, callback) + func fetchUnreadArticleIDsAsync(_ webFeedIDs: Set, _ completion: @escaping (Set) -> Void) { + fetchArticleIDsAsync(.read, false, webFeedIDs, completion) } - func fetchStarredArticleIDsAsync(_ webFeedIDs: Set, _ callback: @escaping (Set) -> Void) { - fetchArticleIDsAsync(.starred, true, webFeedIDs, callback) + func fetchStarredArticleIDsAsync(_ webFeedIDs: Set, _ completion: @escaping (Set) -> Void) { + fetchArticleIDsAsync(.starred, true, webFeedIDs, completion) } func fetchStarredArticleIDs() -> Set { @@ -541,15 +541,15 @@ private extension ArticlesTable { return articles } - private func fetchArticlesAsync(_ fetchMethod: @escaping ArticlesFetchMethod, _ callback: @escaping ArticleSetBlock) { + private func fetchArticlesAsync(_ fetchMethod: @escaping ArticlesFetchMethod, _ completion: @escaping ArticleSetBlock) { guard !queue.isSuspended else { - callback(Set
()) + completion(Set
()) return } queue.runInDatabase { (database) in let articles = fetchMethod(database) DispatchQueue.main.async { - callback(articles) + completion(articles) } } } @@ -702,9 +702,9 @@ private extension ArticlesTable { return articlesWithResultSet(resultSet, database) } - func fetchArticleIDsAsync(_ statusKey: ArticleStatus.Key, _ value: Bool, _ webFeedIDs: Set, _ callback: @escaping (Set) -> Void) { + func fetchArticleIDsAsync(_ statusKey: ArticleStatus.Key, _ value: Bool, _ webFeedIDs: Set, _ completion: @escaping (Set) -> Void) { guard !queue.isSuspended && !webFeedIDs.isEmpty else { - callback(Set()) + completion(Set()) return } queue.runInDatabase { database in @@ -720,14 +720,14 @@ private extension ArticlesTable { guard let resultSet = database.executeQuery(sql, withArgumentsIn: parameters) else { DispatchQueue.main.async { - callback(Set()) + completion(Set()) } return } let articleIDs = resultSet.mapToSet{ $0.string(forColumnIndex: 0) } DispatchQueue.main.async { - callback(articleIDs) + completion(articleIDs) } } } diff --git a/Mac/MainWindow/Detail/DetailViewController.swift b/Mac/MainWindow/Detail/DetailViewController.swift index 0e3def9e9..f5039d07e 100644 --- a/Mac/MainWindow/Detail/DetailViewController.swift +++ b/Mac/MainWindow/Detail/DetailViewController.swift @@ -58,8 +58,8 @@ final class DetailViewController: NSViewController, WKUIDelegate { currentWebViewController = webViewController(for: mode) } - func canScrollDown(_ callback: @escaping (Bool) -> Void) { - currentWebViewController.canScrollDown(callback) + func canScrollDown(_ completion: @escaping (Bool) -> Void) { + currentWebViewController.canScrollDown(completion) } override func scrollPageDown(_ sender: Any?) { diff --git a/Mac/MainWindow/Detail/DetailWebViewController.swift b/Mac/MainWindow/Detail/DetailWebViewController.swift index 1ef693fbe..1a334a958 100644 --- a/Mac/MainWindow/Detail/DetailWebViewController.swift +++ b/Mac/MainWindow/Detail/DetailWebViewController.swift @@ -127,9 +127,9 @@ final class DetailWebViewController: NSViewController, WKUIDelegate { // MARK: Scrolling - func canScrollDown(_ callback: @escaping (Bool) -> Void) { + func canScrollDown(_ completion: @escaping (Bool) -> Void) { fetchScrollInfo { (scrollInfo) in - callback(scrollInfo?.canScrollDown ?? false) + completion(scrollInfo?.canScrollDown ?? false) } } @@ -227,7 +227,7 @@ private extension DetailWebViewController { webView.evaluateJavaScript(render) } - func fetchScrollInfo(_ callback: @escaping (ScrollInfo?) -> Void) { + func fetchScrollInfo(_ completion: @escaping (ScrollInfo?) -> Void) { var javascriptString = "var x = {contentHeight: document.body.scrollHeight, offsetY: document.body.scrollTop}; x" if #available(macOS 10.15, *) { javascriptString = "var x = {contentHeight: document.body.scrollHeight, offsetY: window.pageYOffset}; x" @@ -235,16 +235,16 @@ private extension DetailWebViewController { webView.evaluateJavaScript(javascriptString) { (info, error) in guard let info = info as? [String: Any] else { - callback(nil) + completion(nil) return } guard let contentHeight = info["contentHeight"] as? CGFloat, let offsetY = info["offsetY"] as? CGFloat else { - callback(nil) + completion(nil) return } let scrollInfo = ScrollInfo(contentHeight: contentHeight, viewHeight: self.webView.frame.height, offsetY: offsetY) - callback(scrollInfo) + completion(scrollInfo) } } diff --git a/Mac/MainWindow/Sidebar/SidebarViewController.swift b/Mac/MainWindow/Sidebar/SidebarViewController.swift index 1744a57c6..f1afc1a0e 100644 --- a/Mac/MainWindow/Sidebar/SidebarViewController.swift +++ b/Mac/MainWindow/Sidebar/SidebarViewController.swift @@ -595,19 +595,19 @@ private extension SidebarViewController { return rowView.view(atColumn: 0) as? SidebarCell } - func applyToAvailableCells(_ callback: (SidebarCell, Node) -> Void) { + func applyToAvailableCells(_ completion: (SidebarCell, Node) -> Void) { outlineView.enumerateAvailableRowViews { (rowView: NSTableRowView, row: Int) -> Void in guard let cell = cellForRowView(rowView), let node = nodeForRow(row) else { return } - callback(cell, node) + completion(cell, node) } } - func applyToCellsForRepresentedObject(_ representedObject: AnyObject, _ callback: (SidebarCell, Node) -> Void) { + func applyToCellsForRepresentedObject(_ representedObject: AnyObject, _ completion: (SidebarCell, Node) -> Void) { applyToAvailableCells { (cell, node) in if node.representsSidebarObject(representedObject) { - callback(cell, node) + completion(cell, node) } } } diff --git a/Mac/MainWindow/Timeline/TimelineViewController.swift b/Mac/MainWindow/Timeline/TimelineViewController.swift index 65b7366b1..1ffdfa86a 100644 --- a/Mac/MainWindow/Timeline/TimelineViewController.swift +++ b/Mac/MainWindow/Timeline/TimelineViewController.swift @@ -1027,7 +1027,7 @@ private extension TimelineViewController { return fetchedArticles } - func fetchUnsortedArticlesAsync(for representedObjects: [Any], callback: @escaping ArticleSetBlock) { + func fetchUnsortedArticlesAsync(for representedObjects: [Any], completion: @escaping ArticleSetBlock) { // The callback will *not* be called if the fetch is no longer relevant — that is, // if it’s been superseded by a newer fetch, or the timeline was emptied, etc., it won’t get called. precondition(Thread.isMainThread) @@ -1038,7 +1038,7 @@ private extension TimelineViewController { guard !operation.isCanceled, let strongSelf = self, operation.id == strongSelf.fetchSerialNumber else { return } - callback(articles) + completion(articles) } fetchRequestQueue.add(fetchOperation) } diff --git a/Shared/Favicons/FaviconURLFinder.swift b/Shared/Favicons/FaviconURLFinder.swift index 766ad0451..654dd1f3b 100644 --- a/Shared/Favicons/FaviconURLFinder.swift +++ b/Shared/Favicons/FaviconURLFinder.swift @@ -13,15 +13,15 @@ import RSParser struct FaviconURLFinder { - static func findFaviconURLs(_ homePageURL: String, _ callback: @escaping ([String]?) -> Void) { + static func findFaviconURLs(_ homePageURL: String, _ completion: @escaping ([String]?) -> Void) { guard let _ = URL(string: homePageURL) else { - callback(nil) + completion(nil) return } HTMLMetadataDownloader.downloadMetadata(for: homePageURL) { (htmlMetadata) in - callback(htmlMetadata?.faviconLinks) + completion(htmlMetadata?.faviconLinks) } } } diff --git a/Shared/Favicons/SingleFaviconDownloader.swift b/Shared/Favicons/SingleFaviconDownloader.swift index a7d4fd288..d4b91283f 100644 --- a/Shared/Favicons/SingleFaviconDownloader.swift +++ b/Shared/Favicons/SingleFaviconDownloader.swift @@ -93,22 +93,22 @@ private extension SingleFaviconDownloader { } } - func readFromDisk(_ callback: @escaping (RSImage?) -> Void) { + func readFromDisk(_ completion: @escaping (RSImage?) -> Void) { guard diskStatus != .notOnDisk else { - callback(nil) + completion(nil) return } queue.async { if let data = self.diskCache[self.diskKey], !data.isEmpty { - RSImage.rs_image(with: data, imageResultBlock: callback) + RSImage.rs_image(with: data, imageResultBlock: completion) return } DispatchQueue.main.async { - callback(nil) + completion(nil) } } } @@ -127,10 +127,10 @@ private extension SingleFaviconDownloader { } } - func downloadFavicon(_ callback: @escaping (RSImage?) -> Void) { + func downloadFavicon(_ completion: @escaping (RSImage?) -> Void) { guard let url = URL(string: faviconURL) else { - callback(nil) + completion(nil) return } @@ -138,7 +138,7 @@ private extension SingleFaviconDownloader { if let data = data, !data.isEmpty, let response = response, response.statusIsOK, error == nil { self.saveToDisk(data) - RSImage.rs_image(with: data, imageResultBlock: callback) + RSImage.rs_image(with: data, imageResultBlock: completion) return } @@ -146,7 +146,7 @@ private extension SingleFaviconDownloader { appDelegate.logMessage("Error downloading favicon at \(url): \(error)", type: .warning) } - callback(nil) + completion(nil) } } diff --git a/Shared/HTMLMetadata/HTMLMetadataDownloader.swift b/Shared/HTMLMetadata/HTMLMetadataDownloader.swift index 1e7b325d1..327257782 100644 --- a/Shared/HTMLMetadata/HTMLMetadataDownloader.swift +++ b/Shared/HTMLMetadata/HTMLMetadataDownloader.swift @@ -14,9 +14,9 @@ struct HTMLMetadataDownloader { static let serialDispatchQueue = DispatchQueue(label: "HTMLMetadataDownloader") - static func downloadMetadata(for url: String, _ callback: @escaping (RSHTMLMetadata?) -> Void) { + static func downloadMetadata(for url: String, _ completion: @escaping (RSHTMLMetadata?) -> Void) { guard let actualURL = URL(string: url) else { - callback(nil) + completion(nil) return } @@ -24,7 +24,7 @@ struct HTMLMetadataDownloader { if let data = data, !data.isEmpty, let response = response, response.statusIsOK, error == nil { let urlToUse = response.url ?? actualURL let parserData = ParserData(url: urlToUse.absoluteString, data: data) - parseMetadata(with: parserData, callback) + parseMetadata(with: parserData, completion) return } @@ -32,15 +32,15 @@ struct HTMLMetadataDownloader { appDelegate.logMessage("Error downloading metadata at \(url): \(error)", type: .warning) } - callback(nil) + completion(nil) } } - private static func parseMetadata(with parserData: ParserData, _ callback: @escaping (RSHTMLMetadata?) -> Void) { + private static func parseMetadata(with parserData: ParserData, _ completion: @escaping (RSHTMLMetadata?) -> Void) { serialDispatchQueue.async { let htmlMetadata = RSHTMLMetadataParser.htmlMetadata(with: parserData) DispatchQueue.main.async { - callback(htmlMetadata) + completion(htmlMetadata) } } } diff --git a/Shared/Images/ImageDownloader.swift b/Shared/Images/ImageDownloader.swift index 299aba887..289ef74fe 100644 --- a/Shared/Images/ImageDownloader.swift +++ b/Shared/Images/ImageDownloader.swift @@ -76,27 +76,27 @@ private extension ImageDownloader { } } - func readFromDisk(_ url: String, _ callback: @escaping (Data?) -> Void) { + func readFromDisk(_ url: String, _ completion: @escaping (Data?) -> Void) { queue.async { if let data = self.diskCache[self.diskKey(url)], !data.isEmpty { DispatchQueue.main.async { - callback(data) + completion(data) } return } DispatchQueue.main.async { - callback(nil) + completion(nil) } } } - func downloadImage(_ url: String, _ callback: @escaping (Data?) -> Void) { + func downloadImage(_ url: String, _ completion: @escaping (Data?) -> Void) { guard let imageURL = URL(string: url) else { - callback(nil) + completion(nil) return } @@ -104,7 +104,7 @@ private extension ImageDownloader { if let data = data, !data.isEmpty, let response = response, response.statusIsOK, error == nil { self.saveToDisk(url, data) - callback(data) + completion(data) return } @@ -115,7 +115,7 @@ private extension ImageDownloader { appDelegate.logMessage("Error downloading image at \(url): \(error)", type: .warning) } - callback(nil) + completion(nil) } } diff --git a/Shared/SmartFeeds/SearchFeedDelegate.swift b/Shared/SmartFeeds/SearchFeedDelegate.swift index aacbc704c..dbeac37bd 100644 --- a/Shared/SmartFeeds/SearchFeedDelegate.swift +++ b/Shared/SmartFeeds/SearchFeedDelegate.swift @@ -31,7 +31,7 @@ struct SearchFeedDelegate: SmartFeedDelegate { self.fetchType = .search(searchString) } - func fetchUnreadCount(for: Account, callback: @escaping (Int) -> Void) { + func fetchUnreadCount(for: Account, completion: @escaping (Int) -> Void) { // TODO: after 5.0 } } diff --git a/Shared/SmartFeeds/SearchTimelineFeedDelegate.swift b/Shared/SmartFeeds/SearchTimelineFeedDelegate.swift index 3d2af5fb5..f67a8b397 100644 --- a/Shared/SmartFeeds/SearchTimelineFeedDelegate.swift +++ b/Shared/SmartFeeds/SearchTimelineFeedDelegate.swift @@ -31,7 +31,7 @@ struct SearchTimelineFeedDelegate: SmartFeedDelegate { self.fetchType = .searchWithArticleIDs(searchString, articleIDs) } - func fetchUnreadCount(for: Account, callback: @escaping (Int) -> Void) { + func fetchUnreadCount(for: Account, completion: @escaping (Int) -> Void) { // TODO: after 5.0 } } diff --git a/Shared/SmartFeeds/SmartFeed.swift b/Shared/SmartFeeds/SmartFeed.swift index b6302ad44..75090bbff 100644 --- a/Shared/SmartFeeds/SmartFeed.swift +++ b/Shared/SmartFeeds/SmartFeed.swift @@ -84,16 +84,16 @@ extension SmartFeed: ArticleFetcher { return delegate.fetchArticles() } - func fetchArticlesAsync(_ callback: @escaping ArticleSetBlock) { - delegate.fetchArticlesAsync(callback) + func fetchArticlesAsync(_ completion: @escaping ArticleSetBlock) { + delegate.fetchArticlesAsync(completion) } func fetchUnreadArticles() -> Set
{ return delegate.fetchUnreadArticles() } - func fetchUnreadArticlesAsync(_ callback: @escaping ArticleSetBlock) { - delegate.fetchUnreadArticlesAsync(callback) + func fetchUnreadArticlesAsync(_ completion: @escaping ArticleSetBlock) { + delegate.fetchUnreadArticlesAsync(completion) } } diff --git a/Shared/SmartFeeds/SmartFeedDelegate.swift b/Shared/SmartFeeds/SmartFeedDelegate.swift index 2f831a8e8..9bd7d5341 100644 --- a/Shared/SmartFeeds/SmartFeedDelegate.swift +++ b/Shared/SmartFeeds/SmartFeedDelegate.swift @@ -13,7 +13,7 @@ import RSCore protocol SmartFeedDelegate: FeedIdentifiable, DisplayNameProvider, ArticleFetcher, SmallIconProvider { var fetchType: FetchType { get } - func fetchUnreadCount(for: Account, callback: @escaping (Int) -> Void) + func fetchUnreadCount(for: Account, completion: @escaping (Int) -> Void) } extension SmartFeedDelegate { @@ -22,15 +22,15 @@ extension SmartFeedDelegate { return AccountManager.shared.fetchArticles(fetchType) } - func fetchArticlesAsync(_ callback: @escaping ArticleSetBlock) { - AccountManager.shared.fetchArticlesAsync(fetchType, callback) + func fetchArticlesAsync(_ completion: @escaping ArticleSetBlock) { + AccountManager.shared.fetchArticlesAsync(fetchType, completion) } func fetchUnreadArticles() -> Set
{ return fetchArticles().unreadArticles() } - func fetchUnreadArticlesAsync(_ callback: @escaping ArticleSetBlock) { - fetchArticlesAsync{ callback($0.unreadArticles()) } + func fetchUnreadArticlesAsync(_ completion: @escaping ArticleSetBlock) { + fetchArticlesAsync{ completion($0.unreadArticles()) } } } diff --git a/Shared/SmartFeeds/StarredFeedDelegate.swift b/Shared/SmartFeeds/StarredFeedDelegate.swift index 81f05fbf9..000dca8c4 100644 --- a/Shared/SmartFeeds/StarredFeedDelegate.swift +++ b/Shared/SmartFeeds/StarredFeedDelegate.swift @@ -23,7 +23,7 @@ struct StarredFeedDelegate: SmartFeedDelegate { let fetchType: FetchType = .starred var smallIcon: IconImage? = AppAssets.starredFeedImage - func fetchUnreadCount(for account: Account, callback: @escaping (Int) -> Void) { - account.fetchUnreadCountForStarredArticles(callback) + func fetchUnreadCount(for account: Account, completion: @escaping (Int) -> Void) { + account.fetchUnreadCountForStarredArticles(completion) } } diff --git a/Shared/SmartFeeds/TodayFeedDelegate.swift b/Shared/SmartFeeds/TodayFeedDelegate.swift index 0bd70f653..918e82054 100644 --- a/Shared/SmartFeeds/TodayFeedDelegate.swift +++ b/Shared/SmartFeeds/TodayFeedDelegate.swift @@ -21,8 +21,8 @@ struct TodayFeedDelegate: SmartFeedDelegate { let fetchType = FetchType.today var smallIcon: IconImage? = AppAssets.todayFeedImage - func fetchUnreadCount(for account: Account, callback: @escaping (Int) -> Void) { - account.fetchUnreadCountForToday(callback) + func fetchUnreadCount(for account: Account, completion: @escaping (Int) -> Void) { + account.fetchUnreadCountForToday(completion) } } diff --git a/Shared/SmartFeeds/UnreadFeed.swift b/Shared/SmartFeeds/UnreadFeed.swift index 053390c4c..b855f5f56 100644 --- a/Shared/SmartFeeds/UnreadFeed.swift +++ b/Shared/SmartFeeds/UnreadFeed.swift @@ -65,15 +65,15 @@ extension UnreadFeed: ArticleFetcher { return fetchUnreadArticles() } - func fetchArticlesAsync(_ callback: @escaping ArticleSetBlock) { - fetchUnreadArticlesAsync(callback) + func fetchArticlesAsync(_ completion: @escaping ArticleSetBlock) { + fetchUnreadArticlesAsync(completion) } func fetchUnreadArticles() -> Set
{ return AccountManager.shared.fetchArticles(fetchType) } - func fetchUnreadArticlesAsync(_ callback: @escaping ArticleSetBlock) { - AccountManager.shared.fetchArticlesAsync(fetchType, callback) + func fetchUnreadArticlesAsync(_ completion: @escaping ArticleSetBlock) { + AccountManager.shared.fetchArticlesAsync(fetchType, completion) } } diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index ccbc199dd..127e5d333 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -764,20 +764,20 @@ private extension MasterFeedViewController { applyToCellsForRepresentedObject(representedObject, configure) } - func applyToCellsForRepresentedObject(_ representedObject: AnyObject, _ callback: (MasterFeedTableViewCell, Node) -> Void) { + func applyToCellsForRepresentedObject(_ representedObject: AnyObject, _ completion: (MasterFeedTableViewCell, Node) -> Void) { applyToAvailableCells { (cell, node) in if node.representedObject === representedObject { - callback(cell, node) + completion(cell, node) } } } - func applyToAvailableCells(_ callback: (MasterFeedTableViewCell, Node) -> Void) { + func applyToAvailableCells(_ completion: (MasterFeedTableViewCell, Node) -> Void) { tableView.visibleCells.forEach { cell in guard let indexPath = tableView.indexPath(for: cell), let node = dataSource.itemIdentifier(for: indexPath) else { return } - callback(cell as! MasterFeedTableViewCell, node) + completion(cell as! MasterFeedTableViewCell, node) } } diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 917677981..9cb6d5ef1 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -1630,7 +1630,7 @@ private extension SceneCoordinator { } - func fetchUnsortedArticlesAsync(for representedObjects: [Any], callback: @escaping ArticleSetBlock) { + func fetchUnsortedArticlesAsync(for representedObjects: [Any], completion: @escaping ArticleSetBlock) { // The callback will *not* be called if the fetch is no longer relevant — that is, // if it’s been superseded by a newer fetch, or the timeline was emptied, etc., it won’t get called. precondition(Thread.isMainThread) @@ -1641,7 +1641,7 @@ private extension SceneCoordinator { guard !operation.isCanceled, let strongSelf = self, operation.id == strongSelf.fetchSerialNumber else { return } - callback(articles) + completion(articles) } fetchRequestQueue.add(fetchOperation) diff --git a/submodules/RSDatabase b/submodules/RSDatabase index b2ad9272e..8a574c7dc 160000 --- a/submodules/RSDatabase +++ b/submodules/RSDatabase @@ -1 +1 @@ -Subproject commit b2ad9272e8003b0aba3c8c961239663ac501f00b +Subproject commit 8a574c7dc24156d9d01c6c9fe7d4c9e099c54a96 diff --git a/submodules/RSParser b/submodules/RSParser index 81c400a76..9e5f5d644 160000 --- a/submodules/RSParser +++ b/submodules/RSParser @@ -1 +1 @@ -Subproject commit 81c400a7665309a08414bf43ca5161d90d072501 +Subproject commit 9e5f5d644c1291daf516b9466cb23592374f8e10 diff --git a/submodules/RSWeb b/submodules/RSWeb index b2dd50f1f..e51306297 160000 --- a/submodules/RSWeb +++ b/submodules/RSWeb @@ -1 +1 @@ -Subproject commit b2dd50f1ff2a64c09a543d00bc35c8a66c1fc2b6 +Subproject commit e513062972cd8097179ed39999f327ad29c8a4e1