mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 15:30:31 +05:30
fix(Feed): only update LastFeedWatchedTime
when update time is newer
Fixes an issue, where if the user switches between channel group, already seen videos could be marked as new. This was caused by the channel group having only older videos, which resetted the last watched time to an older timepoint. To fix this, the last watched time is only updated, when the new watched time is newer than the previous watched time.
This commit is contained in:
parent
c0ead845b2
commit
8645bfce29
@ -104,8 +104,12 @@ object PreferenceHelper {
|
|||||||
return getString(PreferenceKeys.LAST_STREAM_VIDEO_ID, "")
|
return getString(PreferenceKeys.LAST_STREAM_VIDEO_ID, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setLastFeedWatchedTime(time: Long) {
|
fun updateLastFeedWatchedTime(time: Long) {
|
||||||
putLong(PreferenceKeys.LAST_WATCHED_FEED_TIME, time)
|
// 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 {
|
fun getLastCheckedFeedTime(): Long {
|
||||||
|
@ -398,7 +398,7 @@ class SubscriptionsFragment : DynamicLayoutManagerFragment(R.layout.fragment_sub
|
|||||||
binding.toggleSubs.text = getString(R.string.subscriptions)
|
binding.toggleSubs.text = getString(R.string.subscriptions)
|
||||||
|
|
||||||
feed.firstOrNull { !it.isUpcoming }?.uploaded?.let {
|
feed.firstOrNull { !it.isUpcoming }?.uploaded?.let {
|
||||||
PreferenceHelper.setLastFeedWatchedTime(it)
|
PreferenceHelper.updateLastFeedWatchedTime(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.subRefresh.isRefreshing = false
|
binding.subRefresh.isRefreshing = false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user