only push when there is unsync password

This commit is contained in:
Bob Sun 2017-02-12 13:31:29 +08:00
parent 6a9151973a
commit 41d45bfbf9
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4

View file

@ -60,11 +60,13 @@ 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")
} }
}) })
try PasswordStore.shared.pushRepository(transferProgressBlock: {(current, total, bytes, stop) in if PasswordStore.shared.getNumberOfUnsyncedPasswords() > 0 {
DispatchQueue.main.async { try PasswordStore.shared.pushRepository(transferProgressBlock: {(current, total, bytes, stop) in
SVProgressHUD.showProgress(Float(current)/Float(total), status: "Push Remote Repository") DispatchQueue.main.async {
} SVProgressHUD.showProgress(Float(current)/Float(total), status: "Push Remote Repository")
}) }
})
}
DispatchQueue.main.async { DispatchQueue.main.async {
self.passwordEntities = PasswordStore.shared.fetchPasswordEntityCoreData() self.passwordEntities = PasswordStore.shared.fetchPasswordEntityCoreData()
self.reloadTableView(data: self.passwordEntities!) self.reloadTableView(data: self.passwordEntities!)