Merge pull request #1985 from omnivore-app/fix/highlight-deletion-sync

When deleting highlights finish core data sync before triggering API sync
This commit is contained in:
Jackson Harper 2023-04-06 09:40:38 +08:00 committed by GitHub
commit 933e890ab1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View file

@ -6,7 +6,7 @@ import SwiftGraphQL
public extension DataService {
func deleteHighlight(highlightID: String) {
// Update CoreData so view updates immediately
viewContext.perform {
viewContext.performAndWait {
guard let highlight = Highlight.lookup(byID: highlightID, inContext: self.viewContext) else { return }
highlight.serverSyncStatus = Int64(ServerSyncStatus.needsDeletion.rawValue)
@ -17,9 +17,8 @@ public extension DataService {
self.viewContext.rollback()
logger.debug("Failed to mark Highlight for deletion: \(error.localizedDescription)")
}
self.syncHighlightDeletion(highlightID: highlightID)
}
syncHighlightDeletion(highlightID: highlightID)
}
func syncHighlightDeletion(highlightID: String) {

File diff suppressed because one or more lines are too long