Fix so that feeds won't get added locally when CloudKit errors and allow the removal of corrupted Feeds when found.

This commit is contained in:
Maurice Parker 2020-12-08 13:28:50 -06:00
parent ea0a440c7f
commit c150d19b4e
1 changed files with 9 additions and 1 deletions

View File

@ -198,7 +198,14 @@ final class CloudKitAccountDelegate: AccountDelegate {
container.removeWebFeed(feed)
completion(.success(()))
case .failure(let error):
completion(.failure(error))
switch error {
case CloudKitZoneError.invalidParameter:
// We got into a bad state and should remove the feed to clear up the bad data
account.clearWebFeedMetadata(feed)
container.removeWebFeed(feed)
default:
completion(.failure(error))
}
}
}
}
@ -708,6 +715,7 @@ private extension CloudKitAccountDelegate {
feed.externalID = externalID
self.sendNewArticlesToTheCloud(account, feed, completion: completion)
case .failure(let error):
container.removeWebFeed(feed)
self.refreshProgress.clear()
completion(.failure(error))
}