diff options
author | Roopesh Chander <roop@roopc.net> | 2019-02-03 12:27:51 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2019-02-03 12:40:19 +0530 |
commit | cbc602245e567c9635a60747b6eddf3713102829 (patch) | |
tree | 97e26b4977fd7c5ec247c9317f462b3260156595 /WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift | |
parent | wireguard-go: bump (diff) | |
download | wireguard-apple-cbc602245e567c9635a60747b6eddf3713102829.tar.xz wireguard-apple-cbc602245e567c9635a60747b6eddf3713102829.zip |
iOS: KeyValueCell should hold the observation token
And should nil the token when preparing for reuse.
Otherwise, the observation closure is still active even after the cell
gets reused.
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift')
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift index beb5d24..3e80d94 100644 --- a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift @@ -33,7 +33,6 @@ class TunnelDetailTableViewController: UITableViewController { private var peerFieldIsVisible = [[Bool]]() private weak var statusCell: SwitchCell? - private var onDemandStatusObservationToken: AnyObject? private var statusObservationToken: AnyObject? private var reloadRuntimeConfigurationTimer: Timer? @@ -352,7 +351,7 @@ extension TunnelDetailTableViewController { let cell: KeyValueCell = tableView.dequeueReusableCell(for: indexPath) cell.key = tr("tunnelOnDemandKey") cell.value = TunnelViewModel.activateOnDemandDetailText(for: tunnel.activateOnDemandSetting) - onDemandStatusObservationToken = tunnel.observe(\.isActivateOnDemandEnabled) { [weak cell] tunnel, _ in + cell.observationToken = tunnel.observe(\.isActivateOnDemandEnabled) { [weak cell] tunnel, _ in cell?.value = TunnelViewModel.activateOnDemandDetailText(for: tunnel.activateOnDemandSetting) } return cell |