aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-12-22 00:28:18 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-12-22 00:28:18 +0100
commit4ed646973ee4e1871cda792083bf4fe70afa8c3f (patch)
tree4f7df25ce19ada60ed792c729e562cb2b367a72b /WireGuard/WireGuard/UI/iOS
parentFix paren typo (diff)
downloadwireguard-apple-4ed646973ee4e1871cda792083bf4fe70afa8c3f.tar.xz
wireguard-apple-4ed646973ee4e1871cda792083bf4fe70afa8c3f.zip
Move name from interface to tunnel
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'WireGuard/WireGuard/UI/iOS')
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/QRScanViewController.swift4
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift2
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift2
3 files changed, 4 insertions, 4 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/QRScanViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/QRScanViewController.swift
index a4f7130..2f8d41f 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/QRScanViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/QRScanViewController.swift
@@ -101,7 +101,7 @@ class QRScanViewController: UIViewController {
}
func scanDidComplete(withCode code: String) {
- let scannedTunnelConfiguration = try? TunnelConfiguration(code, name: "Scanned")
+ let scannedTunnelConfiguration = try? TunnelConfiguration(fromWgQuickConfig: code, called: "Scanned")
guard let tunnelConfiguration = scannedTunnelConfiguration else {
scanDidEncounterError(title: tr("alertScanQRCodeInvalidQRCodeTitle"), message: tr("alertScanQRCodeInvalidQRCodeMessage"))
return
@@ -114,7 +114,7 @@ class QRScanViewController: UIViewController {
})
alert.addAction(UIAlertAction(title: tr("actionSave"), style: .default) { [weak self] _ in
guard let title = alert.textFields?[0].text?.trimmingCharacters(in: .whitespacesAndNewlines), !title.isEmpty else { return }
- tunnelConfiguration.interface.name = title
+ tunnelConfiguration.name = title
if let self = self {
self.delegate?.addScannedQRCode(tunnelConfiguration: tunnelConfiguration, qrScanViewController: self) {
self.dismiss(animated: true, completion: nil)
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift
index 79dc7b6..17e5130 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift
@@ -98,7 +98,7 @@ class TunnelEditTableViewController: UITableViewController {
let tunnelSaveResult = tunnelViewModel.save()
switch tunnelSaveResult {
case .error(let errorMessage):
- let alertTitle = (tunnelViewModel.interfaceData.validatedConfiguration == nil) ?
+ let alertTitle = (tunnelViewModel.interfaceData.validatedConfiguration == nil || tunnelViewModel.interfaceData.validatedName == nil) ?
tr("alertInvalidInterfaceTitle") : tr("alertInvalidPeerTitle")
ErrorPresenter.showErrorAlert(title: alertTitle, message: errorMessage, from: self)
tableView.reloadData() // Highlight erroring fields
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift
index 77952c8..5e4583e 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift
@@ -180,7 +180,7 @@ class TunnelsListTableViewController: UIViewController {
} else /* if (url.pathExtension == "conf") -- we assume everything else is a conf */ {
let fileBaseName = url.deletingPathExtension().lastPathComponent.trimmingCharacters(in: .whitespacesAndNewlines)
if let fileContents = try? String(contentsOf: url),
- let tunnelConfiguration = try? TunnelConfiguration(fileContents, name: fileBaseName) {
+ let tunnelConfiguration = try? TunnelConfiguration(fromWgQuickConfig: fileContents, called: fileBaseName) {
tunnelsManager.add(tunnelConfiguration: tunnelConfiguration) { [weak self] result in
if let error = result.error {
ErrorPresenter.showErrorAlert(error: error, from: self, onPresented: completionHandler)