From: Roopesh Chander Date: Sun, 26 May 2019 14:34:02 +0000 (+0530) Subject: macOS: Start refreshing runtime info in viewWillAppear(), not init() X-Git-Tag: 0.0.20190531-9~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=30da10a0e91f8614193619f7b40ee2441d14f44d;p=thirdparty%2Fwireguard-apple.git 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 --- diff --git a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift index 9cd9c76..5158b37 100644 --- a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift +++ b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift @@ -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 {