Skip to content

Commit daf8745

Browse files
committed
Merge branch 'worktree-workspaces'
# Conflicts: # app-common-io/src/test/java/eu/darken/butler/common/files/operations/GenericPathDeleteTest.kt
2 parents 1dcbdbc + 5acd5a6 commit daf8745

47 files changed

Lines changed: 1923 additions & 1922 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app-common-io/src/main/java/eu/darken/butler/common/files/GatewaySwitch.kt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,11 @@ class GatewaySwitch @Inject constructor(
269269
copy(sourcesGroup.toSet(), destination, onIssue, options)
270270
}.collect { state ->
271271
when (state) {
272-
is CopyAction.State.Progress -> {
272+
is CopyAction.State.Active -> {
273273
emit(state.copy(copiedBytes = totalBytesProcessed + state.copiedBytes))
274274
}
275275

276-
is CopyAction.State.Result -> {
276+
is CopyAction.State.Completed -> {
277277
totalBytesProcessed += state.copiedBytes
278278
allCopiedFiles.addAll(state.copied)
279279
allSkippedFiles.addAll(state.skipped)
@@ -285,12 +285,12 @@ class GatewaySwitch @Inject constructor(
285285
else -> {
286286
performCrossGatewayCopy(sourcesGroup, destination, onIssue, options).collect { state ->
287287
when (state) {
288-
is CopyAction.State.Progress -> {
288+
is CopyAction.State.Active -> {
289289
@Suppress("UNCHECKED_CAST")
290-
emit(state.copy(copiedBytes = totalBytesProcessed + state.copiedBytes) as CopyAction.State.Progress<APath<*>, APathLookup<APath<*>>, APath<*>, APathLookup<APath<*>>>)
290+
emit(state.copy(copiedBytes = totalBytesProcessed + state.copiedBytes) as CopyAction.State.Active<APath<*>, APathLookup<APath<*>>, APath<*>, APathLookup<APath<*>>>)
291291
}
292292

293-
is CopyAction.State.Result -> {
293+
is CopyAction.State.Completed -> {
294294
totalBytesProcessed += state.copiedBytes
295295
@Suppress("UNCHECKED_CAST")
296296
allCopiedFiles.addAll(state.copied as Collection<Pair<APathLookup<APath<*>>, APathLookup<APath<*>>>>)
@@ -304,7 +304,7 @@ class GatewaySwitch @Inject constructor(
304304
}
305305

306306
emit(
307-
CopyAction.State.Result(
307+
CopyAction.State.Completed(
308308
copied = allCopiedFiles,
309309
skipped = allSkippedFiles,
310310
copiedBytes = totalBytesProcessed
@@ -334,12 +334,12 @@ class GatewaySwitch @Inject constructor(
334334
move(sourcesGroup.toSet(), destination, onIssue, options)
335335
}.collect { state ->
336336
when (state) {
337-
is MoveAction.State.Progress<*, *, *, *> -> {
337+
is MoveAction.State.Active<*, *, *, *> -> {
338338
@Suppress("UNCHECKED_CAST")
339-
emit(state.copy(movedBytes = totalBytesMoved + state.movedBytes) as MoveAction.State.Progress<APath<*>, APathLookup<APath<*>>, APath<*>, APathLookup<APath<*>>>)
339+
emit(state.copy(movedBytes = totalBytesMoved + state.movedBytes) as MoveAction.State.Active<APath<*>, APathLookup<APath<*>>, APath<*>, APathLookup<APath<*>>>)
340340
}
341341

342-
is MoveAction.State.Result -> {
342+
is MoveAction.State.Completed -> {
343343
totalBytesMoved += state.bytesMoved
344344
allMovedFiles.addAll(state.movedFiles)
345345
allSkippedFiles.addAll(state.skippedFiles)
@@ -351,12 +351,12 @@ class GatewaySwitch @Inject constructor(
351351
else -> {
352352
performCrossGatewayMove(sourcesGroup, destination, onIssue, options).collect { state ->
353353
when (state) {
354-
is MoveAction.State.Progress<*, *, *, *> -> {
354+
is MoveAction.State.Active<*, *, *, *> -> {
355355
@Suppress("UNCHECKED_CAST")
356-
emit(state.copy(movedBytes = totalBytesMoved + state.movedBytes) as MoveAction.State.Progress<APath<*>, APathLookup<APath<*>>, APath<*>, APathLookup<APath<*>>>)
356+
emit(state.copy(movedBytes = totalBytesMoved + state.movedBytes) as MoveAction.State.Active<APath<*>, APathLookup<APath<*>>, APath<*>, APathLookup<APath<*>>>)
357357
}
358358

359-
is MoveAction.State.Result -> {
359+
is MoveAction.State.Completed -> {
360360
totalBytesMoved += state.bytesMoved
361361
@Suppress("UNCHECKED_CAST")
362362
allMovedFiles.addAll(state.movedFiles as Collection<Pair<APathLookup<APath<*>>, APathLookup<APath<*>>>>)
@@ -370,7 +370,7 @@ class GatewaySwitch @Inject constructor(
370370
}
371371

372372
emit(
373-
MoveAction.State.Result(
373+
MoveAction.State.Completed(
374374
movedFiles = allMovedFiles,
375375
skippedFiles = allSkippedFiles,
376376
bytesMoved = totalBytesMoved

app-common-io/src/main/java/eu/darken/butler/common/files/actions/CopyAction.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package eu.darken.butler.common.files.actions
22

33
import eu.darken.butler.common.files.APath
44
import eu.darken.butler.common.files.APathLookup
5+
import eu.darken.butler.common.progress.Progress
56
import kotlinx.coroutines.flow.Flow
67
import kotlin.time.Instant
78

@@ -26,22 +27,22 @@ interface CopyAction<
2627
SP : APath<SP>, SPL : APathLookup<SP>, // Source types
2728
DP : APath<DP>, DPL : APathLookup<DP>, // Destination types
2829
> {
29-
data class Progress<
30+
data class Active<
3031
SP : APath<SP>, SPL : APathLookup<SP>, // Source types
3132
DP : APath<DP>, DPL : APathLookup<DP>, // Destination types
3233
>(
3334
val currentSource: SPL,
3435
val currentDestination: DP?,
35-
val primaryProgress: eu.darken.butler.common.progress.Progress.Data,
36-
val secondaryProgress: eu.darken.butler.common.progress.Progress.Data? = null,
36+
val primaryProgress: Progress.Data,
37+
val secondaryProgress: Progress.Data? = null,
3738
val copiedBytes: Long = 0L,
3839
val totalBytes: Long = 0L,
3940
val currentFileSize: Long = 0L,
4041
val currentFileBytes: Long = 0L,
4142
val currentFileStartTime: Instant? = null,
4243
) : State<SP, SPL, DP, DPL>
4344

44-
data class Result<
45+
data class Completed<
4546
SP : APath<SP>, SPL : APathLookup<SP>, // Source types
4647
DP : APath<DP>, DPL : APathLookup<DP>, // Destination types
4748
>(

app-common-io/src/main/java/eu/darken/butler/common/files/actions/DeleteAction.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package eu.darken.butler.common.files.actions
22

33
import eu.darken.butler.common.files.APath
44
import eu.darken.butler.common.files.APathLookup
5+
import eu.darken.butler.common.progress.Progress
56
import kotlinx.coroutines.flow.Flow
67

78

@@ -18,16 +19,16 @@ interface DeleteAction<P : APath<P>, PL : APathLookup<P>> {
1819
)
1920

2021
sealed interface State<out P, out PL> {
21-
data class Progress<out P, out PL>(
22+
data class Active<out P, out PL>(
2223
val target: PL,
23-
val primaryProgress: eu.darken.butler.common.progress.Progress.Data,
24-
val secondaryProgress: eu.darken.butler.common.progress.Progress.Data? = null,
24+
val primaryProgress: Progress.Data,
25+
val secondaryProgress: Progress.Data? = null,
2526
val deletedBytes: Long = 0L,
2627
val totalBytes: Long = 0L,
2728
val currentItemStartTime: kotlin.time.Instant? = null,
2829
) : State<P, PL>
2930

30-
data class Result<out P, out PL>(
31+
data class Completed<out P, out PL>(
3132
val deleted: Set<PL>,
3233
val skipped: Set<PL>,
3334
) : State<P, PL> {

app-common-io/src/main/java/eu/darken/butler/common/files/actions/MoveAction.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package eu.darken.butler.common.files.actions
22

33
import eu.darken.butler.common.files.APath
44
import eu.darken.butler.common.files.APathLookup
5+
import eu.darken.butler.common.progress.Progress
56
import kotlinx.coroutines.flow.Flow
67
import kotlin.time.Instant
78

@@ -25,22 +26,22 @@ interface MoveAction<
2526
SP : APath<SP>, SPL : APathLookup<SP>, // Source types
2627
DP : APath<DP>, DPL : APathLookup<DP>, // Destination types
2728
> {
28-
data class Progress<
29+
data class Active<
2930
SP : APath<SP>, SPL : APathLookup<SP>, // Source types
3031
DP : APath<DP>, DPL : APathLookup<DP>, // Destination types
3132
>(
3233
val currentSource: SPL,
3334
val currentDestination: DP?,
34-
val primaryProgress: eu.darken.butler.common.progress.Progress.Data,
35-
val secondaryProgress: eu.darken.butler.common.progress.Progress.Data? = null,
35+
val primaryProgress: Progress.Data,
36+
val secondaryProgress: Progress.Data? = null,
3637
val movedBytes: Long = 0L,
3738
val totalBytes: Long = 0L,
3839
val currentFileSize: Long = 0L,
3940
val currentFileBytes: Long = 0L,
4041
val currentFileStartTime: Instant? = null,
4142
) : State<SP, SPL, DP, DPL>
4243

43-
data class Result<
44+
data class Completed<
4445
SP : APath<SP>, SPL : APathLookup<SP>, // Source types
4546
DP : APath<DP>, DPL : APathLookup<DP>, // Destination types
4647
>(

app-common-io/src/main/java/eu/darken/butler/common/files/local/LocalGateway.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ class LocalGateway @Inject constructor(
612612
onIssue = options.onIssue,
613613
).collect { state ->
614614
emit(state)
615-
if (state is DeleteAction.State.Result) {
615+
if (state is DeleteAction.State.Completed) {
616616
log(TAG, INFO) { "delete(): Finished, deleted ${state.deleted.size} items" }
617617
}
618618
}
@@ -645,7 +645,7 @@ class LocalGateway @Inject constructor(
645645
onIssue = options.onIssue,
646646
).collect { state ->
647647
emit(state)
648-
if (state is DeleteAction.State.Result) {
648+
if (state is DeleteAction.State.Completed) {
649649
log(TAG, INFO) { "delete(): Finished, deleted ${state.deleted.size} items" }
650650
}
651651
}
@@ -691,7 +691,7 @@ class LocalGateway @Inject constructor(
691691
onIssue = onIssue,
692692
).collect { state ->
693693
emit(state)
694-
if (state is CopyAction.State.Result<*, *, *, *>) {
694+
if (state is CopyAction.State.Completed<*, *, *, *>) {
695695
log(TAG, INFO) { "copy(): Finished, copied ${state.copied.size} items" }
696696
}
697697
}
@@ -723,7 +723,7 @@ class LocalGateway @Inject constructor(
723723
onIssue = onIssue,
724724
).collect { state ->
725725
emit(state)
726-
if (state is CopyAction.State.Result) {
726+
if (state is CopyAction.State.Completed) {
727727
log(TAG, INFO) { "copy(): Finished, copied ${state.copied.size} items" }
728728
}
729729
}
@@ -768,7 +768,7 @@ class LocalGateway @Inject constructor(
768768
onIssue = onIssue,
769769
).collect { state ->
770770
emit(state)
771-
if (state is MoveAction.State.Result<*, *, *, *>) {
771+
if (state is MoveAction.State.Completed<*, *, *, *>) {
772772
log(TAG, INFO) { "move(): Finished, moved ${state.movedFiles.size} items" }
773773
}
774774
}
@@ -800,7 +800,7 @@ class LocalGateway @Inject constructor(
800800
onIssue = onIssue,
801801
).collect { state ->
802802
emit(state)
803-
if (state is MoveAction.State.Result<*, *, *, *>) {
803+
if (state is MoveAction.State.Completed<*, *, *, *>) {
804804
log(TAG, INFO) { "move(): Finished, moved ${state.movedFiles.size} items" }
805805
}
806806
}

app-common-io/src/main/java/eu/darken/butler/common/files/local/LocalPathDelete.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ internal class LocalPathDelete(
108108
}
109109

110110
emit(
111-
DeleteAction.State.Result(
111+
DeleteAction.State.Completed(
112112
deleted = deleted,
113113
skipped = skipped,
114114
)
@@ -432,7 +432,7 @@ internal class LocalPathDelete(
432432
val snapshot = progressTracker.createSnapshot()
433433

434434
emit(
435-
DeleteAction.State.Progress(
435+
DeleteAction.State.Active(
436436
target = lookup,
437437
primaryProgress = eu.darken.butler.common.progress.Progress.Data(
438438
primary = R.string.general_scan_progress_title.toCaString(),
@@ -457,7 +457,7 @@ internal class LocalPathDelete(
457457
val snapshot = progressTracker.createSnapshot()
458458

459459
emit(
460-
DeleteAction.State.Progress(
460+
DeleteAction.State.Active(
461461
target = lookup,
462462
primaryProgress = eu.darken.butler.common.progress.Progress.Data(
463463
primary = R.string.general_delete_progress_title.toCaString(),

app-common-io/src/main/java/eu/darken/butler/common/files/local/ipc/CopyOperationEventConversion.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import eu.darken.butler.common.progress.Progress
1717
*/
1818
fun CopyAction.State<LocalPath, LocalPathLookup, LocalPath, LocalPathLookup>.toCopyOperationEvent(): CopyOperationEvent {
1919
return when (this) {
20-
is CopyAction.State.Progress -> {
20+
is CopyAction.State.Active -> {
2121
// Determine phase based on secondaryProgress presence
2222
if (secondaryProgress == null) {
2323
// Scan phase (no secondaryProgress)
@@ -41,7 +41,7 @@ fun CopyAction.State<LocalPath, LocalPathLookup, LocalPath, LocalPathLookup>.toC
4141
}
4242
}
4343

44-
is CopyAction.State.Result -> CopyOperationEvent.Result(
44+
is CopyAction.State.Completed -> CopyOperationEvent.Result(
4545
copiedItems = copied.map { (src, dst) -> PathPair(src.lookedUp, dst.lookedUp) },
4646
skippedItems = skipped.toList(),
4747
errorCount = 0, // Not tracked in domain Result
@@ -58,7 +58,7 @@ fun CopyOperationEvent.toCopyActionState(): CopyAction.State<LocalPath, LocalPat
5858
return when (this) {
5959
is CopyOperationEvent.ScanProgress -> {
6060
// Reconstruct scan progress state
61-
CopyAction.State.Progress(
61+
CopyAction.State.Active(
6262
currentSource = currentPath,
6363
currentDestination = null,
6464
primaryProgress = Progress.Data(
@@ -76,7 +76,7 @@ fun CopyOperationEvent.toCopyActionState(): CopyAction.State<LocalPath, LocalPat
7676

7777
is CopyOperationEvent.CopyProgress -> {
7878
// Reconstruct copy progress state
79-
CopyAction.State.Progress(
79+
CopyAction.State.Active(
8080
currentSource = currentSource,
8181
currentDestination = currentDestination,
8282
primaryProgress = Progress.Data(
@@ -106,7 +106,7 @@ fun CopyOperationEvent.toCopyActionState(): CopyAction.State<LocalPath, LocalPat
106106
// Note: Client side receives paths in PathPair but domain expects lookups.
107107
// We convert to minimal lookups using just the path information.
108108
// Full metadata is not available on client side post-operation.
109-
CopyAction.State.Result(
109+
CopyAction.State.Completed(
110110
copied = copiedItems.map { pair ->
111111
// Create minimal lookups from paths (client doesn't have full metadata)
112112
val srcLookup = LocalPathLookup(

app-common-io/src/main/java/eu/darken/butler/common/files/local/ipc/DeleteOperationEventConversion.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import eu.darken.butler.common.progress.Progress
1717
*/
1818
fun DeleteAction.State<LocalPath, LocalPathLookup>.toDeleteOperationEvent(): DeleteOperationEvent {
1919
return when (this) {
20-
is DeleteAction.State.Progress -> {
20+
is DeleteAction.State.Active -> {
2121
// Determine phase based on secondaryProgress presence
2222
if (secondaryProgress == null) {
2323
// Scan phase (no secondaryProgress)
@@ -37,7 +37,7 @@ fun DeleteAction.State<LocalPath, LocalPathLookup>.toDeleteOperationEvent(): Del
3737
}
3838
}
3939

40-
is DeleteAction.State.Result -> DeleteOperationEvent.Result(
40+
is DeleteAction.State.Completed -> DeleteOperationEvent.Result(
4141
deletedItems = deleted.toList(),
4242
skippedItems = skipped.toList(),
4343
errorCount = 0, // Not tracked in domain Result
@@ -53,7 +53,7 @@ fun DeleteOperationEvent.toDeleteActionState(): DeleteAction.State<LocalPath, Lo
5353
return when (this) {
5454
is DeleteOperationEvent.ScanProgress -> {
5555
// Reconstruct scan progress state
56-
DeleteAction.State.Progress(
56+
DeleteAction.State.Active(
5757
target = currentPath,
5858
primaryProgress = Progress.Data(
5959
primary = R.string.general_scan_progress_title.toCaString(),
@@ -72,7 +72,7 @@ fun DeleteOperationEvent.toDeleteActionState(): DeleteAction.State<LocalPath, Lo
7272

7373
is DeleteOperationEvent.DeleteProgress -> {
7474
// Reconstruct delete progress state
75-
DeleteAction.State.Progress(
75+
DeleteAction.State.Active(
7676
target = currentPath,
7777
primaryProgress = Progress.Data(
7878
primary = R.string.general_delete_progress_title.toCaString(),
@@ -97,7 +97,7 @@ fun DeleteOperationEvent.toDeleteActionState(): DeleteAction.State<LocalPath, Lo
9797

9898
is DeleteOperationEvent.Result -> {
9999
// Reconstruct result state
100-
DeleteAction.State.Result(
100+
DeleteAction.State.Completed(
101101
deleted = deletedItems.toSet(),
102102
skipped = skippedItems.toSet(),
103103
)

0 commit comments

Comments
 (0)