change long press copy experience

This commit is contained in:
Bob Sun 2017-02-08 10:40:48 +08:00
parent f9e42b9490
commit 563156b0a4
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4

View file

@ -113,7 +113,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
} }
cell.textLabel?.text = password.name cell.textLabel?.text = password.name
let longPressGestureRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(longPressAction(_:))) let longPressGestureRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(longPressAction(_:)))
longPressGestureRecognizer.minimumPressDuration = 1.0 longPressGestureRecognizer.minimumPressDuration = 0.6
cell.addGestureRecognizer(longPressGestureRecognizer) cell.addGestureRecognizer(longPressGestureRecognizer)
return cell return cell
} }
@ -152,9 +152,9 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
password = passwordEntities![index] password = passwordEntities![index]
} }
do { do {
let generator = UIImpactFeedbackGenerator(style: .medium)
let decryptedPassword = try password.decrypt()! let decryptedPassword = try password.decrypt()!
UIPasteboard.general.string = decryptedPassword.password UIPasteboard.general.string = decryptedPassword.password
let generator = UIImpactFeedbackGenerator(style: .medium)
generator.impactOccurred() generator.impactOccurred()
SVProgressHUD.setDefaultMaskType(.clear) SVProgressHUD.setDefaultMaskType(.clear)
SVProgressHUD.setDefaultStyle(.dark) SVProgressHUD.setDefaultStyle(.dark)