Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save and restore the user's reading position more frequently #3685

Merged
merged 2 commits into from
May 23, 2023
Merged

Save and restore the user's reading position more frequently #3685

merged 2 commits into from
May 23, 2023

Conversation

nikclayton
Copy link
Contributor

The previous code gets the user's reading position once, when the viewmodel is created, and uses that whenever it needs to be restored.

This is a problem. Suppose the user is a few days behind on their notifications, and opens the app.

The reading position is restored, as expected. They scroll up to start reading newer notifications.

Then they change their notification filters. This causes the notifications list to change, and when it does their reading position is set back to what it was when they first switched to the Notifications tab.

Fix this by:

NotificationsFragment:

  • Save the reading position whenever the user stops scrolling.

NotificationsViewModel:

  • Use the saved reading position whenever the list of notifications can change, not just when the view model is created.

The previous code gets the user's reading position *once*, when the
viewmodel is created, and uses that whenever it needs to be restored.

This is a problem. Suppose the user is a few days behind on their
notifications, and opens the app.

The reading position is restored, as expected. They scroll up to start
reading newer notifications.

Then they change their notification filters. This causes the
notifications list to change, and when it does their reading position
is set back to what it was when they first switched to the Notifications
tab.

Fix this by:

NotificationsFragment:
- Save the reading position whenever the user stops scrolling.

NotificationsViewModel:
- Use the saved reading position whenever the list of notifications
  can change, not just when the view model is created.
@nikclayton nikclayton merged commit 57e79b3 into tuskyapp:develop May 23, 2023
@nikclayton nikclayton deleted the 3551-save-reading-position-on-scroll branch May 29, 2023 11:39
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.

2 participants