From f0634d7ab07e59f2acb6cdceee2cd6192c03741a Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Wed, 3 Apr 2024 21:53:11 -0700 Subject: [PATCH] Delete no-longer-used fetchStarredAndUnreadCount completion block version. --- Account/Sources/Account/Account.swift | 5 ---- .../ArticlesDatabaseCompatibility.swift | 24 ------------------- Shared/SmartFeeds/StarredFeedDelegate.swift | 4 ---- 3 files changed, 33 deletions(-) diff --git a/Account/Sources/Account/Account.swift b/Account/Sources/Account/Account.swift index e00aaa77e..b78d99d89 100644 --- a/Account/Sources/Account/Account.swift +++ b/Account/Sources/Account/Account.swift @@ -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 diff --git a/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesDatabaseCompatibility.swift b/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesDatabaseCompatibility.swift index e6449bcf8..e4e92a54d 100644 --- a/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesDatabaseCompatibility.swift +++ b/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesDatabaseCompatibility.swift @@ -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 -public typealias SingleUnreadCountCompletionBlock = @Sendable (SingleUnreadCountResult) -> Void - public typealias UpdateArticlesResult = Result 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, 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 diff --git a/Shared/SmartFeeds/StarredFeedDelegate.swift b/Shared/SmartFeeds/StarredFeedDelegate.swift index 91fe462fd..82dd42a3d 100644 --- a/Shared/SmartFeeds/StarredFeedDelegate.swift +++ b/Shared/SmartFeeds/StarredFeedDelegate.swift @@ -29,8 +29,4 @@ import Account (try? await account.unreadCountForStarredArticles()) ?? 0 } - - func fetchUnreadCount(for account: Account, completion: @escaping SingleUnreadCountCompletionBlock) { - account.fetchUnreadCountForStarredArticles(completion) - } }