macOS: Fix autolayout errors on Add Empty Tunnel

This commit is contained in:
Roopesh Chander 2019-01-17 14:20:09 +05:30
parent 1e25c4f554
commit a61a043537
1 changed files with 2 additions and 5 deletions

View File

@ -25,7 +25,7 @@ class TunnelEditViewController: NSViewController {
let textView: ConfTextView = { let textView: ConfTextView = {
let textView = ConfTextView() let textView = ConfTextView()
let minWidth: CGFloat = 120 let minWidth: CGFloat = 120
let minHeight: CGFloat = 60 let minHeight: CGFloat = 0
textView.minSize = NSSize(width: 0, height: minHeight) textView.minSize = NSSize(width: 0, height: minHeight)
textView.maxSize = NSSize(width: CGFloat.greatestFiniteMagnitude, height: CGFloat.greatestFiniteMagnitude) textView.maxSize = NSSize(width: CGFloat.greatestFiniteMagnitude, height: CGFloat.greatestFiniteMagnitude)
textView.autoresizingMask = [.width] // Width should be based on superview width textView.autoresizingMask = [.width] // Width should be based on superview width
@ -124,10 +124,7 @@ class TunnelEditViewController: NSViewController {
// Creating a new tunnel // Creating a new tunnel
let privateKey = Curve25519.generatePrivateKey() let privateKey = Curve25519.generatePrivateKey()
let publicKey = Curve25519.generatePublicKey(fromPrivateKey: privateKey) let publicKey = Curve25519.generatePublicKey(fromPrivateKey: privateKey)
let bootstrappingText = """ let bootstrappingText = "[Interface]\nPrivateKey = \(privateKey.base64EncodedString())\n"
[Interface]
PrivateKey = \(privateKey.base64EncodedString())
"""
publicKeyRow.value = publicKey.base64EncodedString() publicKeyRow.value = publicKey.base64EncodedString()
textView.string = bootstrappingText textView.string = bootstrappingText
selectedActivateOnDemandOption = .none selectedActivateOnDemandOption = .none