Use UnreadCountDictionary instead of UnreadCountTable.

This commit is contained in:
Brent Simmons 2017-09-16 10:21:39 -07:00
parent 72cfc84001
commit 66129841a5
2 changed files with 4 additions and 5 deletions

View File

@ -115,16 +115,16 @@ final class ArticlesTable: DatabaseTable {
func fetchUnreadCounts(_ feeds: Set<Feed>, _ completion: @escaping UnreadCountCompletionBlock) {
let feedIDs = feeds.feedIDs()
var unreadCountTable = UnreadCountTable()
var unreadCountDictionary = UnreadCountDictionary()
queue.fetch { (database) in
for feedID in feedIDs {
unreadCountTable[feedID] = self.fetchUnreadCount(feedID, database)
unreadCountDictionary[feedID] = self.fetchUnreadCount(feedID, database)
}
DispatchQueue.main.async() {
completion(unreadCountTable)
completion(unreadCountDictionary)
}
}
}

View File

@ -13,8 +13,7 @@ import RSParser
import Data
public typealias ArticleResultBlock = (Set<Article>) -> Void
public typealias UnreadCountTable = [String: Int] // feedID: unreadCount
public typealias UnreadCountCompletionBlock = (UnreadCountTable) -> Void //feedID: unreadCount
public typealias UnreadCountCompletionBlock = (UnreadCountDictionary) -> Void
public typealias UpdateArticlesWithFeedCompletionBlock = (Set<Article>?, Set<Article>?) -> Void //newArticles, updateArticles
public final class Database {