diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-12-13 05:26:04 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-12-13 05:26:04 +0100 |
commit | 5971c197bdf114eae2d7672a699795a301b32ac0 (patch) | |
tree | 70c78e25e764a6691037a616f3bb5c992f88b2b1 /WireGuard/WireGuard/UI/iOS | |
parent | Settings: better padding calculation (diff) | |
download | wireguard-apple-5971c197bdf114eae2d7672a699795a301b32ac0.tar.xz wireguard-apple-5971c197bdf114eae2d7672a699795a301b32ac0.zip |
Remove useless whitespace
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'WireGuard/WireGuard/UI/iOS')
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift | 4 | ||||
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift | 26 | ||||
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/UITableViewCell+Reuse.swift | 2 |
3 files changed, 16 insertions, 16 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift b/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift index 2889694..ccbd00d 100644 --- a/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift +++ b/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift @@ -7,7 +7,7 @@ import os.log class ErrorPresenter { static func showErrorAlert(error: WireGuardAppError, from sourceVC: UIViewController?, onPresented: (() -> Void)? = nil, onDismissal: (() -> Void)? = nil) { guard let sourceVC = sourceVC else { return } - + let (title, message) = error.alertText() let okAction = UIAlertAction(title: "OK", style: .default) { _ in onDismissal?() @@ -20,7 +20,7 @@ class ErrorPresenter { static func showErrorAlert(title: String, message: String, from sourceVC: UIViewController?, onPresented: (() -> Void)? = nil, onDismissal: (() -> Void)? = nil) { guard let sourceVC = sourceVC else { return } - + let okAction = UIAlertAction(title: "OK", style: .default) { _ in onDismissal?() } diff --git a/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift index 7cd96a2..0386b0a 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift @@ -199,13 +199,13 @@ extension TunnelEditTableViewController { return interfaceFieldKeyValueCell(for: tableView, at: indexPath, with: field) } } - + private func generateKeyPairCell(for tableView: UITableView, at indexPath: IndexPath, with field: TunnelViewModel.InterfaceField) -> UITableViewCell { let cell: ButtonCell = tableView.dequeueReusableCell(for: indexPath) cell.buttonText = field.rawValue cell.onTapped = { [weak self] in guard let self = self else { return } - + self.tunnelViewModel.interfaceData[.privateKey] = Curve25519.generatePrivateKey().base64EncodedString() if let privateKeyRow = self.interfaceFieldsBySection[indexPath.section].firstIndex(of: .privateKey), let publicKeyRow = self.interfaceFieldsBySection[indexPath.section].firstIndex(of: .publicKey) { @@ -227,7 +227,7 @@ extension TunnelEditTableViewController { private func interfaceFieldKeyValueCell(for tableView: UITableView, at indexPath: IndexPath, with field: TunnelViewModel.InterfaceField) -> UITableViewCell { let cell: KeyValueCell = tableView.dequeueReusableCell(for: indexPath) cell.key = field.rawValue - + switch field { case .name, .privateKey: cell.placeholderText = "Required" @@ -260,7 +260,7 @@ extension TunnelEditTableViewController { if field == .privateKey { cell.onValueBeingEdited = { [weak self] value in guard let self = self else { return } - + self.tunnelViewModel.interfaceData[.privateKey] = value if let row = self.interfaceFieldsBySection[indexPath.section].firstIndex(of: .publicKey) { self.tableView.reloadRows(at: [IndexPath(row: row, section: indexPath.section)], with: .none) @@ -275,7 +275,7 @@ extension TunnelEditTableViewController { private func peerCell(for tableView: UITableView, at indexPath: IndexPath, with peerData: TunnelViewModel.PeerData) -> UITableViewCell { let peerFieldsToShow = peerData.shouldAllowExcludePrivateIPsControl ? peerFields : peerFields.filter { $0 != .excludePrivateIPs } let field = peerFieldsToShow[indexPath.row] - + switch field { case .deletePeer: return deletePeerCell(for: tableView, at: indexPath, peerData: peerData, field: field) @@ -285,7 +285,7 @@ extension TunnelEditTableViewController { return peerFieldKeyValueCell(for: tableView, at: indexPath, peerData: peerData, field: field) } } - + private func deletePeerCell(for tableView: UITableView, at indexPath: IndexPath, peerData: TunnelViewModel.PeerData, field: TunnelViewModel.PeerField) -> UITableViewCell { let cell: ButtonCell = tableView.dequeueReusableCell(for: indexPath) cell.buttonText = field.rawValue @@ -304,14 +304,14 @@ extension TunnelEditTableViewController { let rowIndexPath = IndexPath(row: row, section: self.interfaceFieldsBySection.count /* First peer section */) self.tableView.insertRows(at: [rowIndexPath], with: .fade) } - + } }) } } return cell } - + private func excludePrivateIPsCell(for tableView: UITableView, at indexPath: IndexPath, peerData: TunnelViewModel.PeerData, field: TunnelViewModel.PeerField) -> UITableViewCell { let cell: SwitchCell = tableView.dequeueReusableCell(for: indexPath) cell.message = field.rawValue @@ -326,7 +326,7 @@ extension TunnelEditTableViewController { } return cell } - + private func peerFieldKeyValueCell(for tableView: UITableView, at indexPath: IndexPath, peerData: TunnelViewModel.PeerData, field: TunnelViewModel.PeerField) -> UITableViewCell { let cell: KeyValueCell = tableView.dequeueReusableCell(for: indexPath) cell.key = field.rawValue @@ -350,11 +350,11 @@ extension TunnelEditTableViewController { cell.isValueValid = !peerData.fieldsWithError.contains(field) cell.value = peerData[field] - + if field == .allowedIPs { cell.onValueBeingEdited = { [weak self, weak peerData] value in guard let self = self, let peerData = peerData else { return } - + let oldValue = peerData.shouldAllowExcludePrivateIPsControl peerData[.allowedIPs] = value if oldValue != peerData.shouldAllowExcludePrivateIPsControl { @@ -372,7 +372,7 @@ extension TunnelEditTableViewController { peerData?[field] = value } } - + return cell } @@ -476,7 +476,7 @@ extension TunnelEditTableViewController { let option = activateOnDemandOptions[indexPath.row - 1] assert(option != .none) activateOnDemandSetting.activateOnDemandOption = option - + let indexPaths = (1 ..< 4).map { IndexPath(row: $0, section: indexPath.section) } UIView.performWithoutAnimation { tableView.reloadRows(at: indexPaths, with: .none) diff --git a/WireGuard/WireGuard/UI/iOS/UITableViewCell+Reuse.swift b/WireGuard/WireGuard/UI/iOS/UITableViewCell+Reuse.swift index 587f7b1..21d9a07 100644 --- a/WireGuard/WireGuard/UI/iOS/UITableViewCell+Reuse.swift +++ b/WireGuard/WireGuard/UI/iOS/UITableViewCell+Reuse.swift @@ -13,7 +13,7 @@ extension UITableView { func register<T: UITableViewCell>(_: T.Type) { register(T.self, forCellReuseIdentifier: T.reuseIdentifier) } - + func dequeueReusableCell<T: UITableViewCell>(for indexPath: IndexPath) -> T { //swiftlint:disable:next force_cast return dequeueReusableCell(withIdentifier: T.reuseIdentifier, for: indexPath) as! T |