copy password and open link
This commit is contained in:
parent
dcdf7852fe
commit
4c53d20b77
2 changed files with 17 additions and 3 deletions
|
|
@ -20,7 +20,9 @@ class LabelTableViewCell: UITableViewCell {
|
|||
@IBOutlet weak var titleLabel: UILabel!
|
||||
|
||||
var isPasswordCell = false
|
||||
var isURLCell = false
|
||||
var isReveal = false
|
||||
var password: Password?
|
||||
let passwordDots = "••••••••••••"
|
||||
|
||||
var cellData: LabelTableViewCellData? {
|
||||
|
|
@ -56,13 +58,16 @@ class LabelTableViewCell: UITableViewCell {
|
|||
return action == #selector(copy(_:)) || action == #selector(LabelTableViewCell.revealPassword(_:))
|
||||
}
|
||||
}
|
||||
if isURLCell {
|
||||
return action == #selector(copy(_:)) || action == #selector(LabelTableViewCell.openLink(_:))
|
||||
}
|
||||
return action == #selector(copy(_:))
|
||||
}
|
||||
|
||||
override func copy(_ sender: Any?) {
|
||||
UIPasteboard.general.string = cellData?.content
|
||||
}
|
||||
|
||||
|
||||
func revealPassword(_ sender: Any?) {
|
||||
contentLabel.text = cellData?.content
|
||||
isReveal = true
|
||||
|
|
@ -72,4 +77,9 @@ class LabelTableViewCell: UITableViewCell {
|
|||
contentLabel.text = passwordDots
|
||||
isReveal = false
|
||||
}
|
||||
|
||||
func openLink(_ sender: Any?) {
|
||||
UIPasteboard.general.string = password?.password
|
||||
UIApplication.shared.open(NSURL(string: cellData!.content) as! URL, options: [:], completionHandler: nil)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue