macOS: Start refreshing runtime info in viewWillAppear(), not init()

Because when the window is closed and reopened, we should start
refreshing runtime info again.

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2019-05-26 20:04:02 +05:30
parent a18614d6b3
commit 30da10a0e9
1 changed files with 6 additions and 1 deletions

View File

@ -101,7 +101,6 @@ class TunnelDetailTableViewController: NSViewController {
super.init(nibName: nil, bundle: nil)
updateTableViewModelRowsBySection()
updateTableViewModelRows()
updateStatus()
statusObservationToken = tunnel.observe(\TunnelContainer.status) { [weak self] _, _ in
self?.updateStatus()
}
@ -227,6 +226,12 @@ class TunnelDetailTableViewController: NSViewController {
}
}
override func viewWillAppear() {
if tunnel.status == .active {
startUpdatingRuntimeConfiguration()
}
}
override func viewWillDisappear() {
super.viewWillDisappear()
if let tunnelEditVC = tunnelEditVC {