Skip to content

Add support for scrolling up/down when album list is active#128

Merged
Rigellute merged 2 commits into
masterfrom
unknown repository
Nov 3, 2019
Merged

Add support for scrolling up/down when album list is active#128
Rigellute merged 2 commits into
masterfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Nov 3, 2019

This PR is related to #11

ctrl+d/u should scroll through pages but this has been implemented in "Liked Songs" view only. In this PR, I tried to implement scrolling down/up in the "Albums" view.

need to confirm:
In src/app.rs, I added three methods (get_current_user_saved_albums, get_current_user_saved_albums_next, and get_current_user_saved_albums_previous) for App. These methods are imitation of **saved_tracks** methods. Although push_navigation_stack is called in get_current_user_saved_tracks, I did NOT call push_navigation_stack in get_current_user_saved_albums. If push_navigation_stack is called after each page scrolling, same contents are pushed into the stack. Scrolling pages several time, q key (go back) seems foul-up. This behavior seems a bug for me so I did not call push_navigation_stack in get_current_user_saved_albums.

@Rigellute
Copy link
Copy Markdown
Owner

Thanks for taking a crack at this.

I think I've got things into a bit of a mess with regards to pagination (managing page index, scroll, index etc.).

There's a half baked attempt to clean this up, using a more generic struct (see ScrollableResultPages struct in app.rs).

I've got a better understanding of how this should work now and do intend to clean this up.

With regards to your comments, you're right about not pushing to the stack when fetching the next page. Pushing to the stack only needs to happen the first time we want to navigate to that view.

Copy link
Copy Markdown
Owner

@Rigellute Rigellute left a comment

Choose a reason for hiding this comment

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

Nice one, this looks good 👍

@Rigellute Rigellute merged commit edb7e2d into Rigellute:master Nov 3, 2019
@ghost ghost deleted the scroll-album-list branch November 8, 2019 06:49
nighi pushed a commit to nighi/spotify-tui that referenced this pull request Jul 11, 2025
Add support for scrolling up/down when album list is active
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.

1 participant