Fix wrong history deleted because of different thread

This commit is contained in:
Krunal Patel 2022-11-28 20:12:00 +05:30
parent 641f2a9c10
commit f76da90447

View File

@ -21,8 +21,9 @@ class WatchHistoryAdapter(
RecyclerView.Adapter<WatchHistoryViewHolder>() { RecyclerView.Adapter<WatchHistoryViewHolder>() {
fun removeFromWatchHistory(position: Int) { fun removeFromWatchHistory(position: Int) {
val history = watchHistory[position]
query { query {
DatabaseHolder.Database.watchHistoryDao().delete(watchHistory[position]) DatabaseHolder.Database.watchHistoryDao().delete(history)
} }
watchHistory.removeAt(position) watchHistory.removeAt(position)
notifyItemRemoved(position) notifyItemRemoved(position)