Skip to content

Commit 65f4619

Browse files
feat: make on-upgrade steps more obvious (#172)
Before: <img width="254" alt="image" src="https://github.com/user-attachments/assets/1460ea58-c915-4c72-85c4-0655030cb99f" /> After: <img width="260" alt="Screenshot 2025-05-29 at 4 41 05 pm" src="https://github.com/user-attachments/assets/34fe0293-ccc4-4686-9285-eb7482d7a10e" /> <img width="258" alt="Screenshot 2025-05-29 at 4 40 56 pm" src="https://github.com/user-attachments/assets/2bd640eb-5d11-4384-8a24-b705148c2b2a" />
1 parent 5785fae commit 65f4619

File tree

2 files changed

+33
-30
lines changed

2 files changed

+33
-30
lines changed

Coder-Desktop/Coder-Desktop/Views/VPN/VPNMenu.swift

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -81,30 +81,7 @@ struct VPNMenu<VPN: VPNService, FS: FileSyncDaemon>: View {
8181
}.buttonStyle(.plain)
8282
TrayDivider()
8383
}
84-
// This shows when
85-
// 1. The user is logged in
86-
// 2. The network extension is installed
87-
// 3. The VPN is unconfigured
88-
// It's accompanied by a message in the VPNState view
89-
// that the user needs to reconfigure.
90-
if state.hasSession, vpn.state == .failed(.networkExtensionError(.unconfigured)) {
91-
Button {
92-
state.reconfigure()
93-
} label: {
94-
ButtonRowView {
95-
Text("Reconfigure VPN")
96-
}
97-
}.buttonStyle(.plain)
98-
}
99-
if vpn.state == .failed(.systemExtensionError(.needsUserApproval)) {
100-
Button {
101-
openSystemExtensionSettings()
102-
} label: {
103-
ButtonRowView { Text("Approve in System Settings") }
104-
}.buttonStyle(.plain)
105-
} else {
106-
AuthButton<VPN>()
107-
}
84+
AuthButton<VPN>()
10885
Button {
10986
openSettings()
11087
appActivate()

Coder-Desktop/Coder-Desktop/Views/VPN/VPNState.swift

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,43 @@ struct VPNState<VPN: VPNService>: View {
1010
Group {
1111
switch (vpn.state, state.hasSession) {
1212
case (.failed(.systemExtensionError(.needsUserApproval)), _):
13-
Text("Awaiting System Extension approval")
14-
.font(.body)
15-
.foregroundStyle(.secondary)
13+
VStack {
14+
Text("Awaiting System Extension approval")
15+
.foregroundColor(.secondary)
16+
.multilineTextAlignment(.center)
17+
.fixedSize(horizontal: false, vertical: true)
18+
.padding(.horizontal, Theme.Size.trayInset)
19+
.padding(.vertical, Theme.Size.trayPadding)
20+
.frame(maxWidth: .infinity)
21+
Button {
22+
openSystemExtensionSettings()
23+
} label: {
24+
Text("Approve in System Settings")
25+
}
26+
}
1627
case (_, false):
1728
Text("Sign in to use Coder Desktop")
1829
.font(.body)
1930
.foregroundColor(.secondary)
2031
case (.failed(.networkExtensionError(.unconfigured)), _):
21-
Text("The system VPN requires reconfiguration.")
22-
.font(.body)
23-
.foregroundStyle(.secondary)
32+
VStack {
33+
Text("The system VPN requires reconfiguration")
34+
.foregroundColor(.secondary)
35+
.multilineTextAlignment(.center)
36+
.fixedSize(horizontal: false, vertical: true)
37+
.padding(.horizontal, Theme.Size.trayInset)
38+
.padding(.vertical, Theme.Size.trayPadding)
39+
.frame(maxWidth: .infinity)
40+
Button {
41+
state.reconfigure()
42+
} label: {
43+
Text("Reconfigure VPN")
44+
}
45+
}.onAppear {
46+
// Show the prompt onAppear, so the user doesn't have to
47+
// open the menu bar an extra time
48+
state.reconfigure()
49+
}
2450
case (.disabled, _):
2551
Text("Enable Coder Connect to see workspaces")
2652
.font(.body)

0 commit comments

Comments
 (0)