Continue converting ArticlesDatabase to async/await.

This commit is contained in:
Brent Simmons
2023-10-01 21:35:19 -07:00
parent 373d7ed98b
commit 085d8ec06c
4 changed files with 32 additions and 91 deletions

View File

@@ -1471,14 +1471,12 @@ private extension Account {
}
func fetchUnreadCount(_ feed: Feed, _ completion: VoidCompletionBlock?) {
database.fetchUnreadCount(feed.feedID) { result in
Task { @MainActor in
if let unreadCount = try? result.get() {
feed.unreadCount = unreadCount
}
completion?()
}
}
Task { @MainActor in
if let unreadCount = try? await database.unreadCountForFeed(feed.feedID) {
feed.unreadCount = unreadCount
}
completion?()
}
}
func fetchUnreadCounts(_ feeds: Set<Feed>, _ completion: VoidCompletionBlock?) {