diff --git a/Account/Sources/Account/AccountDelegates/FeedlyAccountDelegate.swift b/Account/Sources/Account/AccountDelegates/FeedlyAccountDelegate.swift index 935174019..754a52e4e 100644 --- a/Account/Sources/Account/AccountDelegates/FeedlyAccountDelegate.swift +++ b/Account/Sources/Account/AccountDelegates/FeedlyAccountDelegate.swift @@ -614,6 +614,32 @@ final class FeedlyAccountDelegate: AccountDelegate { return credentials } + func fetchUpdatedArticleIDs(newerThan date: Date) async throws -> Set { + + // To replace FeedlyGetUpdatedArticleIDsOperation + + guard let userID = credentials?.username else { return Set() } + + var articleIDs = Set() + let resource = FeedlyCategoryResourceID.Global.all(for: userID) + + func fetchStreamIDs(_ continuation: String?) async throws { + + let streamIDs = try await caller.getStreamIDs(for: resource, continuation: continuation, newerThan: date, unreadOnly: nil) + + articleIDs.formUnion(streamIDs.ids) + + guard let continuation = streamIDs.continuation else { + os_log(.debug, log: log, "%{public}i articles updated since last successful sync start date.", articleIDs.count) + return + } + + try await fetchStreamIDs(continuation) + } + + return articleIDs + } + // MARK: Suspend and Resume (for iOS) /// Suspend all network activity