aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS
diff options
context:
space:
mode:
authorEric Kuck <eric@bluelinelabs.com>2018-12-21 15:16:09 -0600
committerEric Kuck <eric@bluelinelabs.com>2018-12-21 16:32:08 -0600
commit1fecd8eb6c5c2327d4bfd5044876be12876fc7e5 (patch)
tree45c7f4c552eb01bd15c54e58615c9122acc99e83 /WireGuard/WireGuard/UI/iOS
parentDo not require NetworkExtension to know its own name (diff)
downloadwireguard-apple-1fecd8eb6c5c2327d4bfd5044876be12876fc7e5.tar.xz
wireguard-apple-1fecd8eb6c5c2327d4bfd5044876be12876fc7e5.zip
providerConfiguration is now a WgQuickConfig
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
Diffstat (limited to 'WireGuard/WireGuard/UI/iOS')
-rw-r--r--WireGuard/WireGuard/UI/iOS/String+ArrayConversion.swift32
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/QRScanViewController.swift2
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift2
3 files changed, 2 insertions, 34 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/String+ArrayConversion.swift b/WireGuard/WireGuard/UI/iOS/String+ArrayConversion.swift
deleted file mode 100644
index 9b69cf4..0000000
--- a/WireGuard/WireGuard/UI/iOS/String+ArrayConversion.swift
+++ /dev/null
@@ -1,32 +0,0 @@
-// SPDX-License-Identifier: MIT
-// Copyright © 2018 WireGuard LLC. All Rights Reserved.
-
-import Foundation
-
-extension String {
-
- func splitToArray(separator: Character = ",", trimmingCharacters: CharacterSet? = nil) -> [String] {
- return split(separator: separator)
- .map {
- if let charSet = trimmingCharacters {
- return $0.trimmingCharacters(in: charSet)
- } else {
- return String($0)
- }
- }
- }
-
-}
-
-extension Optional where Wrapped == String {
-
- func splitToArray(separator: Character = ",", trimmingCharacters: CharacterSet? = nil) -> [String] {
- switch self {
- case .none:
- return []
- case .some(let wrapped):
- return wrapped.splitToArray(separator: separator, trimmingCharacters: trimmingCharacters)
- }
- }
-
-}
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/QRScanViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/QRScanViewController.swift
index 1fd6905..a4f7130 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? WgQuickConfigFileParser.parse(code, name: "Scanned")
+ let scannedTunnelConfiguration = try? TunnelConfiguration(code, name: "Scanned")
guard let tunnelConfiguration = scannedTunnelConfiguration else {
scanDidEncounterError(title: tr("alertScanQRCodeInvalidQRCodeTitle"), message: tr("alertScanQRCodeInvalidQRCodeMessage"))
return
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift
index fff976f..6dd8e9c 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? WgQuickConfigFileParser.parse(fileContents, name: fileBaseName) {
+ let tunnelConfiguration = try? TunnelConfiguration(fileContents, name: fileBaseName) {
tunnelsManager.add(tunnelConfiguration: tunnelConfiguration) { [weak self] result in
if let error = result.error {
ErrorPresenter.showErrorAlert(error: error, from: self, onPresented: completionHandler)