-
Notifications
You must be signed in to change notification settings - Fork 289
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 scroll position in timeline #2459
base: release_1.10
Are you sure you want to change the base?
Conversation
This commit implements a way to save the scroll position within a timeline. It does that by assigning each note in the timeline an ID based on the NoteID, and adding a `scrollPosition` modifier along with SceneStorage to keep track of and persist the scroll position along the timeline view throughout a single app session. Notes: - Scroll position is not persisted across app restarts. When the user completely quits the app, scroll position is lost. - This works on home feed and universe view. However, due to how Universe view is dynamically loaded, performance may not be as good as on the home feed - This only works on iOS 17 and higher, since the necessary scroll position reading mechanism is only available in those versions. On older versions things should work as before this change. Testing ------- PASS Damus: This commit iOS: 17.6.1 Device: iPhone 13 mini Steps: 1. Scroll down home feed to a note with a memorable image 2. Switch to the notifications tab 3. Switch back to the home tab. Ensure scroll position is at the memorable image (or close). PASS 4. Navigate into another profile from the home feed 5. Go back to the home feed by clicking the "back" button on the top left. Ensure scroll position is preserved. PASS 6. Navigate into another profile from the home feed again. 7. Go back to the home feed by clicking the home button at the bottom tab bar. Ensure scroll position is preserved. PASS 8. Click on the home button at the bottom tab bar while at the home feed. You should be taken to the top. PASS iOS 16 regression testing ------------------------- PASS Damus: This commit iOS: 16.4 Device: iPhone SE simulator Steps: 1. Navigate through the home feed, navigate between tabs 2. Ensure there are no visible regressions on navigation. PASS Changelog-Fixed: Fixed situations where scroll position would be lost (iOS 17 only) Closes: damus-io#751 Signed-off-by: Daniel D’Aquino <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
// therefore ensuring we will *own* this piece of memory, reducing the risk of being rugged by Ndb today and in future as the codebase evolves. | ||
// This is a 32-byte copy operation without any parsing, so it should in theory not regress performance significantly. | ||
// Thanks for coming to my TED talk about this one line of code. | ||
let ev_id = ev.id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
events held in timelines are owned data! they are not pointers to nostrdb. that would be bad, since the data would be outside of a transaction.
when we switch to the local relay model, timeline events will be lists of u64 primary keys. This is how notedeck works.
Copying an ID will probably be what we have to do when we switch to the local relay model, so this LGTM!
@jb55 as promised I did some performance testing, since I noticed some hitches while casually using a dev build, and wanted to check if it was just a fluke or if a real performance regression occurred. Unfortunately there was a performance regression. Performance testing detailsBaseline Damus version:
Procedure:
Data
Analysis and resultsIt was hard to tell with certainty that there was a performance regression with the naked eye because there are so many factors that go into the animation performance, but the results of this rigorous test are pretty conclusive. Unfortunately there was a performance regression that caused an increase in low-severity hitches. @jb55, I am thinking of the following actions:
How would you like to proceed? |
Converted to draft while we don't solve the performance issue |
This commit implements a way to save the scroll position within a timeline. It does that by assigning each note in the timeline an ID based on the NoteID, and adding a
scrollPosition
modifier along with SceneStorage to keep track of and persist the scroll position along the timeline view throughout a single app session.Notes:
Testing
PASS
Damus: This commit
iOS: 17.6.1
Device: iPhone 13 mini
Steps:
iOS 16 regression testing
PASS
Damus: This commit
iOS: 16.4
Device: iPhone SE simulator
Steps:
Changelog-Fixed: Fixed situations where scroll position would be lost (iOS 17 only)
Closes: #751