change update password related functions
This commit is contained in:
parent
8d474677da
commit
869f06e00f
4 changed files with 40 additions and 23 deletions
|
|
@ -9,6 +9,7 @@
|
|||
import UIKit
|
||||
import FavIcon
|
||||
import SwiftyUserDefaults
|
||||
import SVProgressHUD
|
||||
|
||||
class PasswordDetailTableViewController: UITableViewController, UIGestureRecognizerDelegate {
|
||||
var passwordEntity: PasswordEntity?
|
||||
|
|
@ -108,13 +109,22 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
|
|||
}
|
||||
|
||||
@IBAction func saveEditPassword(segue: UIStoryboardSegue) {
|
||||
if password!.changed {
|
||||
PasswordStore.shared.update(passwordEntity: passwordEntity!, password: password!, progressBlock: { progress in
|
||||
|
||||
})
|
||||
NotificationCenter.default.post(Notification(name: Notification.Name("passwordUpdated")))
|
||||
setTableData()
|
||||
tableView.reloadData()
|
||||
if self.password!.changed {
|
||||
SVProgressHUD.show(withStatus: "Saving")
|
||||
DispatchQueue.global(qos: .userInitiated).async {
|
||||
PasswordStore.shared.update(passwordEntity: self.passwordEntity!, password: self.password!, progressBlock: { progress in
|
||||
SVProgressHUD.showProgress(progress, status: "Encrypting")
|
||||
})
|
||||
DispatchQueue.main.async {
|
||||
self.passwordEntity!.synced = false
|
||||
PasswordStore.shared.saveUpdated(passwordEntity: self.passwordEntity!)
|
||||
NotificationCenter.default.post(Notification(name: Notification.Name("passwordUpdated")))
|
||||
self.setTableData()
|
||||
self.tableView.reloadData()
|
||||
SVProgressHUD.showSuccess(withStatus: "Success")
|
||||
SVProgressHUD.dismiss(withDelay: 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue