File tree Expand file tree Collapse file tree
app/src/main/java/com/github/libretube Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import android.content.SharedPreferences
55import androidx.core.content.edit
66import androidx.preference.PreferenceManager
77import com.github.libretube.constants.PreferenceKeys
8- import java.time.Instant
98
109object PreferenceHelper {
1110 /* *
@@ -105,8 +104,8 @@ object PreferenceHelper {
105104 return getString(PreferenceKeys .LAST_STREAM_VIDEO_ID , " " )
106105 }
107106
108- fun updateLastFeedWatchedTime ( ) {
109- putLong(PreferenceKeys .LAST_WATCHED_FEED_TIME , Instant .now().epochSecond )
107+ fun setLastFeedWatchedTime ( time : Long ) {
108+ putLong(PreferenceKeys .LAST_WATCHED_FEED_TIME , time )
110109 }
111110
112111 fun getLastCheckedFeedTime (): Long {
Original file line number Diff line number Diff line change @@ -379,7 +379,7 @@ class SubscriptionsFragment : DynamicLayoutManagerFragment(R.layout.fragment_sub
379379 // add an "all caught up item"
380380 if (selectedSortOrder == 0 ) {
381381 val lastCheckedFeedTime = PreferenceHelper .getLastCheckedFeedTime()
382- val caughtUpIndex = feed.indexOfFirst { it.uploaded / 1000 < lastCheckedFeedTime && ! it.isUpcoming }
382+ val caughtUpIndex = feed.indexOfFirst { it.uploaded <= lastCheckedFeedTime && ! it.isUpcoming }
383383 if (caughtUpIndex > 0 ) {
384384 sortedFeed.add(
385385 caughtUpIndex,
@@ -398,7 +398,9 @@ class SubscriptionsFragment : DynamicLayoutManagerFragment(R.layout.fragment_sub
398398
399399 binding.toggleSubs.text = getString(R .string.subscriptions)
400400
401- PreferenceHelper .updateLastFeedWatchedTime()
401+ feed.firstOrNull { ! it.isUpcoming }?.uploaded?.let {
402+ PreferenceHelper .setLastFeedWatchedTime(it)
403+ };
402404 }
403405
404406 @SuppressLint(" SetTextI18n" )
You can’t perform that action at this time.
0 commit comments