Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0b34361

Browse files
committed
fix: prompt for sign in when toggling coder connect on
1 parentebcb698 commit0b34361

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,15 @@ struct VPNMenu<VPN: VPNService, FS: FileSyncDaemon>: View {
117117
}
118118

119119
privatevarvpnDisabled:Bool{
120-
vpn.state==.connecting ||
121-
vpn.state==.disconnecting ||
122-
// Prevent starting the VPN before the user has approved the system extension.
123-
vpn.state==.failed(.systemExtensionError(.needsUserApproval)) ||
124-
// Prevent starting the VPN without a VPN configuration.
125-
vpn.state==.failed(.networkExtensionError(.unconfigured))
120+
// Always enabled if signed out, as that will open the sign in window
121+
state.hasSession &&(
122+
vpn.state==.connecting ||
123+
vpn.state==.disconnecting ||
124+
// Prevent starting the VPN before the user has approved the system extension.
125+
vpn.state==.failed(.systemExtensionError(.needsUserApproval)) ||
126+
// Prevent starting the VPN without a VPN configuration.
127+
vpn.state==.failed(.networkExtensionError(.unconfigured))
128+
)
126129
}
127130
}
128131

‎Coder-Desktop/Coder-DesktopTests/VPNMenuTests.swift‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ struct VPNMenuTests {
3232
}
3333
}
3434

35+
@Test
36+
func testVPNLoggedOutUnconfigured()asyncthrows{
37+
vpn.state=.failed(.networkExtensionError(.unconfigured))
38+
tryawaitViewHosting.host(view){
39+
tryawait sut.inspection.inspect{ viewin
40+
lettoggle=try view.find(ViewType.Toggle.self)
41+
// Toggle should be enabled even with a failure that would
42+
// normally make it disabled, because we're signed out.
43+
#expect(!toggle.isDisabled())
44+
#expect(throws:Never.self){try view.find(text:"Sign in to use Coder Desktop")}
45+
#expect(throws:Never.self){try view.find(button:"Sign in")}
46+
}
47+
}
48+
}
49+
3550
@Test
3651
func testStartStopCalled()asyncthrows{
3752
tryawaitViewHosting.host(view){
@@ -59,6 +74,7 @@ struct VPNMenuTests {
5974
@Test
6075
func testVPNDisabledWhileConnecting()asyncthrows{
6176
vpn.state=.disabled
77+
state.login(baseAccessURL:URL(string:"https://coder.example.com")!, sessionToken:"fake-token")
6278

6379
tryawaitViewHosting.host(view){
6480
tryawait sut.inspection.inspect{ viewin
@@ -79,6 +95,7 @@ struct VPNMenuTests {
7995
@Test
8096
func testVPNDisabledWhileDisconnecting()asyncthrows{
8197
vpn.state=.disabled
98+
state.login(baseAccessURL:URL(string:"https://coder.example.com")!, sessionToken:"fake-token")
8299

83100
tryawaitViewHosting.host(view){
84101
tryawait sut.inspection.inspect{ viewin

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp