GeopJr / Tuba

Browse the Fediverse
https://tuba.geopjr.dev/
GNU General Public License v3.0
504 stars 55 forks source link

[Request]: Pull/Scroll down to refresh #1004

Closed AnuraagReddy123 closed 2 weeks ago

AnuraagReddy123 commented 2 weeks ago

Describe the request

Apps like Reddit, Mail in iOS have this feature, that refreshes the app once you pull down on the screen.

A feature like this would be nice to have in Tuba but I am not sure how feasible it would be to implement. I think the app detects when the user has reached the top of the page, as an animation plays out when you reach the top. So maybe the app can be refreshed when that animation is completed?

https://github.com/GeopJr/Tuba/assets/66117695/01e0500a-69c5-4ef7-9842-21ab934074eb

Implementation Details

GeopJr commented 2 weeks ago

Thanks for raising this issue!

Tuba can do this already!

Screencast from 2024-06-14 10-49-05.webm

But by clicking/tapping and dragging down.

Lengthy explanation on why it works like this:

TLDR: We've tested out a lot of different ways to do this and this was the most reliable. That's not to say that it cannot change in the future, but for now this is the best of all worlds.

Pull to refresh was first suggested on #155. This is a new pattern / not found in any other GNOME app so it was up to me to figure out all the details.

In my comment https://github.com/GeopJr/Tuba/issues/155#issuecomment-1560440341, you'll see my first implementation. It worked similar to what you suggested, if the user scrolled 'harder' at the top, it would show a spinner, and if they scrolled to the top again, it would refresh.

https://private-user-images.githubusercontent.com/18014039/240482709-16dddacf-f524-4220-8655-4a10754b8c86.webm?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTgzNTE4NTQsIm5iZiI6MTcxODM1MTU1NCwicGF0aCI6Ii8xODAxNDAzOS8yNDA0ODI3MDktMTZkZGRhY2YtZjUyNC00MjIwLTg2NTUtNGExMDc1NGI4Yzg2LndlYm0_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYxNFQwNzUyMzRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xM2YwOWE0ZjBjOGNiMDAyNGFkYjAwOTc3OGYxMjFmMDIxYzRlOGFiMTZkMzU1YmFhOTM2Y2VkNGI1MWFlMmFkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.wt01cc7b5QtpiGUEzB2Efcj5bqCW577Gn6zSKFcBdzk

That however did not feel as natural. It was hard to discover and even hard to trigger, plus it required a scroll wheel.

So instead on #283, I changed it to the 'drag' behavior.

Design wise, it was similar to apple's

But later due to some performance experiments, it changed to the 'android'-style one (the one you see at the first recording in this comment)