aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Kuck <eric@bluelinelabs.com>2018-12-22 15:32:29 -0600
committerEric Kuck <eric@bluelinelabs.com>2018-12-22 15:32:29 -0600
commit035055ef0a8784ae7849bb6ed4a5d380911688fc (patch)
treeed818efa83c18c815c366438e23dc7c73b64514a
parentFix typo for simulator builds (diff)
downloadwireguard-apple-035055ef0a8784ae7849bb6ed4a5d380911688fc.tar.xz
wireguard-apple-035055ef0a8784ae7849bb6ed4a5d380911688fc.zip
SwitchCell nits
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
-rw-r--r--WireGuard/WireGuard/UI/iOS/View/SwitchCell.swift1
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift9
2 files changed, 5 insertions, 5 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/View/SwitchCell.swift b/WireGuard/WireGuard/UI/iOS/View/SwitchCell.swift
index 68939a7..7794e6b 100644
--- a/WireGuard/WireGuard/UI/iOS/View/SwitchCell.swift
+++ b/WireGuard/WireGuard/UI/iOS/View/SwitchCell.swift
@@ -41,6 +41,7 @@ class SwitchCell: UITableViewCell {
override func prepareForReuse() {
super.prepareForReuse()
+ onSwitchToggled = nil
isEnabled = true
message = ""
isOn = false
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift
index 968f0f9..6fc0646 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift
@@ -414,17 +414,16 @@ extension TunnelEditTableViewController {
guard let self = self else { return }
guard isOn != self.activateOnDemandSetting.isActivateOnDemandEnabled else { return }
+ self.activateOnDemandSetting.isActivateOnDemandEnabled = isOn
+ self.loadSections()
+
let indexPaths = (1 ..< 4).map { IndexPath(row: $0, section: indexPath.section) }
if isOn {
- self.activateOnDemandSetting.isActivateOnDemandEnabled = true
if self.activateOnDemandSetting.activateOnDemandOption == .none {
self.activateOnDemandSetting.activateOnDemandOption = TunnelViewModel.defaultActivateOnDemandOption()
}
- self.loadSections()
self.tableView.insertRows(at: indexPaths, with: .fade)
} else {
- self.activateOnDemandSetting.isActivateOnDemandEnabled = false
- self.loadSections()
self.tableView.deleteRows(at: indexPaths, with: .fade)
}
}
@@ -435,7 +434,7 @@ extension TunnelEditTableViewController {
let selectedOption = activateOnDemandSetting.activateOnDemandOption
assert(selectedOption != .none)
cell.message = TunnelViewModel.activateOnDemandOptionText(for: rowOption)
- cell.isChecked = (selectedOption == rowOption)
+ cell.isChecked = selectedOption == rowOption
return cell
}
}