Skip to content

Commit

Permalink
fix(SubscriptionsFragment): update last feed time to last video time
Browse files Browse the repository at this point in the history
With the introduction of the local feed extraction, which only refreshes
the feed naturally once a day, it is possible for the user to update the
`lastFeedWatchedTime`, but not fetch the feed itself, leading to a
disconnect between both values.
When the feed is then later on refreshed, the caught-up-indicator is
only displayed for the videos since the last app open, and not all new
videos since the last refresh.
  • Loading branch information
FineFindus committed Jan 23, 2025
1 parent 111cd1b commit 762576a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.content.SharedPreferences
import androidx.core.content.edit
import androidx.preference.PreferenceManager
import com.github.libretube.constants.PreferenceKeys
import java.time.Instant

object PreferenceHelper {
/**
Expand Down Expand Up @@ -105,8 +104,8 @@ object PreferenceHelper {
return getString(PreferenceKeys.LAST_STREAM_VIDEO_ID, "")
}

fun updateLastFeedWatchedTime() {
putLong(PreferenceKeys.LAST_WATCHED_FEED_TIME, Instant.now().epochSecond)
fun setLastFeedWatchedTime(time: Long) {
putLong(PreferenceKeys.LAST_WATCHED_FEED_TIME, time)
}

fun getLastCheckedFeedTime(): Long {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ class SubscriptionsFragment : DynamicLayoutManagerFragment(R.layout.fragment_sub
binding.subFeed.adapter = feedAdapter
binding.toggleSubs.text = getString(R.string.subscriptions)

PreferenceHelper.updateLastFeedWatchedTime()
PreferenceHelper.setLastFeedWatchedTime(feed.first { !it.isUpcoming }.uploaded )
}

@SuppressLint("SetTextI18n")
Expand Down

0 comments on commit 762576a

Please sign in to comment.