Delete no-longer-used fetchStarredAndUnreadCount completion block version.
This commit is contained in:
parent
2eeb0050e2
commit
f0634d7ab0
|
@ -749,10 +749,6 @@ public enum FetchType {
|
|||
try await database.starredAndUnreadCount(feedIDs: allFeedIDs()) ?? 0
|
||||
}
|
||||
|
||||
public func fetchUnreadCountForStarredArticles(_ completion: @escaping SingleUnreadCountCompletionBlock) {
|
||||
database.fetchStarredAndUnreadCount(for: flattenedFeeds().feedIDs(), completion: completion)
|
||||
}
|
||||
|
||||
public func fetchUnreadArticleIDs(_ completion: @escaping ArticleIDsCompletionBlock) {
|
||||
database.fetchUnreadArticleIDsAsync(completion: completion)
|
||||
}
|
||||
|
@ -1402,7 +1398,6 @@ extension Account {
|
|||
public func existingFeed(withExternalID externalID: String) -> Feed? {
|
||||
return externalIDToFeedDictionary[externalID]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - OPMLRepresentable
|
||||
|
|
|
@ -14,9 +14,6 @@ import Articles
|
|||
// This file exists for compatibility — it provides nonisolated functions and callback-based APIs.
|
||||
// It will go away as we adopt structured concurrency.
|
||||
|
||||
public typealias SingleUnreadCountResult = Result<Int, DatabaseError>
|
||||
public typealias SingleUnreadCountCompletionBlock = @Sendable (SingleUnreadCountResult) -> Void
|
||||
|
||||
public typealias UpdateArticlesResult = Result<ArticleChanges, DatabaseError>
|
||||
public typealias UpdateArticlesCompletionBlock = @Sendable (UpdateArticlesResult) -> Void
|
||||
|
||||
|
@ -31,20 +28,6 @@ public typealias ArticleStatusesResultBlock = (ArticleStatusesResult) -> Void
|
|||
|
||||
public extension ArticlesDatabase {
|
||||
|
||||
// MARK: - Unread Counts
|
||||
|
||||
nonisolated func fetchStarredAndUnreadCount(for feedIDs: Set<String>, completion: @escaping SingleUnreadCountCompletionBlock) {
|
||||
|
||||
Task {
|
||||
do {
|
||||
let unreadCount = try await starredAndUnreadCount(feedIDs: feedIDs)!
|
||||
callSingleUnreadCountCompletion(completion, .success(unreadCount))
|
||||
} catch {
|
||||
callSingleUnreadCountCompletion(completion, .failure(.suspended))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Saving, Updating, and Deleting Articles
|
||||
|
||||
/// Update articles and save new ones — for feed-based systems (local and iCloud).
|
||||
|
@ -165,13 +148,6 @@ public extension ArticlesDatabase {
|
|||
}
|
||||
}
|
||||
|
||||
nonisolated private func callSingleUnreadCountCompletion(_ completion: @escaping SingleUnreadCountCompletionBlock, _ result: SingleUnreadCountResult) {
|
||||
|
||||
Task { @MainActor in
|
||||
completion(result)
|
||||
}
|
||||
}
|
||||
|
||||
nonisolated private func callUpdateArticlesCompletion(_ completion: @escaping UpdateArticlesCompletionBlock, _ result: UpdateArticlesResult) {
|
||||
|
||||
Task { @MainActor in
|
||||
|
|
|
@ -29,8 +29,4 @@ import Account
|
|||
|
||||
(try? await account.unreadCountForStarredArticles()) ?? 0
|
||||
}
|
||||
|
||||
func fetchUnreadCount(for account: Account, completion: @escaping SingleUnreadCountCompletionBlock) {
|
||||
account.fetchUnreadCountForStarredArticles(completion)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue