]> git.ipfire.org Git - thirdparty/wireguard-apple.git/commitdiff
QR code: Show label overlay with info on how to generate the QR code
authorRoopesh Chander <roop@roopc.net>
Tue, 30 Oct 2018 13:34:10 +0000 (19:04 +0530)
committerRoopesh Chander <roop@roopc.net>
Tue, 30 Oct 2018 13:34:15 +0000 (19:04 +0530)
Signed-off-by: Roopesh Chander <roop@roopc.net>
WireGuard/WireGuard/UI/iOS/QRScanViewController.swift

index 6b87ebd1949ebd9852e2a6cfae8b04dc382a0f7e..45f6dde434cc7fa1e8a23923cf76676a89ef75f7 100644 (file)
@@ -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,