aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-12-13 05:26:04 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-12-13 05:26:04 +0100
commit5971c197bdf114eae2d7672a699795a301b32ac0 (patch)
tree70c78e25e764a6691037a616f3bb5c992f88b2b1 /WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift
parentSettings: better padding calculation (diff)
downloadwireguard-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/TunnelEditTableViewController.swift')
-rw-r--r--WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift26
1 files changed, 13 insertions, 13 deletions
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)