Added clear history function to repositories

This commit is contained in:
Omar 2022-03-04 14:05:41 +02:00
parent 4562afd544
commit ddf801f9f3
2 changed files with 10 additions and 0 deletions

View file

@ -100,6 +100,7 @@ interface Repository {
suspend fun updateSongInPlayCount(playCountEntity: PlayCountEntity)
suspend fun deleteSongInPlayCount(playCountEntity: PlayCountEntity)
suspend fun deleteSongInHistory(songId: Long)
suspend fun clearSongHistory()
suspend fun checkSongExistInPlayCount(songId: Long): List<PlayCountEntity>
suspend fun playCountSongs(): List<PlayCountEntity>
suspend fun blackListPaths(): List<BlackListStoreEntity>
@ -330,6 +331,10 @@ class RealRepository(
override suspend fun deleteSongInHistory(songId: Long) =
roomRepository.deleteSongInHistory(songId)
override suspend fun clearSongHistory() {
roomRepository.clearSongHistory()
}
override suspend fun checkSongExistInPlayCount(songId: Long): List<PlayCountEntity> =
roomRepository.checkSongExistInPlayCount(songId)

View file

@ -39,6 +39,7 @@ interface RoomRepository {
suspend fun updateSongInPlayCount(playCountEntity: PlayCountEntity)
suspend fun deleteSongInPlayCount(playCountEntity: PlayCountEntity)
suspend fun deleteSongInHistory(songId: Long)
suspend fun clearSongHistory()
suspend fun checkSongExistInPlayCount(songId: Long): List<PlayCountEntity>
suspend fun playCountSongs(): List<PlayCountEntity>
suspend fun insertBlacklistPath(blackListStoreEntities: List<BlackListStoreEntity>)
@ -170,6 +171,10 @@ class RealRoomRepository(
historyDao.deleteSongInHistory(songId)
}
override suspend fun clearSongHistory() {
historyDao.clearHistory()
}
override suspend fun checkSongExistInPlayCount(songId: Long): List<PlayCountEntity> =
playCountDao.checkSongExistInPlayCount(songId)