aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-03-09 12:53:14 +0530
committerJason A. Donenfeld <Jason@zx2c4.com>2019-03-18 06:46:55 +0100
commit8e5a9215de945cd6a6bc274c37bb1f2d31581bd5 (patch)
treef0e2c5ca7af47a0dd089bafbc52de40fc2c212dc /WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift
parenton-demand: iOS: SSIDs view: Always show the selected SSIDs section (diff)
downloadwireguard-apple-8e5a9215de945cd6a6bc274c37bb1f2d31581bd5.tar.xz
wireguard-apple-8e5a9215de945cd6a6bc274c37bb1f2d31581bd5.zip
on-demand: iOS: Show list of SSIDs in a separate screen
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to '')
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift42
1 files changed, 36 insertions, 6 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift
index 4ed75a6..abee818 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift
@@ -76,10 +76,10 @@ class TunnelDetailTableViewController: UITableViewController {
tableView.estimatedRowHeight = 44
tableView.rowHeight = UITableView.automaticDimension
- tableView.allowsSelection = false
tableView.register(SwitchCell.self)
tableView.register(KeyValueCell.self)
tableView.register(ButtonCell.self)
+ tableView.register(ChevronCell.self)
restorationIdentifier = "TunnelDetailVC:\(tunnel.name)"
}
@@ -407,15 +407,26 @@ extension TunnelDetailTableViewController {
}
private func onDemandCell(for tableView: UITableView, at indexPath: IndexPath) -> UITableViewCell {
- let cell: KeyValueCell = tableView.dequeueReusableCell(for: indexPath)
let field = TunnelDetailTableViewController.onDemandFields[indexPath.row]
- cell.key = field.localizedUIString
if field == .onDemand {
+ let cell: KeyValueCell = tableView.dequeueReusableCell(for: indexPath)
+ cell.key = field.localizedUIString
cell.value = onDemandViewModel.localizedInterfaceDescription
- } else if field == .ssid {
- cell.value = onDemandViewModel.ssidOption.localizedUIString
+ return cell
+ } else {
+ assert(field == .ssid)
+ if onDemandViewModel.ssidOption == .anySSID {
+ let cell: KeyValueCell = tableView.dequeueReusableCell(for: indexPath)
+ cell.key = field.localizedUIString
+ cell.value = onDemandViewModel.ssidOption.localizedUIString
+ return cell
+ } else {
+ let cell: ChevronCell = tableView.dequeueReusableCell(for: indexPath)
+ cell.message = field.localizedUIString
+ cell.detailMessage = onDemandViewModel.ssidOption.localizedUIString
+ return cell
+ }
}
- return cell
}
private func deleteConfigurationCell(for tableView: UITableView, at indexPath: IndexPath) -> UITableViewCell {
@@ -438,3 +449,22 @@ extension TunnelDetailTableViewController {
}
}
+
+extension TunnelDetailTableViewController {
+ override func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? {
+ if case .onDemand = sections[indexPath.section],
+ case .ssid = TunnelDetailTableViewController.onDemandFields[indexPath.row] {
+ return indexPath
+ }
+ return nil
+ }
+
+ override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+ if case .onDemand = sections[indexPath.section],
+ case .ssid = TunnelDetailTableViewController.onDemandFields[indexPath.row] {
+ let ssidDetailVC = SSIDOptionDetailTableViewController(title: onDemandViewModel.ssidOption.localizedUIString, ssids: onDemandViewModel.selectedSSIDs)
+ navigationController?.pushViewController(ssidDetailVC, animated: true)
+ }
+ tableView.deselectRow(at: indexPath, animated: true)
+ }
+}