diff --git a/Account/Sources/Account/Account.swift b/Account/Sources/Account/Account.swift index b78d99d89..48040be69 100644 --- a/Account/Sources/Account/Account.swift +++ b/Account/Sources/Account/Account.swift @@ -941,12 +941,11 @@ public enum FetchType { } // Delete the articles associated with the given set of articleIDs - func delete(articleIDs: Set, completion: DatabaseCompletionBlock? = nil) { + func delete(articleIDs: Set) async throws { guard !articleIDs.isEmpty else { - completion?(nil) return } - database.delete(articleIDs: articleIDs, completion: completion) + try await database.delete(articleIDs: articleIDs) } /// Empty caches that can reasonably be emptied. Call when the app goes in the background, for instance. diff --git a/Account/Sources/Account/CloudKit/CloudKitArticlesZoneDelegate.swift b/Account/Sources/Account/CloudKit/CloudKitArticlesZoneDelegate.swift index ea0c284f5..2433dc693 100644 --- a/Account/Sources/Account/CloudKit/CloudKitArticlesZoneDelegate.swift +++ b/Account/Sources/Account/CloudKit/CloudKitArticlesZoneDelegate.swift @@ -71,9 +71,7 @@ private extension CloudKitArticlesZoneDelegate { Task { @MainActor in try? await self.database.deleteSelectedForProcessing(Array(deletableArticleIDs)) - self.account?.delete(articleIDs: deletableArticleIDs) { _ in - completion() - } + try? await self.account?.delete(articleIDs: deletableArticleIDs) } } diff --git a/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesDatabaseCompatibility.swift b/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesDatabaseCompatibility.swift index e4e92a54d..ee648e638 100644 --- a/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesDatabaseCompatibility.swift +++ b/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesDatabaseCompatibility.swift @@ -56,19 +56,6 @@ public extension ArticlesDatabase { } } - /// Delete articles - nonisolated func delete(articleIDs: Set, completion: DatabaseCompletionBlock?) { - - Task { - do { - try await delete(articleIDs: articleIDs) - callDatabaseCompletion(completion) - } catch { - callDatabaseCompletion(completion, .suspended) - } - } - } - // MARK: - Status /// Fetch the articleIDs of unread articles.