aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-02-24 16:05:13 +0530
committerRoopesh Chander <roop@roopc.net>2019-02-24 16:06:37 +0530
commitd3df8734c228e4bcb728928a75e1438ffd7aacd4 (patch)
treea9335c1ae873700694edb26c1daca8dec384a18b
parentmacOS: Tunnel edit: s/populateTextFields()/populateFields()/g; (diff)
downloadwireguard-apple-d3df8734c228e4bcb728928a75e1438ffd7aacd4.tar.xz
wireguard-apple-d3df8734c228e4bcb728928a75e1438ffd7aacd4.zip
macOS: Tunnel edit: Disable user interaction when OS VPN prompt is shown
Signed-off-by: Roopesh Chander <roop@roopc.net>
-rw-r--r--WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift10
1 files changed, 10 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift
index b99bffcc..6e4a23a5 100644
--- a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift
+++ b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift
@@ -198,6 +198,12 @@ class TunnelEditViewController: NSViewController {
self.view = containerView
}
+ func setUserInteractionEnabled(_ enabled: Bool) {
+ view.window?.ignoresMouseEvents = !enabled
+ nameRow.valueLabel.isEditable = enabled
+ textView.isEditable = enabled
+ }
+
@objc func handleSaveAction() {
let name = nameRow.value
guard !name.isEmpty else {
@@ -242,9 +248,12 @@ class TunnelEditViewController: NSViewController {
}
}
+ setUserInteractionEnabled(false)
+
if let tunnel = tunnel {
// We're modifying an existing tunnel
tunnelsManager.modify(tunnel: tunnel, tunnelConfiguration: tunnelConfiguration, activateOnDemandSetting: onDemandSetting) { [weak self] error in
+ self?.setUserInteractionEnabled(true)
if let error = error {
ErrorPresenter.showErrorAlert(error: error, from: self)
return
@@ -256,6 +265,7 @@ class TunnelEditViewController: NSViewController {
// We're creating a new tunnel
AppStorePrivacyNotice.show(from: self, into: tunnelsManager) { [weak self] in
self?.tunnelsManager.add(tunnelConfiguration: tunnelConfiguration, activateOnDemandSetting: onDemandSetting) { [weak self] result in
+ self?.setUserInteractionEnabled(true)
if let error = result.error {
ErrorPresenter.showErrorAlert(error: error, from: self)
return