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

Commitba8bd98

Browse files
committed
fixup
1 parent06c517c commitba8bd98

File tree

5 files changed

+24
-10
lines changed

5 files changed

+24
-10
lines changed

‎Coder-Desktop/Coder-Desktop/Views/FileSync/FileSyncConfig.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,15 @@ struct FileSyncConfig<VPN: VPNService, FS: FileSyncDaemon>: View {
5151
loading=true
5252
defer{ loading=false}
5353
dothrows(DaemonError){
54+
// TODO: Support selecting & deleting multiple sessions at once
5455
tryawait fileSync.deleteSessions(ids:[selection!])
56+
if fileSync.sessionState.isEmpty{
57+
// Last session was deleted, stop the daemon
58+
await fileSync.stop()
59+
}
5560
} catch{
5661
deleteError= error
5762
}
58-
await fileSync.refreshSessions()
5963
selection=nil
6064
}
6165
} label:{
@@ -66,7 +70,9 @@ struct FileSyncConfig<VPN: VPNService, FS: FileSyncDaemon>: View {
6670
Divider()
6771
Button{
6872
Task{
69-
// TODO: Support pausing & resuming multiple selections
73+
// TODO: Support pausing & resuming multiple sessions at once
74+
loading=true
75+
defer{ loading=false}
7076
switch selectedSession.status{
7177
case.paused:
7278
tryawait fileSync.resumeSessions(ids:[selectedSession.id])

‎Coder-Desktop/Coder-Desktop/Views/FileSync/FileSyncSessionModal.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ struct FileSyncSessionModal<VPN: VPNService, FS: FileSyncDaemon>: View {
8383
defer{ loading=false}
8484
dothrows(DaemonError){
8585
iflet existingSession{
86-
// TODO: Support selecting & deleting multiple sessions at once
8786
tryawait fileSync.deleteSessions(ids:[existingSession.id])
8887
}
8988
tryawait fileSync.createSession(

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ class MockFileSyncDaemon: FileSyncDaemon {
4848
}
4949

5050
func createSession(localPath _:String, agentHost _:String, remotePath _:String)asyncthrows(DaemonError){}
51+
52+
func pauseSessions(ids _:[String])asyncthrows(VPNLib.DaemonError){}
53+
54+
func resumeSessions(ids _:[String])asyncthrows(VPNLib.DaemonError){}
5155
}
5256

5357
extensionInspection:@uncheckedSendable,@retroactiveInspectionEmissary{}

‎Coder-Desktop/VPNLib/FileSync/FileSyncDaemon.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ public class MutagenDaemon: FileSyncDaemon {
7777
return
7878
}
7979
awaitrefreshSessions()
80+
if sessionState.isEmpty{
81+
logger.info("No sync sessions found on startup, stopping daemon")
82+
awaitstop()
83+
}
8084
}
8185
}
8286

‎Coder-Desktop/VPNLib/FileSync/FileSyncManagement.swift

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ public extension MutagenDaemon {
1313
return
1414
}
1515
sessionState= sessions.sessionStates.map{FileSyncSession(state: $0)}
16-
if sessionState.isEmpty{
17-
logger.info("No sync sessions found")
18-
awaitstop()
19-
}
2016
}
2117

2218
func createSession(
@@ -61,7 +57,8 @@ public extension MutagenDaemon {
6157
}
6258

6359
func deleteSessions(ids:[String])asyncthrows(DaemonError){
64-
// Terminating sessions does not require prompting
60+
// Terminating sessions does not require prompting, according to the
61+
// Mutagen CLI
6562
let(stream, promptID)=tryawaithost(allowPrompts:false)
6663
defer{ stream.cancel()}
6764
guard case.running= stateelse{return}
@@ -79,7 +76,9 @@ public extension MutagenDaemon {
7976
}
8077

8178
func pauseSessions(ids:[String])asyncthrows(DaemonError){
82-
let(stream, promptID)=tryawaithost()
79+
// Pausing sessions does not require prompting, according to the
80+
// Mutagen CLI
81+
let(stream, promptID)=tryawaithost(allowPrompts:false)
8382
defer{ stream.cancel()}
8483
guard case.running= stateelse{return}
8584
do{
@@ -96,7 +95,9 @@ public extension MutagenDaemon {
9695
}
9796

9897
func resumeSessions(ids:[String])asyncthrows(DaemonError){
99-
let(stream, promptID)=tryawaithost()
98+
// Resuming sessions does not require prompting, according to the
99+
// Mutagen CLI
100+
let(stream, promptID)=tryawaithost(allowPrompts:false)
100101
defer{ stream.cancel()}
101102
guard case.running= stateelse{return}
102103
do{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp