Add batch update block to fetch to prevent the Feeds list from dancing around.

This commit is contained in:
Maurice Parker 2020-03-31 11:18:52 -05:00
parent 1be5dc8a54
commit 31e06cd24a
1 changed files with 3 additions and 0 deletions

View File

@ -69,14 +69,17 @@ final class CloudKitAccountDelegate: AccountDelegate {
}
func refreshAll(for account: Account, completion: @escaping (Result<Void, Error>) -> Void) {
BatchUpdate.shared.start()
accountZone.fetchChangesInZone() { result in
switch result {
case .success:
self.refresher.refreshFeeds(account.flattenedWebFeeds()) {
BatchUpdate.shared.end()
account.metadata.lastArticleFetchEndTime = Date()
completion(.success(()))
}
case .failure(let error):
BatchUpdate.shared.end()
completion(.failure(error))
}
}