Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0216151802 | |||
| 490ebe6a4e | |||
| f22500e853 | |||
| 9b1199524f |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Vector.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "Vector@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "Vector@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 650 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
@@ -64,6 +64,8 @@ protocol VPNService: AnyObject {
|
||||
|
||||
var isSystemExtension: Bool { get }
|
||||
|
||||
var isKillSwitchSupported: Bool { get }
|
||||
|
||||
func install() -> Future<Void>
|
||||
|
||||
@discardableResult
|
||||
@@ -87,6 +89,8 @@ extension VPNService {
|
||||
|
||||
var isSystemExtension: Bool { false }
|
||||
|
||||
var isKillSwitchSupported: Bool { false }
|
||||
|
||||
func install() -> Future<Void> { Future.init(value: ()) }
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,8 @@ final class WireGuardService: VPNService {
|
||||
|
||||
let isSystemExtension = true
|
||||
|
||||
let isKillSwitchSupported = true
|
||||
|
||||
private(set) var state: VPNConnectionState = .disconnected {
|
||||
didSet {
|
||||
let state = self.state
|
||||
|
||||
+3
-5
@@ -179,11 +179,9 @@ final class InterfaceApplicationSettingsViewController: NSViewController, Interf
|
||||
return
|
||||
}
|
||||
|
||||
var fieldValue: String
|
||||
if let buildDate = buildDate {
|
||||
fieldValue = "\(versionString), build date: \(buildDate)"
|
||||
} else {
|
||||
fieldValue = "\(versionString)"
|
||||
var fieldValue = "\(versionString)"
|
||||
if debug, let buildDate = buildDate {
|
||||
fieldValue += ", build date: \(buildDate)"
|
||||
}
|
||||
|
||||
if debug {
|
||||
|
||||
+1
@@ -17,6 +17,7 @@ struct ProtocolPreferenceRecord: Equatable {
|
||||
// let type
|
||||
let title: String
|
||||
let description: String
|
||||
let image: String?
|
||||
let enabled: Bool
|
||||
let type: VPNType
|
||||
let options: [PreferenceOptions]?
|
||||
|
||||
+6
@@ -26,6 +26,8 @@ final class ProtocolPreferencesPresenter: ProtocolPreferencesViewOutput {
|
||||
PreferenceOptionsValue(title: "8443", value: 8443)]
|
||||
|
||||
static let notificationColor = 16759040 // #color(FFB900)
|
||||
|
||||
static let imagePreview = "preview"
|
||||
}
|
||||
|
||||
weak var viewInput: ProtocolPreferencesViewInput? {
|
||||
@@ -148,24 +150,28 @@ final class ProtocolPreferencesPresenter: ProtocolPreferencesViewOutput {
|
||||
return [
|
||||
ProtocolPreferenceRecord(title: NSLocalizedString("preference.protocol.automatic.title", comment: ""),
|
||||
description: NSLocalizedString("preference.protocol.automatic.description", comment: ""),
|
||||
image: nil,
|
||||
enabled: true,
|
||||
type: .automatic,
|
||||
options: nil,
|
||||
notification: nil),
|
||||
ProtocolPreferenceRecord(title: NSLocalizedString("preference.protocol.ikev2.title", comment: ""),
|
||||
description: NSLocalizedString("preference.protocol.ikev2.description", comment: ""),
|
||||
image: nil,
|
||||
enabled: true,
|
||||
type: .ikev2,
|
||||
options: nil,
|
||||
notification: nil),
|
||||
ProtocolPreferenceRecord(title: NSLocalizedString("preference.protocol.wireguard.title", comment: ""),
|
||||
description: wireguardDescription,
|
||||
image: enableWireguard ? Constants.imagePreview : nil,
|
||||
enabled: enableWireguard,
|
||||
type: .wireGuard,
|
||||
options: nil,
|
||||
notification: notificationWG),
|
||||
ProtocolPreferenceRecord(title: NSLocalizedString("preference.protocol.openVPN.title", comment: ""),
|
||||
description: ovpnDescription,
|
||||
image: nil,
|
||||
enabled: enableOpenVPN,
|
||||
type: .openVPN,
|
||||
options: options,
|
||||
|
||||
+21
-3
@@ -36,7 +36,7 @@ final class ProtocolPreferencesViewController: NSViewController, PreferencePane
|
||||
static let innerSpace: CGFloat = 4.0
|
||||
static let leadingDescription: CGFloat = 30.0
|
||||
static let radioHeight: CGFloat = 30
|
||||
static let radioWidth: CGFloat = 150
|
||||
static let radioWidth: CGFloat = 140
|
||||
static let titleTrailing: CGFloat = 5
|
||||
static let titleCenter: CGFloat = 3
|
||||
static let viewTop: CGFloat = 16
|
||||
@@ -63,7 +63,6 @@ final class ProtocolPreferencesViewController: NSViewController, PreferencePane
|
||||
}
|
||||
// swiftlint:enable nesting
|
||||
|
||||
private var titleLabel: NSTextField?
|
||||
private var protocols = [ProtocolPreferenceRecord]()
|
||||
private var optionsViews = [Int: [PreferenceOptionsView]]()
|
||||
private let output: ProtocolPreferencesViewOutput
|
||||
@@ -126,6 +125,17 @@ final class ProtocolPreferencesViewController: NSViewController, PreferencePane
|
||||
radioButton.textYoffset = 2
|
||||
self.view.addSubview(radioButton)
|
||||
|
||||
let imageView: ImageView?
|
||||
if let imageName = record.image,
|
||||
let image = NSImage(named: imageName) {
|
||||
let view = ImageView(image: image)
|
||||
view.translatesAutoresizingMaskIntoConstraints = false
|
||||
imageView = view
|
||||
self.view.addSubview(view)
|
||||
} else {
|
||||
imageView = nil
|
||||
}
|
||||
|
||||
let textField = NSTextField(labelWithString: record.description)
|
||||
textField.isEnabled = record.enabled
|
||||
textField.lineBreakMode = .byWordWrapping
|
||||
@@ -141,7 +151,6 @@ final class ProtocolPreferencesViewController: NSViewController, PreferencePane
|
||||
radioButton.topAnchor.constraint(equalTo: after.bottomAnchor, constant: Constants.Geometry.recordsSpace)
|
||||
|
||||
var layout: [NSLayoutConstraint] = [
|
||||
|
||||
radioTopConstraint,
|
||||
radioButton.leadingAnchor.constraint(equalTo: self.view.leadingAnchor, constant: Constants.Geometry.leading),
|
||||
radioButton.heightAnchor.constraint(equalToConstant: Constants.Geometry.radioHeight),
|
||||
@@ -152,6 +161,15 @@ final class ProtocolPreferencesViewController: NSViewController, PreferencePane
|
||||
textField.trailingAnchor.constraint(equalTo: after.trailingAnchor)
|
||||
]
|
||||
|
||||
if let imageView = imageView {
|
||||
layout.append(contentsOf: [
|
||||
imageView.topAnchor.constraint(equalTo: radioButton.topAnchor),
|
||||
imageView.heightAnchor.constraint(equalTo: radioButton.heightAnchor, multiplier: 0.5),
|
||||
imageView.leadingAnchor.constraint(equalTo: radioButton.trailingAnchor),
|
||||
imageView.widthAnchor.constraint(equalTo: imageView.heightAnchor, multiplier: 3.0)
|
||||
])
|
||||
}
|
||||
|
||||
// Show notification if exists
|
||||
let lastTextField: NSTextField
|
||||
if let notification = record.notification {
|
||||
|
||||
-2
@@ -30,8 +30,6 @@ final class SupportPreferencesViewController: NSViewController, PreferencePane,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private var versionField: NSTextField?
|
||||
|
||||
private let output: SupportPreferenceViewOutput
|
||||
|
||||
|
||||
Reference in New Issue
Block a user