Skip to content

Commit

Permalink
Only update necessary sub-dirs
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <alper_ozturk@proton.me>
  • Loading branch information
alperozturk96 committed Aug 30, 2024
1 parent 8bd9e90 commit 2fae93f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void keepOfflineOperationAndServerFile(OfflineOperationEntity entity, OCF
String newFolderName = oldFileName + " - " + currentDateTime;
String newPath = parentFolder.getDecryptedRemotePath() + newFolderName + OCFile.PATH_SEPARATOR;
moveLocalFile(file, newPath, parentFolder.getDecryptedRemotePath());
offlineOperationsRepository.updateNextOperations();
offlineOperationsRepository.updateNextOperations(entity);
}

private @Nullable
Expand Down

0 comments on commit 2fae93f

Please sign in to comment.