Skip to content

Commit d3f0c20

Browse files
committed
simplify handleConflict method by removing unused parameter
1 parent 972aea1 commit d3f0c20

File tree

1 file changed

+9
-14
lines changed
  • app/src/main/java/com/raival/compose/file/explorer/screen/main/tab/files/task

1 file changed

+9
-14
lines changed

app/src/main/java/com/raival/compose/file/explorer/screen/main/tab/files/task/CopyTask.kt

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,7 @@ class CopyTask(
219219
}
220220
}
221221

222-
private fun handleConflict(item: TaskContentItem, existsAsFile: Boolean): Boolean {
223-
if (!existsAsFile) return true // No conflict for directories or non-existent files
224-
222+
private fun handleConflict(item: TaskContentItem): Boolean {
225223
return when (commonConflictResolution) {
226224
TaskContentStatus.SKIP -> {
227225
item.status = TaskContentStatus.SKIP
@@ -337,13 +335,13 @@ class CopyTask(
337335

338336
updateProgress(index, sourceFile.name)
339337

340-
if (item.status == TaskContentStatus.CONFLICT && !handleConflict(item, true)) {
338+
if (item.status == TaskContentStatus.CONFLICT && !handleConflict(item)) {
341339
return
342340
}
343341

344342
if (item.status == TaskContentStatus.PENDING) {
345343
val conflictExists = destinationFile.exists() && destinationFile.isFile
346-
if (conflictExists && !handleConflict(item, true)) {
344+
if (conflictExists && !handleConflict(item)) {
347345
return
348346
}
349347
}
@@ -433,7 +431,7 @@ class CopyTask(
433431

434432
updateProgress(index, item.content.displayName)
435433

436-
if (item.status == TaskContentStatus.CONFLICT && !handleConflict(item, true)) {
434+
if (item.status == TaskContentStatus.CONFLICT && !handleConflict(item)) {
437435
return
438436
}
439437

@@ -443,7 +441,7 @@ class CopyTask(
443441
if (item.status == TaskContentStatus.PENDING) {
444442
val existingHeader = targetZipFile.getFileHeader(targetPath)
445443
val conflictExists = existingHeader != null && !existingHeader.isDirectory
446-
if (conflictExists && !handleConflict(item, true)) {
444+
if (conflictExists && !handleConflict(item)) {
447445
return
448446
}
449447
}
@@ -528,13 +526,13 @@ class CopyTask(
528526

529527
updateProgress(index, sourceHolder.displayName)
530528

531-
if (item.status == TaskContentStatus.CONFLICT && !handleConflict(item, true)) {
529+
if (item.status == TaskContentStatus.CONFLICT && !handleConflict(item)) {
532530
return
533531
}
534532

535533
if (item.status == TaskContentStatus.PENDING) {
536534
val conflictExists = destinationFile.exists() && destinationFile.isFile
537-
if (conflictExists && !handleConflict(item, true)) {
535+
if (conflictExists && !handleConflict(item)) {
538536
return
539537
}
540538
}
@@ -616,10 +614,7 @@ class CopyTask(
616614

617615
updateProgress(index, item.content.displayName)
618616

619-
if (item.status == TaskContentStatus.CONFLICT && !handleConflict(
620-
item,
621-
true
622-
)
617+
if (item.status == TaskContentStatus.CONFLICT && !handleConflict(item)
623618
) {
624619
return
625620
}
@@ -631,7 +626,7 @@ class CopyTask(
631626
val existingHeader = destZip.getFileHeader(targetPath)
632627
val conflictExists =
633628
existingHeader != null && !existingHeader.isDirectory
634-
if (conflictExists && !handleConflict(item, true)) {
629+
if (conflictExists && !handleConflict(item)) {
635630
return
636631
}
637632
}

0 commit comments

Comments
 (0)