@@ -48,7 +48,7 @@ public struct FileSyncSession: Identifiable {
4848 }
4949 if case . error = status { } else {
5050 if state. conflicts. count > 0 {
51- status = . needsAttention ( name : " Conflicts " , desc : " The session has conflicts that need to be resolved " )
51+ status = . conflicts
5252 }
5353 }
5454 self . status = status
@@ -133,11 +133,11 @@ public struct FileSyncSessionEndpointSize: Equatable {
133133
134134public enum FileSyncStatus {
135135 case unknown
136- case error( name : String , desc : String )
136+ case error( FileSyncErrorStatus )
137137 case ok
138138 case paused
139- case needsAttention ( name : String , desc : String )
140- case working( name : String , desc : String )
139+ case conflicts
140+ case working( FileSyncWorkingStatus )
141141
142142 public var color : Color {
143143 switch self {
@@ -149,7 +149,7 @@ public enum FileSyncStatus {
149149 . red
150150 case . error:
151151 . red
152- case . needsAttention :
152+ case . conflicts :
153153 . orange
154154 case . working:
155155 . purple
@@ -160,33 +160,33 @@ public enum FileSyncStatus {
160160 switch self {
161161 case . unknown:
162162 " Unknown "
163- case let . error( name , _ ) :
164- " \( name) "
163+ case let . error( status ) :
164+ status . name
165165 case . ok:
166166 " Watching "
167167 case . paused:
168168 " Paused "
169- case let . needsAttention ( name , _ ) :
170- name
171- case let . working( name , _ ) :
172- name
169+ case . conflicts :
170+ " Conflicts "
171+ case let . working( status ) :
172+ status . name
173173 }
174174 }
175175
176176 public var description : String {
177177 switch self {
178178 case . unknown:
179179 " Unknown status message. "
180- case let . error( _ , desc ) :
181- desc
180+ case let . error( status ) :
181+ status . description
182182 case . ok:
183183 " The session is watching for filesystem changes. "
184184 case . paused:
185185 " The session is paused. "
186- case let . needsAttention ( _ , desc ) :
187- desc
188- case let . working( _ , desc ) :
189- desc
186+ case . conflicts :
187+ " The session has conflicts that need to be resolved. "
188+ case let . working( status ) :
189+ status . description
190190 }
191191 }
192192
@@ -195,6 +195,97 @@ public enum FileSyncStatus {
195195 }
196196}
197197
198+ public enum FileSyncWorkingStatus {
199+ case connectingLocal
200+ case connectingRemote
201+ case scanning
202+ case reconciling
203+ case stagingLocal
204+ case stagingRemote
205+ case transitioning
206+ case saving
207+
208+ var name : String {
209+ switch self {
210+ case . connectingLocal:
211+ return " Connecting (local) "
212+ case . connectingRemote:
213+ return " Connecting (remote) "
214+ case . scanning:
215+ return " Scanning "
216+ case . reconciling:
217+ return " Reconciling "
218+ case . stagingLocal:
219+ return " Staging (local) "
220+ case . stagingRemote:
221+ return " Staging (remote) "
222+ case . transitioning:
223+ return " Transitioning "
224+ case . saving:
225+ return " Saving "
226+ }
227+ }
228+
229+ var description : String {
230+ switch self {
231+ case . connectingLocal:
232+ return " The session is attempting to connect to the local endpoint. "
233+ case . connectingRemote:
234+ return " The session is attempting to connect to the remote endpoint. "
235+ case . scanning:
236+ return " The session is scanning the filesystem on each endpoint. "
237+ case . reconciling:
238+ return " The session is performing reconciliation. "
239+ case . stagingLocal:
240+ return " The session is staging files locally "
241+ case . stagingRemote:
242+ return " The session is staging files on the remote "
243+ case . transitioning:
244+ return " The session is performing transition operations on each endpoint. "
245+ case . saving:
246+ return " The session is recording synchronization history to disk. "
247+ }
248+ }
249+ }
250+
251+ public enum FileSyncErrorStatus {
252+ case disconnected
253+ case haltedOnRootEmptied
254+ case haltedOnRootDeletion
255+ case haltedOnRootTypeChange
256+ case waitingForRescan
257+
258+ var name : String {
259+ switch self {
260+ case . disconnected:
261+ return " Disconnected "
262+ case . haltedOnRootEmptied:
263+ return " Halted on root emptied "
264+ case . haltedOnRootDeletion:
265+ return " Halted on root deletion "
266+ case . haltedOnRootTypeChange:
267+ return " Halted on root type change "
268+ case . waitingForRescan:
269+ return " Waiting for rescan "
270+ }
271+ }
272+
273+ var description : String {
274+ switch self {
275+ case . disconnected:
276+ return " The session is unpaused but not currently connected or connecting to either endpoint. "
277+ case . haltedOnRootEmptied:
278+ return " The session is halted due to the root emptying safety check. "
279+ case . haltedOnRootDeletion:
280+ return " The session is halted due to the root deletion safety check. "
281+ case . haltedOnRootTypeChange:
282+ return " The session is halted due to the root type change safety check. "
283+ case . waitingForRescan:
284+ return " The session is waiting to retry scanning after an error during the previous scan. "
285+ }
286+ }
287+ }
288+
198289public enum FileSyncEndpoint {
199290 case local
200291 case remote
0 commit comments