Copy public key through context menu.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jeroen Leenarts
2018-10-02 19:39:03 +02:00
parent cd86ba92ec
commit 7f6a7481c8
5 changed files with 84 additions and 82 deletions
@@ -180,18 +180,12 @@ class InterfaceTableViewCell: UITableViewCell {
}
}
@IBAction func copyPublicKey(_ sender: Any) {
if let publicKey = model.publicKey {
UIPasteboard.general.string = publicKey
}
}
weak var delegate: InterfaceTableViewCellDelegate?
@IBOutlet weak var nameField: UITextField!
@IBOutlet weak var addressesField: UITextField!
@IBOutlet weak var privateKeyField: UITextField!
@IBOutlet weak var publicKeyField: UILabel!
@IBOutlet weak var publicKeyField: CopyableLabel!
@IBOutlet weak var listenPortField: UITextField!
@IBOutlet weak var dnsField: UITextField!
@IBOutlet weak var mtuField: UITextField!
@@ -254,12 +248,6 @@ class PeerTableViewCell: UITableViewCell {
@IBOutlet weak var endpointField: UITextField!
@IBOutlet weak var persistentKeepaliveField: UITextField!
@IBAction func copyPublicKey(_ sender: Any) {
if let publicKey = peer.publicKey {
UIPasteboard.general.string = publicKey
}
}
@IBAction func deletePeer(_ sender: Any) {
delegate?.delete(peer: peer)
}
@@ -168,15 +168,9 @@ class InterfaceInfoTableViewCell: UITableViewCell {
@IBOutlet weak var nameField: UILabel!
@IBOutlet weak var addressesField: UILabel!
@IBOutlet weak var publicKeyField: UILabel!
@IBOutlet weak var publicKeyField: CopyableLabel!
@IBOutlet weak var tunnelSwitch: UISwitch!
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!
@IBAction func copyPublicKey(_ sender: Any) {
if let publicKey = model.publicKey {
UIPasteboard.general.string = publicKey
}
}
}
class PeerInfoTableViewCell: UITableViewCell {
@@ -188,15 +182,11 @@ class PeerInfoTableViewCell: UITableViewCell {
}
}
@IBOutlet weak var publicKeyField: UILabel!
@IBOutlet weak var publicKeyField: CopyableLabel!
@IBOutlet weak var allowedIpsField: UILabel!
@IBOutlet weak var endpointField: UILabel!
@IBOutlet weak var copiedStatusLabel: UILabel!
@IBAction func copyPublicKey(_ sender: Any) {
if let publicKey = peer.publicKey {
UIPasteboard.general.string = publicKey
}
}
}
extension TunnelInfoTableViewController: Identifyable {}