Clean up trailing whitespace
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
b0b6866c51
commit
d36e7e27ff
|
@ -52,7 +52,7 @@ class TunnelsManager {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func reload(completionHandler: @escaping (Bool) -> Void) {
|
func reload(completionHandler: @escaping (Bool) -> Void) {
|
||||||
#if targetEnvironment(simulator)
|
#if targetEnvironment(simulator)
|
||||||
completionHandler(.success(false))
|
completionHandler(.success(false))
|
||||||
|
@ -62,7 +62,7 @@ class TunnelsManager {
|
||||||
completionHandler(false)
|
completionHandler(false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let newTunnels = managers.map { TunnelContainer(tunnel: $0) }.sorted { $0.name < $1.name }
|
let newTunnels = managers.map { TunnelContainer(tunnel: $0) }.sorted { $0.name < $1.name }
|
||||||
let hasChanges = self.tunnels.map { $0.name } != newTunnels.map { $0.name }
|
let hasChanges = self.tunnels.map { $0.name } != newTunnels.map { $0.name }
|
||||||
if hasChanges {
|
if hasChanges {
|
||||||
|
@ -317,7 +317,7 @@ private func lastErrorTextFromNetworkExtension(for tunnel: TunnelContainer) -> (
|
||||||
guard let lastErrorData = try? Data(contentsOf: lastErrorFileURL) else { return nil }
|
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 let lastErrorStrings = String(data: lastErrorData, encoding: .utf8)?.splitToArray(separator: "\n") else { return nil }
|
||||||
guard lastErrorStrings.count == 2 && tunnel.activationAttemptId == lastErrorStrings[0] else { return nil }
|
guard lastErrorStrings.count == 2 && tunnel.activationAttemptId == lastErrorStrings[0] else { return nil }
|
||||||
|
|
||||||
switch PacketTunnelProviderError(rawValue: lastErrorStrings[1]) {
|
switch PacketTunnelProviderError(rawValue: lastErrorStrings[1]) {
|
||||||
case .some(.savedProtocolConfigurationIsInvalid):
|
case .some(.savedProtocolConfigurationIsInvalid):
|
||||||
return (tr("alertTunnelActivationFailureTitle"), tr("alertTunnelActivationSavedConfigFailureMessage"))
|
return (tr("alertTunnelActivationFailureTitle"), tr("alertTunnelActivationSavedConfigFailureMessage"))
|
||||||
|
|
|
@ -72,7 +72,7 @@ class TunnelListCell: UITableViewCell {
|
||||||
|
|
||||||
statusSwitch.addTarget(self, action: #selector(switchToggled), for: .valueChanged)
|
statusSwitch.addTarget(self, action: #selector(switchToggled), for: .valueChanged)
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func switchToggled() {
|
@objc func switchToggled() {
|
||||||
onSwitchToggled?(statusSwitch.isOn)
|
onSwitchToggled?(statusSwitch.isOn)
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,14 +57,14 @@ class MainViewController: UISplitViewController {
|
||||||
self.onTunnelsManagerReady?(tunnelsManager)
|
self.onTunnelsManagerReady?(tunnelsManager)
|
||||||
self.onTunnelsManagerReady = nil
|
self.onTunnelsManagerReady = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
foregroundObservationToken = NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: OperationQueue.main) { [weak self] _ in
|
foregroundObservationToken = NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: OperationQueue.main) { [weak self] _ in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
self.tunnelsManager?.reload { [weak self] hasChanges in
|
self.tunnelsManager?.reload { [weak self] hasChanges in
|
||||||
guard let self = self, let tunnelsManager = self.tunnelsManager, hasChanges else { return }
|
guard let self = self, let tunnelsManager = self.tunnelsManager, hasChanges else { return }
|
||||||
|
|
||||||
self.tunnelsListVC?.setTunnelsManager(tunnelsManager: tunnelsManager)
|
self.tunnelsListVC?.setTunnelsManager(tunnelsManager: tunnelsManager)
|
||||||
|
|
||||||
if self.isCollapsed {
|
if self.isCollapsed {
|
||||||
(self.viewControllers[0] as? UINavigationController)?.popViewController(animated: false)
|
(self.viewControllers[0] as? UINavigationController)?.popViewController(animated: false)
|
||||||
} else {
|
} else {
|
||||||
|
@ -73,12 +73,12 @@ class MainViewController: UISplitViewController {
|
||||||
let detailNC = UINavigationController(rootViewController: detailVC)
|
let detailNC = UINavigationController(rootViewController: detailVC)
|
||||||
self.showDetailViewController(detailNC, sender: self)
|
self.showDetailViewController(detailNC, sender: self)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let presentedNavController = self.presentedViewController as? UINavigationController, presentedNavController.viewControllers.first is TunnelEditTableViewController {
|
if let presentedNavController = self.presentedViewController as? UINavigationController, presentedNavController.viewControllers.first is TunnelEditTableViewController {
|
||||||
self.presentedViewController?.dismiss(animated: false, completion: nil)
|
self.presentedViewController?.dismiss(animated: false, completion: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class TunnelEditTableViewController: UITableViewController {
|
||||||
case peer(_ peer: TunnelViewModel.PeerData)
|
case peer(_ peer: TunnelViewModel.PeerData)
|
||||||
case addPeer
|
case addPeer
|
||||||
case onDemand
|
case onDemand
|
||||||
|
|
||||||
static func == (lhs: Section, rhs: Section) -> Bool {
|
static func == (lhs: Section, rhs: Section) -> Bool {
|
||||||
switch (lhs, rhs) {
|
switch (lhs, rhs) {
|
||||||
case (.interface, .interface),
|
case (.interface, .interface),
|
||||||
|
@ -360,7 +360,7 @@ extension TunnelEditTableViewController {
|
||||||
let firstInterfaceSection = sections.firstIndex(where: { $0 == .interface })!
|
let firstInterfaceSection = sections.firstIndex(where: { $0 == .interface })!
|
||||||
let interfaceSubSection = interfaceFieldsBySection.firstIndex(where: { $0.contains(.dns) })!
|
let interfaceSubSection = interfaceFieldsBySection.firstIndex(where: { $0.contains(.dns) })!
|
||||||
let dnsRow = interfaceFieldsBySection[interfaceSubSection].firstIndex(where: { $0 == .dns })!
|
let dnsRow = interfaceFieldsBySection[interfaceSubSection].firstIndex(where: { $0 == .dns })!
|
||||||
|
|
||||||
cell.onValueBeingEdited = { [weak self, weak peerData] value in
|
cell.onValueBeingEdited = { [weak self, weak peerData] value in
|
||||||
guard let self = self, let peerData = peerData else { return }
|
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)
|
self.tableView.deleteRows(at: [IndexPath(row: row, section: indexPath.section)], with: .fade)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tableView.reloadRows(at: [IndexPath(row: dnsRow, section: firstInterfaceSection + interfaceSubSection)], with: .none)
|
tableView.reloadRows(at: [IndexPath(row: dnsRow, section: firstInterfaceSection + interfaceSubSection)], with: .none)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue