mirror of
https://github.com/nextcloud/android.git
synced 2024-11-25 22:55:46 +03:00
deleteSubDirIfParentPathMatches
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
a83ab214ce
commit
03ea98c3e0
2 changed files with 11 additions and 0 deletions
|
@ -12,6 +12,16 @@ import com.nextcloud.client.database.entity.OfflineOperationEntity
|
|||
|
||||
private const val DELIMITER = '/'
|
||||
|
||||
fun OfflineOperationDao.deleteSubDirIfParentPathMatches(path: String) {
|
||||
val topDir = path.getParentPathFromPath()
|
||||
getAll().forEach {
|
||||
val entityTopDir = it.getParentPathFromPath()
|
||||
if (entityTopDir == topDir) {
|
||||
delete(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun OfflineOperationDao.updatePathsIfParentPathMatches(oldPath: String?, newTopDir: String?, parentPath: String?) {
|
||||
if (oldPath.isNullOrEmpty() || newTopDir.isNullOrEmpty()) return
|
||||
|
||||
|
|
|
@ -156,6 +156,7 @@ public class FileDataStorageManager {
|
|||
}
|
||||
|
||||
public void deleteOfflineOperation(OCFile file) {
|
||||
OfflineOperationExtensionsKt.deleteSubDirIfParentPathMatches(offlineOperationDao, file.getDecryptedRemotePath());
|
||||
offlineOperationDao.deleteByPath(file.getDecryptedRemotePath());
|
||||
removeFile(file, true, true);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue