Start work on replacements for Feedly operations. This function will eventually replace FeedlyGetUpdatedArticleIDsOperation.

This commit is contained in:
Brent Simmons 2024-04-26 07:51:42 -07:00
parent ed957d92cf
commit 8e3c0b3683
1 changed files with 26 additions and 0 deletions

View File

@ -614,6 +614,32 @@ final class FeedlyAccountDelegate: AccountDelegate {
return credentials
}
func fetchUpdatedArticleIDs(newerThan date: Date) async throws -> Set<String> {
// To replace FeedlyGetUpdatedArticleIDsOperation
guard let userID = credentials?.username else { return Set<String>() }
var articleIDs = Set<String>()
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