mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-23 16:20:53 +01:00
Don't remove the web feeds from the container held by undo
This commit is contained in:
parent
d22aea7cf5
commit
98ffbfd99b
@ -191,30 +191,12 @@ final class CloudKitAccountDelegate: AccountDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func removeWebFeed(for account: Account, with feed: WebFeed, from container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
|
func removeWebFeed(for account: Account, with feed: WebFeed, from container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
|
||||||
refreshProgress.addToNumberOfTasksAndRemaining(2)
|
removeWebFeedFromCloud(for: account, with: feed, from: container) { result in
|
||||||
accountZone.removeWebFeed(feed, from: container) { result in
|
|
||||||
self.refreshProgress.completeTask()
|
|
||||||
switch result {
|
|
||||||
case .success:
|
|
||||||
guard let webFeedExternalID = feed.externalID else {
|
|
||||||
completion(.success(()))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
self.articlesZone.deleteArticles(webFeedExternalID) { result in
|
|
||||||
self.refreshProgress.completeTask()
|
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
container.removeWebFeed(feed)
|
container.removeWebFeed(feed)
|
||||||
completion(.success(()))
|
completion(.success(()))
|
||||||
case .failure(let error):
|
case .failure(let error):
|
||||||
self.processAccountError(account, error)
|
|
||||||
completion(.failure(error))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case .failure(let error):
|
|
||||||
self.refreshProgress.completeTask()
|
|
||||||
self.processAccountError(account, error)
|
|
||||||
completion(.failure(error))
|
completion(.failure(error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -332,7 +314,7 @@ final class CloudKitAccountDelegate: AccountDelegate {
|
|||||||
|
|
||||||
for webFeed in webFeeds {
|
for webFeed in webFeeds {
|
||||||
group.enter()
|
group.enter()
|
||||||
self.removeWebFeed(for: account, with: webFeed, from: folder) { result in
|
self.removeWebFeedFromCloud(for: account, with: webFeed, from: folder) { result in
|
||||||
group.leave()
|
group.leave()
|
||||||
if case .failure(let error) = result {
|
if case .failure(let error) = result {
|
||||||
os_log(.error, log: self.log, "Remove folder, remove webfeed error: %@.", error.localizedDescription)
|
os_log(.error, log: self.log, "Remove folder, remove webfeed error: %@.", error.localizedDescription)
|
||||||
@ -818,6 +800,29 @@ private extension CloudKitAccountDelegate {
|
|||||||
mainThreadOperationQueue.add(op)
|
mainThreadOperationQueue.add(op)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func removeWebFeedFromCloud(for account: Account, with feed: WebFeed, from container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
|
||||||
|
refreshProgress.addToNumberOfTasksAndRemaining(2)
|
||||||
|
accountZone.removeWebFeed(feed, from: container) { result in
|
||||||
|
self.refreshProgress.completeTask()
|
||||||
|
switch result {
|
||||||
|
case .success:
|
||||||
|
guard let webFeedExternalID = feed.externalID else {
|
||||||
|
completion(.success(()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self.articlesZone.deleteArticles(webFeedExternalID) { result in
|
||||||
|
self.refreshProgress.completeTask()
|
||||||
|
completion(result)
|
||||||
|
}
|
||||||
|
case .failure(let error):
|
||||||
|
self.refreshProgress.completeTask()
|
||||||
|
self.processAccountError(account, error)
|
||||||
|
completion(.failure(error))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension CloudKitAccountDelegate: LocalAccountRefresherDelegate {
|
extension CloudKitAccountDelegate: LocalAccountRefresherDelegate {
|
||||||
|
Loading…
Reference in New Issue
Block a user