diff --git a/Account/Sources/Account/AccountDelegates/FeedlyAccountDelegate.swift b/Account/Sources/Account/AccountDelegates/FeedlyAccountDelegate.swift index e2df21b58..09367a6e6 100644 --- a/Account/Sources/Account/AccountDelegates/FeedlyAccountDelegate.swift +++ b/Account/Sources/Account/AccountDelegates/FeedlyAccountDelegate.swift @@ -839,15 +839,13 @@ final class FeedlyAccountDelegate: AccountDelegate { return try await account.fetchArticleIDsForStatusesWithoutArticlesNewerThanCutoffDate() } - func fetchRemoteStarredArticleIDs() async throws -> Set { + func fetchRemoteArticleIDs(resource: FeedlyResourceID, unreadOnly: Bool? = nil) async throws -> Set { - guard let userID else { return Set() } - - let resource = FeedlyTagResourceID.Global.saved(for: userID) var remoteArticleIDs = Set() func fetchIDs(_ continuation: String? = nil) async throws { - let streamIDs = try await caller.getStreamIDs(for: resource, continuation: continuation, newerThan: nil, unreadOnly: nil) + + let streamIDs = try await caller.getStreamIDs(for: resource, continuation: continuation, newerThan: nil, unreadOnly: unreadOnly) remoteArticleIDs.formUnion(streamIDs.ids) guard let continuation = streamIDs.continuation else { // finished fetching article IDs? @@ -861,6 +859,22 @@ final class FeedlyAccountDelegate: AccountDelegate { return remoteArticleIDs } + func fetchRemoteUnreadArticleIDs() async throws -> Set { + + guard let userID else { return Set() } + + let resource = FeedlyCategoryResourceID.Global.all(for: userID) + return try await fetchRemoteArticleIDs(resource: resource, unreadOnly: true) + } + + func fetchRemoteStarredArticleIDs() async throws -> Set { + + guard let userID else { return Set() } + + let resource = FeedlyTagResourceID.Global.saved(for: userID) + return try await fetchRemoteArticleIDs(resource: resource) + } + func processStarredArticleIDs(remoteArticleIDs: Set) async throws { guard let account else { return }