mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-02-16 20:10:37 +01:00
delete favorites at deleting media
This commit is contained in:
parent
3ca8e685b8
commit
e578036a22
@ -674,6 +674,8 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag
|
||||
try {
|
||||
if (mediaToDelete.isNotEmpty()) {
|
||||
mediaDB.deleteMedia(*mediaToDelete.toTypedArray())
|
||||
val favorites = mediaToDelete.map { getFavoriteFromPath(it.path) }
|
||||
favoritesDB.deleteFavorites(*favorites.toTypedArray())
|
||||
}
|
||||
} catch (ignored: Exception) {
|
||||
}
|
||||
|
@ -1,9 +1,6 @@
|
||||
package com.simplemobiletools.gallery.pro.interfaces
|
||||
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Insert
|
||||
import androidx.room.OnConflictStrategy
|
||||
import androidx.room.Query
|
||||
import androidx.room.*
|
||||
import com.simplemobiletools.gallery.pro.models.Favorite
|
||||
|
||||
@Dao
|
||||
@ -23,6 +20,9 @@ interface FavoritesDao {
|
||||
@Query("SELECT id FROM favorites WHERE full_path = :path COLLATE NOCASE")
|
||||
fun isFavorite(path: String): Boolean
|
||||
|
||||
@Delete
|
||||
fun deleteFavorites(vararg favorite: Favorite)
|
||||
|
||||
@Query("DELETE FROM favorites WHERE full_path = :path COLLATE NOCASE")
|
||||
fun deleteFavoritePath(path: String)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user