From 9342d513b507203a2947170ab5c8123ea4326358 Mon Sep 17 00:00:00 2001 From: daniele-verducci Date: Mon, 31 Aug 2026 17:14:43 +0200 Subject: [PATCH 1/2] Fix media view not being refreshed when selecting a different media folder Signed-off-by: daniele-verducci --- .../com/owncloud/android/ui/asynctasks/GallerySearchTask.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/owncloud/android/ui/asynctasks/GallerySearchTask.kt b/app/src/main/java/com/owncloud/android/ui/asynctasks/GallerySearchTask.kt index d43085d6ac99..ee06406ca35f 100644 --- a/app/src/main/java/com/owncloud/android/ui/asynctasks/GallerySearchTask.kt +++ b/app/src/main/java/com/owncloud/android/ui/asynctasks/GallerySearchTask.kt @@ -89,7 +89,8 @@ class GallerySearchTask( private fun handleSuccess(operationResult: RemoteOperationResult<*>): Result { val remoteFiles = operationResult.data.filterIsInstance() val lastTimestamp = findLastTimestamp(remoteFiles) - val emptySearch = parseMedia(lastTimestamp, endDate, remoteFiles) + parseMedia(lastTimestamp, endDate, remoteFiles) + val emptySearch = remoteFiles.isEmpty() return Result(operationResult.code, emptySearch, lastTimestamp) } From 89ae720bd59e69c10909f7eef67330dbd39fc169 Mon Sep 17 00:00:00 2001 From: daniele-verducci Date: Tue, 1 Sep 2026 11:53:45 +0200 Subject: [PATCH 2/2] Documented unclear function Signed-off-by: daniele-verducci --- .../android/ui/asynctasks/GallerySearchTask.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/ui/asynctasks/GallerySearchTask.kt b/app/src/main/java/com/owncloud/android/ui/asynctasks/GallerySearchTask.kt index ee06406ca35f..0c90fb707e5b 100644 --- a/app/src/main/java/com/owncloud/android/ui/asynctasks/GallerySearchTask.kt +++ b/app/src/main/java/com/owncloud/android/ui/asynctasks/GallerySearchTask.kt @@ -97,7 +97,16 @@ class GallerySearchTask( private fun findLastTimestamp(remoteFiles: List): Long = remoteFiles.lastOrNull()?.modifiedTimestamp?.div(MILLIS_PER_SECOND) ?: NO_TIMESTAMP - private fun parseMedia(startDate: Long, endDate: Long, remoteFiles: List): Boolean { + /** + * Sync local media files with theirs remote counterparts for the provided timespan (downloads missing, + * deletes removed ones, updates metadata). + * + * @param startDate start of timespan + * @param endDate end of timespan + * @param remoteFiles list of remote files in the folder. Only ones in the provided timespan are taken into + * consideration. + */ + private fun parseMedia(startDate: Long, endDate: Long, remoteFiles: List) { val localFiles = storageManager.getGalleryItems(startDate * MILLIS_PER_SECOND, endDate * MILLIS_PER_SECOND) if (BuildConfig.DEBUG) { @@ -150,8 +159,6 @@ class GallerySearchTask( " deleted: $filesDeleted unchanged: $unchangedFiles" ) } - - return filesAdded <= 0 && filesUpdated <= 0 && filesDeleted <= 0 } private fun enrichFromLocalStorage(file: RemoteFile) {