Delete fetchArticlesAsync method with completion handler in favor of async/await articlesForFeed method.

This commit is contained in:
Brent Simmons
2023-09-24 11:58:29 -07:00
parent 12fb814bff
commit 6c33ccbceb
2 changed files with 7 additions and 14 deletions

View File

@@ -1178,16 +1178,13 @@ private extension Account {
}
func fetchArticlesAsync(feed: Feed, _ completion: @escaping ArticleSetResultBlock) {
database.fetchArticlesAsync(feed.feedID) { [weak self] articleSetResult in
Task { @MainActor [weak self] in
switch articleSetResult {
case .success(let articles):
self?.validateUnreadCount(feed, articles)
completion(.success(articles))
case .failure(let databaseError):
completion(.failure(databaseError))
}
}
Task { @MainActor in
do {
let articles = try await self.articlesForFeed(feed)
completion(.success(articles))
} catch {
completion(.failure(error as! DatabaseError))
}
}
}

View File

@@ -140,10 +140,6 @@ public typealias ArticleStatusesResultBlock = (ArticleStatusesResult) -> Void
try await articlesTable.articlesForFeed(feedID)
}
public func fetchArticlesAsync(_ feedID: String, _ completion: @escaping ArticleSetResultBlock) {
articlesTable.fetchArticlesAsync(feedID, completion)
}
public func fetchArticlesAsync(_ feedIDs: Set<String>, _ completion: @escaping ArticleSetResultBlock) {
articlesTable.fetchArticlesAsync(feedIDs, completion)
}