Only update necessary sub-dirs

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-08-30 09:07:54 +02:00
parent c74818464e
commit 6af4c3c397
No known key found for this signature in database
GPG key ID: 4E577DC593B59BDF
4 changed files with 8 additions and 5 deletions

View file

@ -115,7 +115,7 @@ class OfflineOperationsWorker(
Log_OC.d(TAG, "$logMessage path: ${operation.path}, type: ${operation.type}")
if (result.isSuccess) {
repository.updateNextOperations()
repository.updateNextOperations(operation)
fileDataStorageManager.offlineOperationDao.delete(operation)
notificationManager.update(operations.size, currentOperationIndex, operation.filename ?: "")
} else {

View file

@ -61,8 +61,11 @@ class OfflineOperationsRepository(
fileDataStorageManager.removeFile(file, true, true)
}
override fun updateNextOperations() {
dao.getAll()
override fun updateNextOperations(operation: OfflineOperationEntity) {
val ocFile = fileDataStorageManager.getFileByDecryptedRemotePath(operation.path)
val fileId = ocFile?.fileId ?: return
getAllSubdirectories(fileId)
.mapNotNull { nextOperation ->
nextOperation.parentOCFileId?.let { parentId ->
fileDataStorageManager.getFileById(parentId)?.let { ocFile ->

View file

@ -13,5 +13,5 @@ import com.owncloud.android.datamodel.OCFile
interface OfflineOperationsRepositoryType {
fun getAllSubdirectories(fileId: Long): List<OfflineOperationEntity>
fun deleteOperation(file: OCFile)
fun updateNextOperations()
fun updateNextOperations(operation: OfflineOperationEntity)
}

View file

@ -203,7 +203,7 @@ public class FileDataStorageManager {
String newFolderName = oldFileName + " - " + currentDateTime;
String newPath = parentFolder.getDecryptedRemotePath() + newFolderName + OCFile.PATH_SEPARATOR;
moveLocalFile(file, newPath, parentFolder.getDecryptedRemotePath());
offlineOperationsRepository.updateNextOperations();
offlineOperationsRepository.updateNextOperations(entity);
}
private @Nullable