aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-12-22 05:30:35 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-12-22 05:30:35 +0100
commitd36e7e27ffab1c0d22967185d64442226689906e (patch)
tree8f34a525b6baea40c9fe35f2606bda938e4839ea /WireGuard/WireGuard
parentDo not crash if we can't get socket.fileDescriptor (diff)
downloadwireguard-apple-d36e7e27ffab1c0d22967185d64442226689906e.tar.xz
wireguard-apple-d36e7e27ffab1c0d22967185d64442226689906e.zip
Clean up trailing whitespace
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'WireGuard/WireGuard')
-rw-r--r--WireGuard/WireGuard/Tunnel/TunnelsManager.swift6
-rw-r--r--WireGuard/WireGuard/UI/iOS/View/TunnelListCell.swift2
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/MainViewController.swift10
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift6
4 files changed, 12 insertions, 12 deletions
diff --git a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift
index 8d8cec9..86f57d9 100644
--- a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift
+++ b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift
@@ -52,7 +52,7 @@ class TunnelsManager {
}
#endif
}
-
+
func reload(completionHandler: @escaping (Bool) -> Void) {
#if targetEnvironment(simulator)
completionHandler(.success(false))
@@ -62,7 +62,7 @@ class TunnelsManager {
completionHandler(false)
return
}
-
+
let newTunnels = managers.map { TunnelContainer(tunnel: $0) }.sorted { $0.name < $1.name }
let hasChanges = self.tunnels.map { $0.name } != newTunnels.map { $0.name }
if hasChanges {
@@ -317,7 +317,7 @@ private func lastErrorTextFromNetworkExtension(for tunnel: TunnelContainer) -> (
guard let lastErrorData = try? Data(contentsOf: lastErrorFileURL) else { return nil }
guard let lastErrorStrings = String(data: lastErrorData, encoding: .utf8)?.splitToArray(separator: "\n") else { return nil }
guard lastErrorStrings.count == 2 && tunnel.activationAttemptId == lastErrorStrings[0] else { return nil }
-
+
switch PacketTunnelProviderError(rawValue: lastErrorStrings[1]) {
case .some(.savedProtocolConfigurationIsInvalid):
return (tr("alertTunnelActivationFailureTitle"), tr("alertTunnelActivationSavedConfigFailureMessage"))
diff --git a/WireGuard/WireGuard/UI/iOS/View/TunnelListCell.swift b/WireGuard/WireGuard/UI/iOS/View/TunnelListCell.swift
index 7ab3965..294964a 100644
--- a/WireGuard/WireGuard/UI/iOS/View/TunnelListCell.swift
+++ b/WireGuard/WireGuard/UI/iOS/View/TunnelListCell.swift
@@ -72,7 +72,7 @@ class TunnelListCell: UITableViewCell {
statusSwitch.addTarget(self, action: #selector(switchToggled), for: .valueChanged)
}
-
+
@objc func switchToggled() {
onSwitchToggled?(statusSwitch.isOn)
}
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/MainViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/MainViewController.swift
index 2798127..68723b0 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/MainViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/MainViewController.swift
@@ -57,14 +57,14 @@ class MainViewController: UISplitViewController {
self.onTunnelsManagerReady?(tunnelsManager)
self.onTunnelsManagerReady = nil
}
-
+
foregroundObservationToken = NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: OperationQueue.main) { [weak self] _ in
guard let self = self else { return }
self.tunnelsManager?.reload { [weak self] hasChanges in
guard let self = self, let tunnelsManager = self.tunnelsManager, hasChanges else { return }
-
+
self.tunnelsListVC?.setTunnelsManager(tunnelsManager: tunnelsManager)
-
+
if self.isCollapsed {
(self.viewControllers[0] as? UINavigationController)?.popViewController(animated: false)
} else {
@@ -73,12 +73,12 @@ class MainViewController: UISplitViewController {
let detailNC = UINavigationController(rootViewController: detailVC)
self.showDetailViewController(detailNC, sender: self)
}
-
+
if let presentedNavController = self.presentedViewController as? UINavigationController, presentedNavController.viewControllers.first is TunnelEditTableViewController {
self.presentedViewController?.dismiss(animated: false, completion: nil)
}
}
-
+
}
}
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift
index ad3e2eb..a0f1855 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift
@@ -14,7 +14,7 @@ class TunnelEditTableViewController: UITableViewController {
case peer(_ peer: TunnelViewModel.PeerData)
case addPeer
case onDemand
-
+
static func == (lhs: Section, rhs: Section) -> Bool {
switch (lhs, rhs) {
case (.interface, .interface),
@@ -360,7 +360,7 @@ extension TunnelEditTableViewController {
let firstInterfaceSection = sections.firstIndex(where: { $0 == .interface })!
let interfaceSubSection = interfaceFieldsBySection.firstIndex(where: { $0.contains(.dns) })!
let dnsRow = interfaceFieldsBySection[interfaceSubSection].firstIndex(where: { $0 == .dns })!
-
+
cell.onValueBeingEdited = { [weak self, weak peerData] value in
guard let self = self, let peerData = peerData else { return }
@@ -373,7 +373,7 @@ extension TunnelEditTableViewController {
self.tableView.deleteRows(at: [IndexPath(row: row, section: indexPath.section)], with: .fade)
}
}
-
+
tableView.reloadRows(at: [IndexPath(row: dnsRow, section: firstInterfaceSection + interfaceSubSection)], with: .none)
}
} else {