mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 08:20:32 +05:30
Update WatchPositionDao's insertAll() method to accept a List.
This commit is contained in:
parent
c464fe05d5
commit
494f0f4efd
@ -15,7 +15,7 @@ interface WatchPositionDao {
|
|||||||
suspend fun findById(videoId: String): WatchPosition?
|
suspend fun findById(videoId: String): WatchPosition?
|
||||||
|
|
||||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
suspend fun insertAll(vararg watchPositions: WatchPosition)
|
suspend fun insertAll(watchPositions: List<WatchPosition>)
|
||||||
|
|
||||||
@Query("DELETE FROM watchPosition")
|
@Query("DELETE FROM watchPosition")
|
||||||
suspend fun deleteAll()
|
suspend fun deleteAll()
|
||||||
|
@ -48,9 +48,7 @@ object BackupHelper {
|
|||||||
|
|
||||||
Database.watchHistoryDao().insertAll(backupFile.watchHistory.orEmpty())
|
Database.watchHistoryDao().insertAll(backupFile.watchHistory.orEmpty())
|
||||||
Database.searchHistoryDao().insertAll(backupFile.searchHistory.orEmpty())
|
Database.searchHistoryDao().insertAll(backupFile.searchHistory.orEmpty())
|
||||||
Database.watchPositionDao().insertAll(
|
Database.watchPositionDao().insertAll(backupFile.watchPositions.orEmpty())
|
||||||
*backupFile.watchPositions.orEmpty().toTypedArray()
|
|
||||||
)
|
|
||||||
Database.localSubscriptionDao().insertAll(backupFile.localSubscriptions.orEmpty())
|
Database.localSubscriptionDao().insertAll(backupFile.localSubscriptions.orEmpty())
|
||||||
Database.customInstanceDao().insertAll(backupFile.customInstances.orEmpty())
|
Database.customInstanceDao().insertAll(backupFile.customInstances.orEmpty())
|
||||||
Database.playlistBookmarkDao().insertAll(
|
Database.playlistBookmarkDao().insertAll(
|
||||||
|
@ -155,7 +155,7 @@ class BackgroundMode : LifecycleService() {
|
|||||||
this.streams ?: return@let
|
this.streams ?: return@let
|
||||||
|
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
Database.watchPositionDao().insertAll(watchPosition)
|
Database.watchPositionDao().insertAll(listOf(watchPosition))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handler.postDelayed(this::updateWatchPosition, 500)
|
handler.postDelayed(this::updateWatchPosition, 500)
|
||||||
|
@ -609,7 +609,7 @@ class PlayerFragment : Fragment(R.layout.fragment_player), OnlinePlayerOptions {
|
|||||||
if (!PlayerHelper.watchPositionsVideo) return
|
if (!PlayerHelper.watchPositionsVideo) return
|
||||||
val watchPosition = WatchPosition(videoId!!, exoPlayer.currentPosition)
|
val watchPosition = WatchPosition(videoId!!, exoPlayer.currentPosition)
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
Database.watchPositionDao().insertAll(watchPosition)
|
Database.watchPositionDao().insertAll(listOf(watchPosition))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ class VideoOptionsBottomSheet(
|
|||||||
getString(R.string.mark_as_watched) -> {
|
getString(R.string.mark_as_watched) -> {
|
||||||
val watchPosition = WatchPosition(videoId, Long.MAX_VALUE)
|
val watchPosition = WatchPosition(videoId, Long.MAX_VALUE)
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
DatabaseHolder.Database.watchPositionDao().insertAll(watchPosition)
|
DatabaseHolder.Database.watchPositionDao().insertAll(listOf(watchPosition))
|
||||||
}
|
}
|
||||||
if (PreferenceHelper.getBoolean(PreferenceKeys.HIDE_WATCHED_FROM_FEED, false)) {
|
if (PreferenceHelper.getBoolean(PreferenceKeys.HIDE_WATCHED_FROM_FEED, false)) {
|
||||||
// get the host fragment containing the current fragment
|
// get the host fragment containing the current fragment
|
||||||
|
Loading…
x
Reference in New Issue
Block a user