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

Commitdd9870f

Browse files
committed
add stop vpn on quit setting
1 parentcf9c422 commitdd9870f

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

‎Coder Desktop/Coder Desktop/Coder_DesktopApp.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
4747
}
4848
}
4949

50-
// MUST eventually call `NSApp.reply(toApplicationShouldTerminate: true)`
50+
// MUST eventually call `NSApp.reply(toApplicationShouldTerminate: true)`
51+
// or return `.terminateNow`
5152
func applicationShouldTerminate(_:NSApplication)->NSApplication.TerminateReply{
53+
if !settings.stopVPNOnQuit{return.terminateNow}
5254
Task{
5355
await vpn.stop()
5456
NSApp.reply(toApplicationShouldTerminate:true)

‎Coder Desktop/Coder Desktop/State.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ class Settings: ObservableObject {
104104
}
105105
}
106106

107+
@AppStorage(Keys.stopVPNOnQuit)varstopVPNOnQuit=true
108+
107109
init(store:UserDefaults=.standard){
108110
self.store= store
109111
_literalHeaders=Published(
@@ -116,6 +118,7 @@ class Settings: ObservableObject {
116118
enumKeys{
117119
staticletuseLiteralHeaders="UseLiteralHeaders"
118120
staticletliteralHeaders="LiteralHeaders"
121+
staticletstopVPNOnQuit="StopVPNOnQuit"
119122
}
120123
}
121124

‎Coder Desktop/Coder Desktop/Views/Settings/GeneralTab.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@ import LaunchAtLogin
22
import SwiftUI
33

44
structGeneralTab:View{
5+
@EnvironmentObjectvarsettings:Settings
56
varbody:someView{
67
Form{
78
Section{
89
LaunchAtLogin.Toggle("Launch at Login")
910
}
11+
Section{
12+
Toggle(isOn: $settings.stopVPNOnQuit){
13+
Text("Stop VPN on Quit")
14+
}
15+
}
1016
}.formStyle(.grouped)
1117
}
1218
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp