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

Commit37d7e35

Browse files
chore: set 'stop VPN on quit' setting to true by default (#155)
It's fair to assume if you're closing Coder Desktop, you want Coder Connect to stop, so this is the default behaviour.Tailscale also stops their VPN when quitting the app, even though it works fine with the app closed.
1 parent314edbe commit37d7e35

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

‎Coder-Desktop/Coder-Desktop/State.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ class AppState: ObservableObject {
5555
}
5656
}
5757

58-
@PublishedvarstopVPNOnQuit:Bool=UserDefaults.standard.bool(forKey:Keys.stopVPNOnQuit){
58+
// Defaults to `true`
59+
@PublishedvarstopVPNOnQuit:Bool=UserDefaults.standard.optionalBool(forKey:Keys.stopVPNOnQuit)??true{
5960
didSet{
6061
guard persistentelse{return}
6162
UserDefaults.standard.set(stopVPNOnQuit, forKey:Keys.stopVPNOnQuit)
@@ -239,3 +240,14 @@ extension LiteralHeader {
239240
.init(name: name, value: value)
240241
}
241242
}
243+
244+
extensionUserDefaults{
245+
// Unlike the exisitng `bool(forKey:)` method which returns `false` for both
246+
// missing values this method can return `nil`.
247+
func optionalBool(forKey key:String)->Bool?{
248+
guardobject(forKey: key)!=nilelse{
249+
returnnil
250+
}
251+
returnbool(forKey: key)
252+
}
253+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp