From 733c29021e7c98f3662e31b029085e51220cb1a5 Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Mon, 5 Nov 2018 23:38:41 +0530 Subject: QR Code: Dismiss the QR code screen when the name prompt is cancelled Signed-off-by: Roopesh Chander --- WireGuard/WireGuard/UI/iOS/QRScanViewController.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'WireGuard/WireGuard/UI/iOS/QRScanViewController.swift') diff --git a/WireGuard/WireGuard/UI/iOS/QRScanViewController.swift b/WireGuard/WireGuard/UI/iOS/QRScanViewController.swift index ea9ece4..207fc43 100644 --- a/WireGuard/WireGuard/UI/iOS/QRScanViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/QRScanViewController.swift @@ -114,7 +114,9 @@ class QRScanViewController: UIViewController { let alert = UIAlertController(title: NSLocalizedString("Please name the scanned tunnel", comment: ""), message: nil, preferredStyle: .alert) alert.addTextField(configurationHandler: nil) - alert.addAction(UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .cancel, handler: nil)) + alert.addAction(UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .cancel, handler: { [weak self] _ in + self?.dismiss(animated: true, completion: nil) + })) alert.addAction(UIAlertAction(title: NSLocalizedString("Save", comment: ""), style: .default, handler: { [weak self] _ in let title = alert.textFields?[0].text?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "" if (title.isEmpty) { return } -- cgit v1.2.3-59-g8ed1b