mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-31 19:24:55 +01:00
Make updateUnreadCounts compatible with database changes.
This commit is contained in:
parent
9a36051d8a
commit
f2052f110f
@ -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?()
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user