Update core data in main thread
This commit is contained in:
parent
133ad1bd45
commit
2dc8182fe8
1 changed files with 4 additions and 2 deletions
|
|
@ -235,8 +235,8 @@ public class PasswordStore {
|
||||||
try storeRepository.pull(storeRepository.currentBranch(), from: remote, withOptions: options, progress: progressBlock)
|
try storeRepository.pull(storeRepository.currentBranch(), from: remote, withOptions: options, progress: progressBlock)
|
||||||
Defaults.lastSyncedTime = Date()
|
Defaults.lastSyncedTime = Date()
|
||||||
self.setAllSynced()
|
self.setAllSynced()
|
||||||
self.updatePasswordEntityCoreData()
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
|
self.updatePasswordEntityCoreData()
|
||||||
NotificationCenter.default.post(name: .passwordStoreUpdated, object: nil)
|
NotificationCenter.default.post(name: .passwordStoreUpdated, object: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -566,7 +566,9 @@ public class PasswordStore {
|
||||||
|
|
||||||
public func saveUpdatedContext() {
|
public func saveUpdatedContext() {
|
||||||
do {
|
do {
|
||||||
try context.save()
|
if context.hasChanges {
|
||||||
|
try context.save()
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
fatalError("FailureToSaveContext".localize(error))
|
fatalError("FailureToSaveContext".localize(error))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue