Merge pull request #7320 from FineFindus/fix/update-last-watchtime

fix(Feed): only update `LastFeedWatchedTime` when update time is newer
This commit is contained in:
FineFindus 2025-04-21 20:20:56 +02:00 committed by GitHub
commit 805d1f28c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -104,8 +104,12 @@ object PreferenceHelper {
return getString(PreferenceKeys.LAST_STREAM_VIDEO_ID, "")
}
fun setLastFeedWatchedTime(time: Long) {
putLong(PreferenceKeys.LAST_WATCHED_FEED_TIME, time)
fun updateLastFeedWatchedTime(time: Long) {
// only update the time if the time is newer
// this avoids cases, where the user last saw an older video, which had already been seen,
// causing all following video to be incorrectly marked as unseen again
if (getLastCheckedFeedTime() < time)
putLong(PreferenceKeys.LAST_WATCHED_FEED_TIME, time)
}
fun getLastCheckedFeedTime(): Long {

View File

@ -398,7 +398,7 @@ class SubscriptionsFragment : DynamicLayoutManagerFragment(R.layout.fragment_sub
binding.toggleSubs.text = getString(R.string.subscriptions)
feed.firstOrNull { !it.isUpcoming }?.uploaded?.let {
PreferenceHelper.setLastFeedWatchedTime(it)
PreferenceHelper.updateLastFeedWatchedTime(it)
}
binding.subRefresh.isRefreshing = false