Skip to content

Conversation

@Bnyro
Copy link
Member

@Bnyro Bnyro commented May 5, 2025

closes #7366

@Bnyro Bnyro requested a review from FineFindus May 5, 2025 19:51
@Bnyro Bnyro force-pushed the notification-worker branch from 9e0f574 to c3c8dc4 Compare May 5, 2025 20:31
Copy link
Collaborator

@FineFindus FineFindus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using lastFeedWatchedTime will cause the all-caught-up marker to be moved.
From a UX perspective that would be unexpected, as the app would notify a user about new videos, but than not actually display them as new in the feed.
Not sure, if that is intended, but I think it would be better to use a separate variable to store the notification time.

@Bnyro
Copy link
Member Author

Bnyro commented May 6, 2025

Using lastFeedWatchedTime will cause the all-caught-up marker to be moved.
From a UX perspective that would be unexpected, as the app would notify a user about new videos, but than not actually display them as new in the feed.

Yes, I thought about this too, but forgot to write something about in in the PR description.

Not sure, if that is intended, but I think it would be better to use a separate variable to store the notification time.
The problem is that we already have 2 very similar variables

  • LAST_FEED_REFRESH_TIMESTAMP_MILLIS: only used for local feed extraction
  • LAST_WATCHED_FEED_TIME: last time the subscriptions feed was opened

and I hesitated to add yet another one to prevent additional complexity.

But yes, you're right, the way it's now with this PR doesn't make much sense.

@FineFindus
Copy link
Collaborator

FineFindus commented May 7, 2025

Maybe we could reuse LAST_FEED_REFRESH_TIMESTAMP_MILLIS here, since if it isn't updated there is no new video and if we update it in the notification, the new video must have been already fetched.

Alternatively I think it is fine to add a new variable for this as

  • it's not visible/modifiable by the user
  • it doesn't interact with the rest of the system

so the additional complexity is quite low.

@Bnyro
Copy link
Member Author

Bnyro commented May 7, 2025

Maybe we could reuse LAST_FEED_REFRESH_TIMESTAMP_MILLIS here, since if it isn't updated there is no new video and if we update it in the notification, the new video must have been already fetched.

In theory yes, but I want to keep the implementation of the LocalFeedRepository independent of the other logic, because it additionally has the differentiation whether the feed has been fully refreshed or not.

Alternatively I think it is fine to add a new variable for this as

it's not visible/modifiable by the user
it doesn't interact with the rest of the system

so the additional complexity is quite low.

Yes, that's probably the best solution.

@Bnyro Bnyro force-pushed the notification-worker branch from c3c8dc4 to 8995a0c Compare May 7, 2025 16:02
@Bnyro Bnyro requested a review from FineFindus May 7, 2025 16:03
@Bnyro
Copy link
Member Author

Bnyro commented May 7, 2025

Not 100% happy with it yet, but at least it should work (although untested).

@Bnyro Bnyro force-pushed the notification-worker branch from 8995a0c to f4abfb7 Compare May 7, 2025 16:05
Copy link
Collaborator

@FineFindus FineFindus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm, we're no longer updating the LastFeedWatchedTime every time the feed is shown, but now only when the feed is fetched?

Comment on lines 149 to 151
// use the helper methods at PreferenceHelper to access these
const val LAST_USER_SEEN_FEED_TIME = "last_watched_feed_time"
const val LAST_REFRESHED_FEED_TIME = "last_updated_feed_time"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not super happy about a comment telling user not to use something and would prefer to encode this in the type-system, but that's unrelated to the PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, me neither.

@Bnyro Bnyro force-pushed the notification-worker branch from f4abfb7 to 0d405f4 Compare May 7, 2025 18:50
@Bnyro
Copy link
Member Author

Bnyro commented May 7, 2025

Just to confirm, we're no longer updating the LastFeedWatchedTime every time the feed is shown, but now only when the feed is fetched?

That usually should happen at the same time because we had only been updating the feed via the subscriptions fragment (and the home fragment, but I had a boolean for it to skip updating the variable then). I've pushed changes to clarify it, there are 3 places where we update any of these variables now:

  • both of them, when the user views the subscriptions fragment/feed
  • only the last refreshed time (but not the watched/seen time) in the NotificationWorker
  • the refreshed time everytime the feed is loaded in the view model (which is also done by the home fragment)

@Bnyro
Copy link
Member Author

Bnyro commented May 7, 2025

I'll cleanup the commit history in a sec.

@Bnyro Bnyro force-pushed the notification-worker branch from 0d405f4 to d0ef8dd Compare May 7, 2025 19:00
Copy link
Collaborator

@FineFindus FineFindus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the refreshed time everytime the feed is loaded in the view model (which is also done by the home fragment)

I think it might be worthwhile discussing if changing that to avoid cases where the all-caught-up marker disappears (e.g. a users searches something, causing the fragment to reload, loosing the marker), but this isn't the right place for it.

@Bnyro Bnyro force-pushed the notification-worker branch from 12510a5 to c8c29ac Compare May 8, 2025 08:27
@Bnyro Bnyro merged commit 2dc8009 into libre-tube:master May 8, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make feed notifications more robust against subscription changes

2 participants