From b348029074fcb01b19ccce0474f3c8c4ea3e8a8f Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Thu, 29 May 2025 16:56:40 +1000 Subject: [PATCH 1/2] feat: make on-upgrade steps more obvious --- .../Coder-Desktop/Views/VPN/VPNMenu.swift | 24 ----------- .../Coder-Desktop/Views/VPN/VPNState.swift | 40 ++++++++++++++++--- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/Coder-Desktop/Coder-Desktop/Views/VPN/VPNMenu.swift b/Coder-Desktop/Coder-Desktop/Views/VPN/VPNMenu.swift index 89365fd..ef33ae2 100644 --- a/Coder-Desktop/Coder-Desktop/Views/VPN/VPNMenu.swift +++ b/Coder-Desktop/Coder-Desktop/Views/VPN/VPNMenu.swift @@ -81,30 +81,6 @@ struct VPNMenu: View { }.buttonStyle(.plain) TrayDivider() } - // This shows when - // 1. The user is logged in - // 2. The network extension is installed - // 3. The VPN is unconfigured - // It's accompanied by a message in the VPNState view - // that the user needs to reconfigure. - if state.hasSession, vpn.state == .failed(.networkExtensionError(.unconfigured)) { - Button { - state.reconfigure() - } label: { - ButtonRowView { - Text("Reconfigure VPN") - } - }.buttonStyle(.plain) - } - if vpn.state == .failed(.systemExtensionError(.needsUserApproval)) { - Button { - openSystemExtensionSettings() - } label: { - ButtonRowView { Text("Approve in System Settings") } - }.buttonStyle(.plain) - } else { - AuthButton() - } Button { openSettings() appActivate() diff --git a/Coder-Desktop/Coder-Desktop/Views/VPN/VPNState.swift b/Coder-Desktop/Coder-Desktop/Views/VPN/VPNState.swift index e2aa1d8..a3f9437 100644 --- a/Coder-Desktop/Coder-Desktop/Views/VPN/VPNState.swift +++ b/Coder-Desktop/Coder-Desktop/Views/VPN/VPNState.swift @@ -10,17 +10,45 @@ struct VPNState: View { Group { switch (vpn.state, state.hasSession) { case (.failed(.systemExtensionError(.needsUserApproval)), _): - Text("Awaiting System Extension approval") - .font(.body) - .foregroundStyle(.secondary) + VStack { + Text("Awaiting System Extension approval") + .font(.headline) + .foregroundColor(.secondary) + .multilineTextAlignment(.center) + .fixedSize(horizontal: false, vertical: true) + .padding(.horizontal, Theme.Size.trayInset) + .padding(.vertical, Theme.Size.trayPadding) + .frame(maxWidth: .infinity) + Button { + openSystemExtensionSettings() + } label: { + Text("Approve in System Settings") + } + } case (_, false): Text("Sign in to use Coder Desktop") .font(.body) .foregroundColor(.secondary) case (.failed(.networkExtensionError(.unconfigured)), _): - Text("The system VPN requires reconfiguration.") - .font(.body) - .foregroundStyle(.secondary) + VStack { + Text("The system VPN requires reconfiguration") + .font(.headline) + .foregroundColor(.secondary) + .multilineTextAlignment(.center) + .fixedSize(horizontal: false, vertical: true) + .padding(.horizontal, Theme.Size.trayInset) + .padding(.vertical, Theme.Size.trayPadding) + .frame(maxWidth: .infinity) + Button { + state.reconfigure() + } label: { + Text("Reconfigure VPN") + } + }.onAppear { + // Show the prompt onAppear, so the user doesn't have to + // open the menu bar an extra time + state.reconfigure() + } case (.disabled, _): Text("Enable Coder Connect to see workspaces") .font(.body) From 6c5596cde0770f3ffa93a46bb2c3cf402caa05cf Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Thu, 29 May 2025 17:17:36 +1000 Subject: [PATCH 2/2] unbold, add back auth button --- Coder-Desktop/Coder-Desktop/Views/VPN/VPNMenu.swift | 1 + Coder-Desktop/Coder-Desktop/Views/VPN/VPNState.swift | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Coder-Desktop/Coder-Desktop/Views/VPN/VPNMenu.swift b/Coder-Desktop/Coder-Desktop/Views/VPN/VPNMenu.swift index ef33ae2..2a9e225 100644 --- a/Coder-Desktop/Coder-Desktop/Views/VPN/VPNMenu.swift +++ b/Coder-Desktop/Coder-Desktop/Views/VPN/VPNMenu.swift @@ -81,6 +81,7 @@ struct VPNMenu: View { }.buttonStyle(.plain) TrayDivider() } + AuthButton() Button { openSettings() appActivate() diff --git a/Coder-Desktop/Coder-Desktop/Views/VPN/VPNState.swift b/Coder-Desktop/Coder-Desktop/Views/VPN/VPNState.swift index a3f9437..9584ced 100644 --- a/Coder-Desktop/Coder-Desktop/Views/VPN/VPNState.swift +++ b/Coder-Desktop/Coder-Desktop/Views/VPN/VPNState.swift @@ -12,7 +12,6 @@ struct VPNState: View { case (.failed(.systemExtensionError(.needsUserApproval)), _): VStack { Text("Awaiting System Extension approval") - .font(.headline) .foregroundColor(.secondary) .multilineTextAlignment(.center) .fixedSize(horizontal: false, vertical: true) @@ -32,7 +31,6 @@ struct VPNState: View { case (.failed(.networkExtensionError(.unconfigured)), _): VStack { Text("The system VPN requires reconfiguration") - .font(.headline) .foregroundColor(.secondary) .multilineTextAlignment(.center) .fixedSize(horizontal: false, vertical: true)