Fix crashing bug that can happen if a CloudKit record gets into an invalid state.
This commit is contained in:
parent
69acfc5aa6
commit
bcd4d4e076
@ -117,7 +117,7 @@ private extension CloudKitSendStatusOperation {
|
|||||||
articlesZone.modifyArticles(statusUpdates) { result in
|
articlesZone.modifyArticles(statusUpdates) { result in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
self.database.deleteSelectedForProcessing(statusUpdates.map({ $0.articleID })) { _ in
|
self.database.deleteSelectedForProcessing(articleIDs) { _ in
|
||||||
// Don't clear the last one since we might have had additional ticks added
|
// Don't clear the last one since we might have had additional ticks added
|
||||||
if self.showProgress && self.refreshProgress?.numberRemaining ?? 0 > 1 {
|
if self.showProgress && self.refreshProgress?.numberRemaining ?? 0 > 1 {
|
||||||
self.refreshProgress?.completeTask()
|
self.refreshProgress?.completeTask()
|
||||||
|
@ -114,6 +114,11 @@ struct SyncStatusTable: DatabaseTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func resetSelectedForProcessing(_ articleIDs: [String], completion: DatabaseCompletionBlock? = nil) {
|
func resetSelectedForProcessing(_ articleIDs: [String], completion: DatabaseCompletionBlock? = nil) {
|
||||||
|
guard !articleIDs.isEmpty else {
|
||||||
|
callCompletion(completion, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
queue.runInTransaction { databaseResult in
|
queue.runInTransaction { databaseResult in
|
||||||
|
|
||||||
func makeDatabaseCall(_ database: FMDatabase) {
|
func makeDatabaseCall(_ database: FMDatabase) {
|
||||||
@ -134,6 +139,11 @@ struct SyncStatusTable: DatabaseTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func deleteSelectedForProcessing(_ articleIDs: [String], completion: DatabaseCompletionBlock? = nil) {
|
func deleteSelectedForProcessing(_ articleIDs: [String], completion: DatabaseCompletionBlock? = nil) {
|
||||||
|
guard !articleIDs.isEmpty else {
|
||||||
|
callCompletion(completion, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
queue.runInTransaction { databaseResult in
|
queue.runInTransaction { databaseResult in
|
||||||
|
|
||||||
func makeDatabaseCall(_ database: FMDatabase) {
|
func makeDatabaseCall(_ database: FMDatabase) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user