fix: Restore the user's home timeline position#44
Merged
nikclayton merged 7 commits intopachli:developfrom Sep 14, 2023
Merged
Conversation
Continue to copy the previous values for expanded, etc, although this will only cover the PAGE_SIZE of statuses that are inserted.
Persist status viewdata as a separate StatusViewDataEntity, and join this with each status when building from the cached timeline. This allows the user's viewdata choices to persist after the cached timeline is cleared during a refresh operation. Add a repository method to save the status viewdata, and call that from the viewmodel instead of per-viewdata item methods.
- Periodically prune the StatusViewDataEntity table - Remove the data when an account is logged out
The previous code would always fetch the latest statuses when the app restarts, jumping the user to the top of the home timeline. This is because state.anchorPosition was null in this case. Fix this by passing the saved initialKey to CachedTimelineRemoteMediator and using it to construct a page of statuses around the requested status. This restores the user's reading position, and ensures that if the user is at the top of the list they're reading position is not reset to the second item in the list. Fixes pachli#41, pachli#42
…position # Conflicts: # app/src/main/java/app/pachli/components/timeline/viewmodel/CachedTimelineRemoteMediator.kt
This was referenced Sep 14, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The previous code would always fetch the latest statuses when the app
restarts, jumping the user to the top of the home timeline. This is
because state.anchorPosition was null in this case.
Fix this by passing the saved initialKey to CachedTimelineRemoteMediator
and using it to construct a page of statuses around the requested
status.
This restores the user's reading position, and ensures that if the
user is at the top of the list their reading position is not reset
to the second item in the list.
Fixes #41, #42