thunder-app / thunder

Thunder - An open-source cross-platform Lemmy client for iOS and Android built with Flutter
https://thunderapp.dev
GNU Affero General Public License v3.0
732 stars 62 forks source link

added swipe to return on post body + scroll to top buttons #245

Closed hbbit-dev closed 10 months ago

hbbit-dev commented 11 months ago

Added function to return to home screen when you swipe left to right on post body, doesn't effect existing gesture controls for post voting on home screen or comment voting.

micahmo commented 11 months ago

I believe this is related to #198.

hbbit-dev commented 11 months ago

@micahmo Yes and no, I haven't been able to get it to open the side bar when swiping left to right on the home page, just from post view to exit to the home page. Been working on it but for some reason the drawer won't open when activated, no errors thrown, will take some more thinking before I can say that problem is solved.

hbbit-dev commented 11 months ago

ALSO ADDED:

-Scroll to top button for home page -Scroll to top for post view (haven't figured out how to add it to the community view yet)

These two can be used in conjunction to quickly return home. Tap return button, swipe to return to homepage.

hbbit-dev commented 11 months ago

ANOTHER ADD:

-Confirmation to close app when OS "back" button or swipe gesture is used.

This should prevent accidental exits as requested in #243

micahmo commented 11 months ago

from post view to exit to the home page

That's actually the main thing I wanted from #198. Since then, I discovered that I can open the hamburger menu with a swipe on the bottom nav bar, so the other request is much less important.

hjiangsu commented 10 months ago

Nice job on all the features so far! I haven't had the chance to look at this fully, but I do have a couple of questions:

Confirmation to close app when OS "back" button or swipe gesture is used.

I'm wondering if we should do a double tap to close rather than an alert dialog to prompt the user

I would like to get others to input their thoughts/opinions into this!

hbbit-dev commented 10 months ago

Made some adjustments to make sure everything lines up with existing buttons on all pages

https://imgur.com/a/h5Zrh9e

Page Functionality: -Works on Feed -Works in Post View -Works in User Page -Works in Community -Does not work in Account Page comments when scrolling, I think the account header pushes the button down, can't figure out how to adjust button position based on current page

Then the swipe back on post option works with it to quickly scroll up then swipe out, also warning for app exit prevents accidental exits when doing this.

hbbit-dev commented 10 months ago

I'm wondering if we should do a double tap to close rather than an alert dialog to prompt the user

* What we can do instead of an alert dialog is to show a snackbar/toast to let the user know to tap the back button again to exit

* Having a snackbar/toast seems less disruptive to the experience than a full alert dialog

I would like to get others to input their thoughts/opinions into this!

Forgot to reply to this, I saw Sync for Reddit has that functionality, to swipe back twice to exit. Was looking around at other apps this morning to see how each one handles certain things. Backing a swipe-twice-to-exit would allow us to preserve the double tap to open side bar gesture, and I think its more clean as a solution. I can work on getting that added instead.

hbbit-dev commented 10 months ago

Alright, @hjiangsu I swapped the dialog box with a snackbar which pops up for 3.5 seconds, and after 3.5 seconds resets the counter for how many times you've swiped back so if the snackbar expires, it will confirm again later next time you swipe back instead of just exiting. Pushing one more commit to up the time from 3 seconds to 3.5...

https://imgur.com/a/mJNdgDD

hbbit-dev commented 10 months ago

-added fix for error mentioned in #207

refreshing from All page now retains All page instead of reverting to Local page

machinaeZER0 commented 10 months ago

This is really cool! I will say, it feels like the FAB is doing some work that (in some cases) could be done by existing buttons (or buttons planned for the future):

I still think this is great, and the other functionality in this PR is a game changer. Just weighing in in case it provides any food for thought :)

hbbit-dev commented 10 months ago

This is really cool! I will say, it feels like the FAB is doing some work that (in some cases) could be done by existing buttons (or buttons planned for the future):

* In other apps, hitting the home button on the nav bar usually brings me to the top of the feed - that said, having the FAB pop up when the nav bar is hidden makes perfect sense to me

* In comment view I'm still hoping we'll eventually have up/down arrows that will allow us to quickly navigate between reply threads (see issue [Up/Down arrows for navigating comment threads #75](https://github.com/hjiangsu/thunder/issues/75)); I don't know if other apps do this, but in Boost for Reddit long-pressing the up arrow in this view would scroll you back to the top of the page

I still think this is great, and the other functionality in this PR is a game changer. Just weighing in in case it provides any food for thought :)

I was thinking about this first point during working on it today, I think the one on the main feed could probably be replaced with a tap on the home icon of the Nav bar, will look into that as a replacement. The problem is as its currently built, the return-to-top button is built straight into the post_card_list.dart file so it appears anywhere that class is called which includes the main feed. I looked into separating the button per page but was having issues getting the scrollController to react, will look into it more as it seems that's probably the best way forward.

As far as the long press on the upvote, I am a boost user of like...6 years and I had no idea that was a feature haha. I can look into it for sure, if possible it probably won't be in the main release for a while.

machinaeZER0 commented 10 months ago

As far as the long press on the upvote, I am a boost user of like...6 years and I had no idea that was a feature haha. I can look into it for sure, if possible it probably won't be in the main release for a while.

I have a screenshot of this! Just to be clear, it was the up arrow on this little nav popup: Screenshot 2023-07-09 083301

And yeah, a long-press brought you right back to the top of the page :) very handy little overlay!

machinaeZER0 commented 10 months ago

Also to nod back to Home button functionality (if anything in here there feels relevant), linking issue #149

hbbit-dev commented 10 months ago

@hjiangsu there was a merge conflict, but the code in develop wouldn't compile as it was missing a return statement for the builder in line 164. Added back the return to show page view, good to go

hjiangsu commented 10 months ago

Just double checking - this is good to go? I'll merge it in if it is!

hbbit-dev commented 10 months ago

Just double checking - this is good to go? I'll merge it in if it is!

Yep, all good to go.