aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-11-01 01:36:28 +0530
committerRoopesh Chander <roop@roopc.net>2018-11-01 11:45:44 +0530
commitbede8a17ad292120e414051a8c833543e73197a0 (patch)
tree0bb4e6ccc22f0a24580d00fa907fa59a5b6707a4 /WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
parentTunnel edit: Error out on duplicate name when creating / modifying a tunnel (diff)
downloadwireguard-apple-bede8a17ad292120e414051a8c833543e73197a0.tar.xz
wireguard-apple-bede8a17ad292120e414051a8c833543e73197a0.zip
QR Code: Error out on duplicate name
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift')
-rw-r--r--WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift10
1 files changed, 6 insertions, 4 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
index 75c3687..780f4d5 100644
--- a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
@@ -214,11 +214,13 @@ extension TunnelsListTableViewController: UIDocumentPickerDelegate {
// MARK: QRScanViewControllerDelegate
extension TunnelsListTableViewController: QRScanViewControllerDelegate {
- func scannedQRCode(tunnelConfiguration: TunnelConfiguration, qrScanViewController: QRScanViewController) {
- tunnelsManager?.add(tunnelConfiguration: tunnelConfiguration) { [weak self] (tunnel, error) in
+ func addScannedQRCode(tunnelConfiguration: TunnelConfiguration, qrScanViewController: QRScanViewController,
+ completionHandler: (() ->Void)?) {
+ tunnelsManager?.add(tunnelConfiguration: tunnelConfiguration) { (tunnel, error) in
if let error = error {
- print("Could not add tunnel: \(error)")
- self?.showErrorAlert(title: "Could not save scanned config", message: "Internal error")
+ ErrorPresenter.showErrorAlert(error: error, from: qrScanViewController, onDismissal: completionHandler)
+ } else {
+ completionHandler?()
}
}
}