From d12542a0c21325264eef599a46459ea135bf0578 Mon Sep 17 00:00:00 2001 From: Jeroen Leenarts Date: Tue, 2 Oct 2018 21:23:52 +0200 Subject: [PATCH] Dismiss qr scan vc on cancel. --- WireGuard/ViewControllers/QRScanViewController.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/WireGuard/ViewControllers/QRScanViewController.swift b/WireGuard/ViewControllers/QRScanViewController.swift index 5beb1eb..c00d691 100644 --- a/WireGuard/ViewControllers/QRScanViewController.swift +++ b/WireGuard/ViewControllers/QRScanViewController.swift @@ -105,7 +105,9 @@ class QRScanViewController: UIViewController { let tunnel = try Tunnel.fromConfig(code, context: viewContext) let alert = UIAlertController(title: NSLocalizedString("Enter a title for new 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?.delegate?.didCancel(qrScanViewController: self!) + })) alert.addAction(UIAlertAction(title: NSLocalizedString("Save", comment: ""), style: .default, handler: { [weak self] _ in do { tunnel.title = alert.textFields?[0].text