Polish code of long press to copy
This commit is contained in:
parent
94b3c50903
commit
6eb19a4dc6
1 changed files with 2 additions and 8 deletions
|
|
@ -247,13 +247,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
||||||
Utils.alert(title: "Cannot Copy Password", message: "PGP Key is not set. Please set your PGP Key first.", controller: self, completion: nil)
|
Utils.alert(title: "Cannot Copy Password", message: "PGP Key is not set. Please set your PGP Key first.", controller: self, completion: nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let index = sections[indexPath.section].index + indexPath.row
|
let password = getPasswordEntry(by: indexPath).passwordEntity!
|
||||||
let password: PasswordEntity
|
|
||||||
if searchController.isActive && searchController.searchBar.text != "" {
|
|
||||||
password = passwordsTableEntries[index].passwordEntity!
|
|
||||||
} else {
|
|
||||||
password = filteredPasswordsTableEntries[index].passwordEntity!
|
|
||||||
}
|
|
||||||
UIImpactFeedbackGenerator(style: .medium).impactOccurred()
|
UIImpactFeedbackGenerator(style: .medium).impactOccurred()
|
||||||
var passphrase = ""
|
var passphrase = ""
|
||||||
if Defaults[.isRememberPassphraseOn] && PasswordStore.shared.pgpKeyPassphrase != nil {
|
if Defaults[.isRememberPassphraseOn] && PasswordStore.shared.pgpKeyPassphrase != nil {
|
||||||
|
|
@ -284,7 +278,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
||||||
decryptedPassword = try passwordEntity.decrypt(passphrase: passphrase)!
|
decryptedPassword = try passwordEntity.decrypt(passphrase: passphrase)!
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
Utils.copyToPasteboard(textToCopy: decryptedPassword?.password)
|
Utils.copyToPasteboard(textToCopy: decryptedPassword?.password)
|
||||||
SVProgressHUD.showSuccess(withStatus: "Password Copied")
|
SVProgressHUD.showSuccess(withStatus: "Password copied, and will be cleared in 45 seconds.")
|
||||||
SVProgressHUD.dismiss(withDelay: 0.6)
|
SVProgressHUD.dismiss(withDelay: 0.6)
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue