Make Feedbin syncing fetch articles.

This commit is contained in:
Brent Simmons 2024-06-18 16:03:30 -07:00
parent 46921342f4
commit 07644201f3

View File

@ -77,14 +77,16 @@ public enum FeedbinAccountDelegateError: String, Error {
func refreshAll(for account: Account) async throws { func refreshAll(for account: Account) async throws {
refreshProgress.addToNumberOfTasksAndRemaining(5) refreshProgress.addToNumberOfTasks(7)
defer {
refreshProgress.clear()
}
do { do {
try await refreshAccount(account) try await refreshAccount(account) // 3 tasks
try await refreshArticlesAndStatuses(account) // 4 tasks
} catch { } catch {
refreshProgress.clear() throw AccountError.wrappedError(error: error, account: account)
let wrappedError = AccountError.wrappedError(error: error, account: account)
throw wrappedError
} }
} }
@ -509,22 +511,27 @@ private extension FeedbinAccountDelegate {
forceExpireFolderFeedRelationship(account, tags) forceExpireFolderFeedRelationship(account, tags)
let taggings = try await caller.retrieveTaggings() let taggings = try await caller.retrieveTaggings()
BatchUpdate.shared.perform { BatchUpdate.shared.perform {
self.syncFolders(account, tags) self.syncFolders(account, tags)
self.syncFeeds(account, subscriptions) self.syncFeeds(account, subscriptions)
self.syncFeedFolderRelationship(account, taggings) self.syncFeedFolderRelationship(account, taggings)
} }
refreshProgress.completeTask() refreshProgress.completeTask()
} }
func refreshArticlesAndStatuses(_ account: Account) async throws { func refreshArticlesAndStatuses(_ account: Account) async throws {
try await sendArticleStatus(for: account) try await sendArticleStatus(for: account)
refreshProgress.completeTask()
try await refreshArticleStatus(for: account) try await refreshArticleStatus(for: account)
refreshProgress.completeTask()
try await refreshArticles(account) try await refreshArticles(account)
refreshProgress.completeTask()
try await refreshMissingArticles(account) try await refreshMissingArticles(account)
refreshProgress.completeTask()
} }
// This function can be deleted if Feedbin updates their taggings.json service to // This function can be deleted if Feedbin updates their taggings.json service to