diff options
author | Roopesh Chander <roop@roopc.net> | 2018-10-30 19:04:10 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2018-10-30 19:04:15 +0530 |
commit | 904a080690dec8fb5b6df349eeb83a5331b35d46 (patch) | |
tree | 37efc6cb232f1e07541182170f507481f646b3b2 | |
parent | Tunnel creation: Placeholders for Listen port, Pre-shared key, Persistent Keepalive (diff) | |
download | wireguard-apple-904a080690dec8fb5b6df349eeb83a5331b35d46.tar.xz wireguard-apple-904a080690dec8fb5b6df349eeb83a5331b35d46.zip |
QR code: Show label overlay with info on how to generate the QR code
Signed-off-by: Roopesh Chander <roop@roopc.net>
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/QRScanViewController.swift | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/QRScanViewController.swift b/WireGuard/WireGuard/UI/iOS/QRScanViewController.swift index 6b87ebd..45f6dde 100644 --- a/WireGuard/WireGuard/UI/iOS/QRScanViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/QRScanViewController.swift @@ -21,6 +21,20 @@ class QRScanViewController: UIViewController { self.title = "Scan QR code" self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(cancelTapped)) + let tipLabel = UILabel() + tipLabel.text = "Tip: Generate with `qrencode -t ansiutf8 < tunnel.conf`" + tipLabel.adjustsFontSizeToFitWidth = true + tipLabel.textColor = UIColor.lightGray + tipLabel.textAlignment = .center + + view.addSubview(tipLabel) + tipLabel.translatesAutoresizingMaskIntoConstraints = false + NSLayoutConstraint.activate([ + tipLabel.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor), + tipLabel.rightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.rightAnchor), + tipLabel.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -32), + ]) + guard let videoCaptureDevice = AVCaptureDevice.default(for: .video), let videoInput = try? AVCaptureDeviceInput(device: videoCaptureDevice), let captureSession = captureSession, |