Skip to content

Commit c399fd9

Browse files
committed
Move latestEntry into SearchHustoryDao directly
The StreamHistoryDao one isn't used, so remove it and streamline the logic Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
1 parent 21e111d commit c399fd9

3 files changed

Lines changed: 5 additions & 19 deletions

File tree

app/src/main/java/org/schabi/newpipe/database/history/dao/HistoryDAO.kt

Lines changed: 0 additions & 13 deletions
This file was deleted.

app/src/main/java/org/schabi/newpipe/database/history/dao/SearchHistoryDAO.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ package org.schabi.newpipe.database.history.dao
99
import androidx.room.Dao
1010
import androidx.room.Query
1111
import io.reactivex.rxjava3.core.Flowable
12+
import org.schabi.newpipe.database.BasicDAO
1213
import org.schabi.newpipe.database.history.model.SearchHistoryEntry
1314

1415
@Dao
15-
interface SearchHistoryDAO : HistoryDAO<SearchHistoryEntry> {
16+
interface SearchHistoryDAO : BasicDAO<SearchHistoryEntry> {
1617

1718
@get:Query("SELECT * FROM search_history WHERE id = (SELECT MAX(id) FROM search_history)")
18-
override val latestEntry: SearchHistoryEntry?
19+
val latestEntry: SearchHistoryEntry?
1920

2021
@Query("DELETE FROM search_history")
2122
override fun deleteAll(): Int

app/src/main/java/org/schabi/newpipe/database/history/dao/StreamHistoryDAO.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ import androidx.room.Dao
1010
import androidx.room.Query
1111
import androidx.room.RewriteQueriesToDropUnusedColumns
1212
import io.reactivex.rxjava3.core.Flowable
13+
import org.schabi.newpipe.database.BasicDAO
1314
import org.schabi.newpipe.database.history.model.StreamHistoryEntity
1415
import org.schabi.newpipe.database.history.model.StreamHistoryEntry
1516
import org.schabi.newpipe.database.stream.StreamStatisticsEntry
1617

1718
@Dao
18-
abstract class StreamHistoryDAO : HistoryDAO<StreamHistoryEntity> {
19-
20-
@get:Query("SELECT * FROM stream_history WHERE access_date = (SELECT MAX(access_date) FROM stream_history)")
21-
abstract override val latestEntry: StreamHistoryEntity
19+
abstract class StreamHistoryDAO : BasicDAO<StreamHistoryEntity> {
2220

2321
@Query("SELECT * FROM stream_history")
2422
abstract override fun getAll(): Flowable<List<StreamHistoryEntity>>

0 commit comments

Comments
 (0)