mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-30 17:29:23 +00:00
Make updateUnreadCounts compatible with database changes.
This commit is contained in:
1 parent
9a36051d8a
commit
f2052f110f
1 file changed
+9
-5
@@ -601,17 +601,21 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
||||
structureDidChange()
|
||||
}
|
||||
|
||||
public func updateUnreadCounts(for webFeeds: Set<WebFeed>, completion: (() -> Void)? = nil) {
|
||||
public func updateUnreadCounts(for webFeeds: Set<WebFeed>, completion: VoidCompletionBlock? = nil) {
|
||||
if webFeeds.isEmpty {
|
||||
completion?()
|
||||
return
|
||||
}
|
||||
|
||||
database.fetchUnreadCounts(for: webFeeds.webFeedIDs()) { (unreadCountDictionary) in
|
||||
for webFeed in webFeeds {
|
||||
if let unreadCount = unreadCountDictionary[webFeed.webFeedID] {
|
||||
webFeed.unreadCount = unreadCount
|
||||
database.fetchUnreadCounts(for: webFeeds.webFeedIDs()) { unreadCountDictionaryResult in
|
||||
if let unreadCountDictionary = try? unreadCountDictionaryResult.get() {
|
||||
for webFeed in webFeeds {
|
||||
if let unreadCount = unreadCountDictionary[webFeed.webFeedID] {
|
||||
webFeed.unreadCount = unreadCount
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
completion?()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user