Skip to content

Commit c29bf39

Browse files
committed
fixup
1 parent 5d5cd38 commit c29bf39

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

Coder-Desktop/Coder-Desktop/Preview Content/PreviewVPN.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class PreviewVPN: Coder_Desktop.VPNService {
3333
self.shouldFail = shouldFail
3434
}
3535

36-
@Published var progress: VPNProgress = .init(stage: .none, downloadProgress: nil)
36+
@Published var progress: VPNProgress = .init(stage: .initial, downloadProgress: nil)
3737

3838
var startTask: Task<Void, Never>?
3939
func start() async {

Coder-Desktop/Coder-Desktop/VPN/VPNProgress.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct VPNProgressView: View {
4141
return nil
4242
}
4343
switch progress.stage {
44-
case .none:
44+
case .initial:
4545
return 0.10
4646
case .downloading:
4747
guard let downloadProgress = progress.downloadProgress else {

Coder-Desktop/Coder-Desktop/VPN/VPNService.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,14 @@ final class CoderVPNService: NSObject, VPNService {
5656
var logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "vpn")
5757
lazy var xpc: VPNXPCInterface = .init(vpn: self)
5858

59-
@Published var tunnelState: VPNServiceState = .disabled
59+
@Published var tunnelState: VPNServiceState = .disabled {
60+
didSet {
61+
if tunnelState == .connecting {
62+
progress = .init(stage: .initial, downloadProgress: nil)
63+
}
64+
}
65+
}
66+
6067
@Published var sysExtnState: SystemExtensionState = .uninstalled
6168
@Published var neState: NetworkExtensionState = .unconfigured
6269
var state: VPNServiceState {
@@ -73,7 +80,7 @@ final class CoderVPNService: NSObject, VPNService {
7380
return tunnelState
7481
}
7582

76-
@Published var progress: VPNProgress = .init(stage: .none, downloadProgress: nil)
83+
@Published var progress: VPNProgress = .init(stage: .initial, downloadProgress: nil)
7784

7885
@Published var menuState: VPNMenuState = .init()
7986

Coder-Desktop/Coder-DesktopTests/Util.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class MockVPNService: VPNService, ObservableObject {
1010
@Published var state: Coder_Desktop.VPNServiceState = .disabled
1111
@Published var baseAccessURL: URL = .init(string: "https://dev.coder.com")!
1212
@Published var menuState: VPNMenuState = .init()
13-
@Published var progress: VPNProgress = .init(stage: .none, downloadProgress: nil)
13+
@Published var progress: VPNProgress = .init(stage: .initial, downloadProgress: nil)
1414
var onStart: (() async -> Void)?
1515
var onStop: (() async -> Void)?
1616

Coder-Desktop/VPN/PacketTunnelProvider.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ class PacketTunnelProvider: NEPacketTunnelProvider, @unchecked Sendable {
9292
logger.info("vpn started")
9393
self.manager = manager
9494
completionHandler(nil)
95-
// Clear progress message
96-
pushProgress(stage: .none, downloadProgress: nil)
9795
} catch {
9896
logger.error("error starting manager: \(error.description, privacy: .public)")
9997
completionHandler(

Coder-Desktop/VPNLib/XPC.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import Foundation
1515
}
1616

1717
@objc public enum ProgressStage: Int, Sendable {
18-
case none
18+
case initial
1919
case downloading
2020
case validating
2121
case removingQuarantine
@@ -25,7 +25,7 @@ import Foundation
2525

2626
public var description: String? {
2727
switch self {
28-
case .none:
28+
case .initial:
2929
nil
3030
case .downloading:
3131
"Downloading library..."

0 commit comments

Comments
 (0)