Skip to content

Commit a3a846c

Browse files
committed
refactor: modify the logic from the filter in which the files to upload are selected
1 parent 5c9f0d0 commit a3a846c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

owncloudApp/src/main/java/com/owncloud/android/workers/AutomaticUploadsWorker.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
*
44
* @author Abel García de Prada
55
* @author Juan Carlos Garrote Gascón
6+
* @author Jorge Aguado Recio
67
*
7-
* Copyright (C) 2022 ownCloud GmbH.
8+
* Copyright (C) 2025 ownCloud GmbH.
89
* <p>
910
* This program is free software: you can redistribute it and/or modify
1011
* it under the terms of the GNU General Public License version 2,
@@ -246,10 +247,13 @@ class AutomaticUploadsWorker(
246247
val arrayOfLocalFiles = documentTree?.listFiles() ?: arrayOf()
247248

248249
val filteredList: List<DocumentFile> = arrayOfLocalFiles
250+
.asSequence()
251+
.filter {
252+
it.lastModified() in lastSyncTimestamp..<currentTimestamp &&
253+
MimetypeIconUtil.getBestMimeTypeByFilename(it.name).startsWith(syncType.prefixForType)
254+
}
249255
.sortedBy { it.lastModified() }
250-
.filter { it.lastModified() >= lastSyncTimestamp }
251-
.filter { it.lastModified() < currentTimestamp }
252-
.filter { MimetypeIconUtil.getBestMimeTypeByFilename(it.name).startsWith(syncType.prefixForType) }
256+
.toList()
253257

254258
Timber.i("Last sync ${syncType.name}: ${Date(lastSyncTimestamp)}")
255259
Timber.i("CurrentTimestamp ${Date(currentTimestamp)}")

0 commit comments

Comments
 (0)