File tree Expand file tree Collapse file tree
app/src/main/java/com/github/libretube/db Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,12 @@ import kotlinx.coroutines.withContext
1515object DatabaseHelper {
1616 private const val MAX_SEARCH_HISTORY_SIZE = 20
1717
18+ // can only mark as watched if less than 60s remaining
19+ private const val ABSOLUTE_WATCHED_THRESHOLD = 60.0f
20+
21+ // can only mark as watched if at least 75% watched
22+ private const val RELATIVE_WATCHED_THRESHOLD = 0.75f
23+
1824 suspend fun addToWatchHistory (watchHistoryItem : WatchHistoryItem ) =
1925 withContext(Dispatchers .IO ) {
2026 Database .watchHistoryDao().insert(watchHistoryItem)
@@ -79,8 +85,8 @@ object DatabaseHelper {
7985 if (durationSeconds == null ) return false
8086
8187 val progress = positionMillis / 1000
82- // show video only in feed when watched less than 90%
83- return progress > 0.9f * durationSeconds
88+
89+ return durationSeconds - progress <= ABSOLUTE_WATCHED_THRESHOLD && progress >= RELATIVE_WATCHED_THRESHOLD * durationSeconds
8490 }
8591
8692 suspend fun filterUnwatched (streams : List <StreamItem >): List <StreamItem > {
You can’t perform that action at this time.
0 commit comments