Ensure that no deleted articles are in the new and updated articles
This commit is contained in:
parent
d0ace82d02
commit
4f54a21084
|
@ -627,6 +627,8 @@ private extension CloudKitAccountDelegate {
|
||||||
|
|
||||||
group.notify(queue: DispatchQueue.main) {
|
group.notify(queue: DispatchQueue.main) {
|
||||||
|
|
||||||
|
newAndUpdatedArticles = newAndUpdatedArticles.subtracting(deletedArticles)
|
||||||
|
|
||||||
self.articlesZone.deleteArticles(deletedArticles) { _ in
|
self.articlesZone.deleteArticles(deletedArticles) { _ in
|
||||||
self.refreshProgress.completeTask()
|
self.refreshProgress.completeTask()
|
||||||
self.articlesZone.saveNewArticles(newAndUpdatedArticles) { _ in
|
self.articlesZone.saveNewArticles(newAndUpdatedArticles) { _ in
|
||||||
|
@ -677,6 +679,8 @@ private extension CloudKitAccountDelegate {
|
||||||
newAndUpdatedArticles.formUnion(articleChanges.updatedArticles ?? Set<Article>())
|
newAndUpdatedArticles.formUnion(articleChanges.updatedArticles ?? Set<Article>())
|
||||||
let deletedArticles = articleChanges.deletedArticles ?? Set<Article>()
|
let deletedArticles = articleChanges.deletedArticles ?? Set<Article>()
|
||||||
|
|
||||||
|
newAndUpdatedArticles = newAndUpdatedArticles.subtracting(deletedArticles)
|
||||||
|
|
||||||
self.articlesZone.deleteArticles(deletedArticles) { _ in
|
self.articlesZone.deleteArticles(deletedArticles) { _ in
|
||||||
self.refreshProgress.completeTask()
|
self.refreshProgress.completeTask()
|
||||||
self.articlesZone.saveNewArticles(newAndUpdatedArticles) { _ in
|
self.articlesZone.saveNewArticles(newAndUpdatedArticles) { _ in
|
||||||
|
@ -756,6 +760,7 @@ private extension CloudKitAccountDelegate {
|
||||||
var newAndUpdatedArticles = articleChanges.newArticles ?? Set<Article>()
|
var newAndUpdatedArticles = articleChanges.newArticles ?? Set<Article>()
|
||||||
newAndUpdatedArticles.formUnion(articleChanges.updatedArticles ?? Set<Article>())
|
newAndUpdatedArticles.formUnion(articleChanges.updatedArticles ?? Set<Article>())
|
||||||
let deletedArticles = articleChanges.deletedArticles ?? Set<Article>()
|
let deletedArticles = articleChanges.deletedArticles ?? Set<Article>()
|
||||||
|
newAndUpdatedArticles = newAndUpdatedArticles.subtracting(deletedArticles)
|
||||||
|
|
||||||
self.articlesZone.deleteArticles(deletedArticles) { _ in
|
self.articlesZone.deleteArticles(deletedArticles) { _ in
|
||||||
self.refreshProgress.completeTask()
|
self.refreshProgress.completeTask()
|
||||||
|
|
|
@ -217,6 +217,7 @@ private extension CloudKitAcountZoneDelegate {
|
||||||
var newAndUpdatedArticles = articleChanges.newArticles ?? Set<Article>()
|
var newAndUpdatedArticles = articleChanges.newArticles ?? Set<Article>()
|
||||||
newAndUpdatedArticles.formUnion(articleChanges.updatedArticles ?? Set<Article>())
|
newAndUpdatedArticles.formUnion(articleChanges.updatedArticles ?? Set<Article>())
|
||||||
let deletedArticles = articleChanges.deletedArticles ?? Set<Article>()
|
let deletedArticles = articleChanges.deletedArticles ?? Set<Article>()
|
||||||
|
newAndUpdatedArticles = newAndUpdatedArticles.subtracting(deletedArticles)
|
||||||
|
|
||||||
self.articlesZone?.deleteArticles(deletedArticles) { _ in
|
self.articlesZone?.deleteArticles(deletedArticles) { _ in
|
||||||
self.refreshProgress?.completeTask()
|
self.refreshProgress?.completeTask()
|
||||||
|
@ -259,6 +260,7 @@ private extension CloudKitAcountZoneDelegate {
|
||||||
var newAndUpdatedArticles = articleChanges.newArticles ?? Set<Article>()
|
var newAndUpdatedArticles = articleChanges.newArticles ?? Set<Article>()
|
||||||
newAndUpdatedArticles.formUnion(articleChanges.updatedArticles ?? Set<Article>())
|
newAndUpdatedArticles.formUnion(articleChanges.updatedArticles ?? Set<Article>())
|
||||||
let deletedArticles = articleChanges.deletedArticles ?? Set<Article>()
|
let deletedArticles = articleChanges.deletedArticles ?? Set<Article>()
|
||||||
|
newAndUpdatedArticles = newAndUpdatedArticles.subtracting(deletedArticles)
|
||||||
|
|
||||||
self.articlesZone?.deleteArticles(deletedArticles) { _ in
|
self.articlesZone?.deleteArticles(deletedArticles) { _ in
|
||||||
self.refreshProgress?.completeTask()
|
self.refreshProgress?.completeTask()
|
||||||
|
|
Loading…
Reference in New Issue