@@ -48,7 +48,7 @@ public struct FileSyncSession: Identifiable {
48
48
}
49
49
if case . error = status { } else {
50
50
if state. conflicts. count > 0 {
51
- status = . needsAttention ( name : " Conflicts " , desc : " The session has conflicts that need to be resolved " )
51
+ status = . conflicts
52
52
}
53
53
}
54
54
self . status = status
@@ -133,11 +133,11 @@ public struct FileSyncSessionEndpointSize: Equatable {
133
133
134
134
public enum FileSyncStatus {
135
135
case unknown
136
- case error( name : String , desc : String )
136
+ case error( FileSyncErrorStatus )
137
137
case ok
138
138
case paused
139
- case needsAttention ( name : String , desc : String )
140
- case working( name : String , desc : String )
139
+ case conflicts
140
+ case working( FileSyncWorkingStatus )
141
141
142
142
public var color : Color {
143
143
switch self {
@@ -149,7 +149,7 @@ public enum FileSyncStatus {
149
149
. red
150
150
case . error:
151
151
. red
152
- case . needsAttention :
152
+ case . conflicts :
153
153
. orange
154
154
case . working:
155
155
. purple
@@ -160,33 +160,33 @@ public enum FileSyncStatus {
160
160
switch self {
161
161
case . unknown:
162
162
" Unknown "
163
- case let . error( name , _ ) :
164
- " \( name) "
163
+ case let . error( status ) :
164
+ status . name
165
165
case . ok:
166
166
" Watching "
167
167
case . paused:
168
168
" 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
173
173
}
174
174
}
175
175
176
176
public var description : String {
177
177
switch self {
178
178
case . unknown:
179
179
" Unknown status message. "
180
- case let . error( _ , desc ) :
181
- desc
180
+ case let . error( status ) :
181
+ status . description
182
182
case . ok:
183
183
" The session is watching for filesystem changes. "
184
184
case . paused:
185
185
" 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
190
190
}
191
191
}
192
192
@@ -195,6 +195,97 @@ public enum FileSyncStatus {
195
195
}
196
196
}
197
197
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
+
198
289
public enum FileSyncEndpoint {
199
290
case local
200
291
case remote
0 commit comments