resolve core data merge conflicts error
This commit is contained in:
parent
9eb5f57b80
commit
068f5be807
2 changed files with 4 additions and 2 deletions
|
|
@ -53,6 +53,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
||||||
SVProgressHUD.setDefaultMaskType(.black)
|
SVProgressHUD.setDefaultMaskType(.black)
|
||||||
SVProgressHUD.setDefaultStyle(.light)
|
SVProgressHUD.setDefaultStyle(.light)
|
||||||
SVProgressHUD.show(withStatus: "Sync Password Store")
|
SVProgressHUD.show(withStatus: "Sync Password Store")
|
||||||
|
let numberOfUnsyncedPasswords = PasswordStore.shared.getNumberOfUnsyncedPasswords()
|
||||||
DispatchQueue.global(qos: .userInitiated).async { [unowned self] in
|
DispatchQueue.global(qos: .userInitiated).async { [unowned self] in
|
||||||
do {
|
do {
|
||||||
try PasswordStore.shared.pullRepository(transferProgressBlock: {(git_transfer_progress, stop) in
|
try PasswordStore.shared.pullRepository(transferProgressBlock: {(git_transfer_progress, stop) in
|
||||||
|
|
@ -60,15 +61,15 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
||||||
SVProgressHUD.showProgress(Float(git_transfer_progress.pointee.received_objects)/Float(git_transfer_progress.pointee.total_objects), status: "Pull Remote Repository")
|
SVProgressHUD.showProgress(Float(git_transfer_progress.pointee.received_objects)/Float(git_transfer_progress.pointee.total_objects), status: "Pull Remote Repository")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if PasswordStore.shared.getNumberOfUnsyncedPasswords() > 0 {
|
if numberOfUnsyncedPasswords > 0 {
|
||||||
try PasswordStore.shared.pushRepository(transferProgressBlock: {(current, total, bytes, stop) in
|
try PasswordStore.shared.pushRepository(transferProgressBlock: {(current, total, bytes, stop) in
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
SVProgressHUD.showProgress(Float(current)/Float(total), status: "Push Remote Repository")
|
SVProgressHUD.showProgress(Float(current)/Float(total), status: "Push Remote Repository")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
PasswordStore.shared.updatePasswordEntityCoreData()
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
|
PasswordStore.shared.updatePasswordEntityCoreData()
|
||||||
self.passwordEntities = PasswordStore.shared.fetchPasswordEntityCoreData()
|
self.passwordEntities = PasswordStore.shared.fetchPasswordEntityCoreData()
|
||||||
self.reloadTableView(data: self.passwordEntities!)
|
self.reloadTableView(data: self.passwordEntities!)
|
||||||
PasswordStore.shared.setAllSynced()
|
PasswordStore.shared.setAllSynced()
|
||||||
|
|
|
||||||
|
|
@ -345,6 +345,7 @@ class PasswordStore {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
try context.execute(deleteRequest)
|
try context.execute(deleteRequest)
|
||||||
|
try context.save()
|
||||||
} catch let error as NSError {
|
} catch let error as NSError {
|
||||||
print(error)
|
print(error)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue