fix unselecting invalid favorite items
This commit is contained in:
parent
4d7e95d72a
commit
86db0b8f19
|
@ -674,8 +674,10 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag
|
||||||
try {
|
try {
|
||||||
if (mediaToDelete.isNotEmpty()) {
|
if (mediaToDelete.isNotEmpty()) {
|
||||||
mediaDB.deleteMedia(*mediaToDelete.toTypedArray())
|
mediaDB.deleteMedia(*mediaToDelete.toTypedArray())
|
||||||
val favorites = mediaToDelete.map { getFavoriteFromPath(it.path) }
|
|
||||||
favoritesDB.deleteFavorites(*favorites.toTypedArray())
|
mediaToDelete.filter { it.isFavorite }.forEach {
|
||||||
|
favoritesDB.deleteFavoritePath(it.path)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (ignored: Exception) {
|
} catch (ignored: Exception) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,6 @@ interface FavoritesDao {
|
||||||
@Query("UPDATE OR REPLACE favorites SET filename = :newFilename, full_path = :newFullPath, parent_path = :newParentPath WHERE full_path = :oldPath COLLATE NOCASE")
|
@Query("UPDATE OR REPLACE favorites SET filename = :newFilename, full_path = :newFullPath, parent_path = :newParentPath WHERE full_path = :oldPath COLLATE NOCASE")
|
||||||
fun updateFavorite(newFilename: String, newFullPath: String, newParentPath: String, oldPath: String)
|
fun updateFavorite(newFilename: String, newFullPath: String, newParentPath: String, oldPath: String)
|
||||||
|
|
||||||
@Delete
|
|
||||||
fun deleteFavorites(vararg favorite: Favorite)
|
|
||||||
|
|
||||||
@Query("DELETE FROM favorites WHERE full_path = :path COLLATE NOCASE")
|
@Query("DELETE FROM favorites WHERE full_path = :path COLLATE NOCASE")
|
||||||
fun deleteFavoritePath(path: String)
|
fun deleteFavoritePath(path: String)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue