Remove batch update commands that were interfering with the Sidebar getting rebuilt

This commit is contained in:
Maurice Parker 2021-03-15 17:49:33 -05:00
parent f1e4d70481
commit 5fd4dae3e6

View File

@ -668,7 +668,6 @@ private extension CloudKitAccountDelegate {
} }
func createRSSWebFeed(for account: Account, url: URL, editedName: String?, container: Container, completion: @escaping (Result<WebFeed, Error>) -> Void) { func createRSSWebFeed(for account: Account, url: URL, editedName: String?, container: Container, completion: @escaping (Result<WebFeed, Error>) -> Void) {
BatchUpdate.shared.start()
refreshProgress.addToNumberOfTasksAndRemaining(5) refreshProgress.addToNumberOfTasksAndRemaining(5)
FeedFinder.find(url: url) { result in FeedFinder.find(url: url) { result in
@ -676,14 +675,12 @@ private extension CloudKitAccountDelegate {
switch result { switch result {
case .success(let feedSpecifiers): case .success(let feedSpecifiers):
guard let bestFeedSpecifier = FeedSpecifier.bestFeed(in: feedSpecifiers), let url = URL(string: bestFeedSpecifier.urlString) else { guard let bestFeedSpecifier = FeedSpecifier.bestFeed(in: feedSpecifiers), let url = URL(string: bestFeedSpecifier.urlString) else {
BatchUpdate.shared.end()
self.refreshProgress.completeTasks(4) self.refreshProgress.completeTasks(4)
completion(.failure(AccountError.createErrorNotFound)) completion(.failure(AccountError.createErrorNotFound))
return return
} }
if account.hasWebFeed(withURL: bestFeedSpecifier.urlString) { if account.hasWebFeed(withURL: bestFeedSpecifier.urlString) {
BatchUpdate.shared.end()
self.refreshProgress.completeTasks(4) self.refreshProgress.completeTasks(4)
completion(.failure(AccountError.createErrorAlreadySubscribed)) completion(.failure(AccountError.createErrorAlreadySubscribed))
return return
@ -700,7 +697,6 @@ private extension CloudKitAccountDelegate {
account.update(feed, with: parsedFeed) { result in account.update(feed, with: parsedFeed) { result in
switch result { switch result {
case .success: case .success:
BatchUpdate.shared.end()
self.accountZone.createWebFeed(url: bestFeedSpecifier.urlString, self.accountZone.createWebFeed(url: bestFeedSpecifier.urlString,
name: parsedFeed.title, name: parsedFeed.title,
@ -724,7 +720,6 @@ private extension CloudKitAccountDelegate {
} }
case .failure(let error): case .failure(let error):
BatchUpdate.shared.end()
self.refreshProgress.completeTasks(3) self.refreshProgress.completeTasks(3)
completion(.failure(error)) completion(.failure(error))
} }
@ -738,7 +733,6 @@ private extension CloudKitAccountDelegate {
} }
case .failure: case .failure:
BatchUpdate.shared.end()
self.refreshProgress.completeTasks(4) self.refreshProgress.completeTasks(4)
completion(.failure(AccountError.createErrorNotFound)) completion(.failure(AccountError.createErrorNotFound))
} }