Clean up trailing whitespace

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2018-12-22 05:30:35 +01:00
parent b0b6866c51
commit d36e7e27ff
4 changed files with 12 additions and 12 deletions

View File

@ -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"))

View File

@ -72,7 +72,7 @@ class TunnelListCell: UITableViewCell {
statusSwitch.addTarget(self, action: #selector(switchToggled), for: .valueChanged)
}
@objc func switchToggled() {
onSwitchToggled?(statusSwitch.isOn)
}

View File

@ -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)
}
}
}
}

View File

@ -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 {