clone cached media/directories before sending them back to the app
This commit is contained in:
parent
713ba852c2
commit
ad07068475
1 changed files with 4 additions and 3 deletions
|
@ -293,9 +293,10 @@ fun Context.getCachedDirectories(getVideosOnly: Boolean = false, getImagesOnly:
|
|||
}
|
||||
}) as ArrayList<Directory>
|
||||
|
||||
callback(filteredDirectories.distinctBy { it.path.getDistinctPath() } as ArrayList<Directory>)
|
||||
val clone = filteredDirectories.clone() as ArrayList<Directory>
|
||||
callback(clone.distinctBy { it.path.getDistinctPath() } as ArrayList<Directory>)
|
||||
|
||||
removeInvalidDBDirectories(directories, directoryDao)
|
||||
removeInvalidDBDirectories(filteredDirectories, directoryDao)
|
||||
}.start()
|
||||
}
|
||||
|
||||
|
@ -326,7 +327,7 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag
|
|||
}) as ArrayList<Medium>
|
||||
|
||||
MediaFetcher(this).sortMedia(media, config.getFileSorting(path))
|
||||
callback(media)
|
||||
callback(media.clone() as ArrayList<Medium>)
|
||||
|
||||
media.filter { !getDoesFilePathExist(it.path) }.forEach {
|
||||
mediumDao.deleteMediumPath(it.path)
|
||||
|
|
Loading…
Reference in a new issue