From adc4b86421cd647e53d65cfa9fd428cd870604b3 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Tue, 7 Jan 2025 14:46:35 +0100 Subject: [PATCH] add getFileNameBasedOnEncryptionStatus Signed-off-by: alperozturk --- .../android/datamodel/FileDataStorageManager.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java b/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java index 8df5366f51cd..ac14c91c8cd2 100644 --- a/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java +++ b/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java @@ -240,6 +240,19 @@ public void addRenameFileOfflineOperation(OCFile file, String newName) { offlineOperationDao.insert(entity); } + public String getFileNameBasedOnEncryptionStatus(OCFile file) { + FileEntity entity = fileDao.getFileById(file.getFileId()); + if (entity == null) { + return file.getFileName(); + } + + if (file.isEncrypted()) { + return entity.getEncryptedName(); + } else { + return entity.getName(); + } + } + public String getFilenameConsideringOfflineOperation(OCFile file) { String filename = file.getDecryptedFileName(); OfflineOperationEntity renameEntity = offlineOperationDao.getByPath(file.getDecryptedRemotePath());