Skip to content
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

Add the ability to configure swipe gestures #497

Merged
merged 9 commits into from
Jul 24, 2023

Conversation

rsammelson
Copy link
Contributor

@rsammelson rsammelson commented Jul 20, 2023

Fixes #64

@rsammelson
Copy link
Contributor Author

@aeharding can you take a look at this and let me know your initial thoughts?

@aeharding
Copy link
Owner

aeharding commented Jul 21, 2023

Just a cursory glance at the code, looks good from a high level. I won't be able to review until this weekend though. Thanks!

(Sorry, accidentally tapped ready for review)

@aeharding aeharding marked this pull request as ready for review July 21, 2023 01:16
@aeharding aeharding marked this pull request as draft July 21, 2023 01:22
@rsammelson
Copy link
Contributor Author

Thanks!

@rsammelson rsammelson force-pushed the configure-swipe branch 2 times, most recently from 6e76902 to 99ee634 Compare July 21, 2023 01:26
@aeharding
Copy link
Owner

Okay, so I just had some time to check this out. A couple thoughts on the UI:

  1. Let's remove the "none" option from each and replace with a slider to disable left and right sliding options (see second picture) (This will require DB changes)
  2. Change the terminology for each option to be consistent with Apollo (and sort order of the options)
  3. Add an icon to each option in the popup (see third picture)
  4. Ideally we would have a swipe icons, but I realize this requires expertise with SVGs so it can be a future thing.

IMG_3204
IMG_3205
IMG_3206

@rsammelson
Copy link
Contributor Author

1. Let's remove the "none" option from each and replace with a slider to disable left and right sliding options (see second picture) (This will require DB changes)

With the none option you can disable only short or long swipes, allowing you to have a single action for each direction at either the short or long swipe trigger point. This would be useful for people who want a couple of swipe actions (perhaps upvote and downvote) but want to make it harder to accidentally trigger them (by only using long swipes). While it takes a little more effort to disable swipes (I can add a disable all option if you want), it allows for a lot more configurability.

2. Change the terminology for each option to be consistent with Apollo (and sort order of the options)

3. Add an icon to each option in the popup (see third picture)

I will fix these soon.

@aeharding
Copy link
Owner

With the none option you can disable only short or long swipes, allowing you to have a single action for each direction at either the short or long swipe trigger point. This would be useful for people who want a couple of swipe actions (perhaps upvote and downvote) but want to make it harder to accidentally trigger them (by only using long swipes). While it takes a little more effort to disable swipes (I can add a disable all option if you want), it allows for a lot more configurability.

That's what the "long swipe trigger point" option does (see second screen shot)

@rsammelson
Copy link
Contributor Author

How does that option work? I don't understand which swipes it disables.

@aeharding
Copy link
Owner

It doesn't disable any option, it just requires you to swipe further before changing to the second swipe option

@rsammelson
Copy link
Contributor Author

My point was that by changing individual things to None, you can set a single action for either direction, and you can choose whether you want it at the short swipe or long swipe distance. I for one would prefer not having a short swipe on comments because I accidentally trigger it sometimes, especially on the left when trying to go back.

@aeharding
Copy link
Owner

I understand, however I'd rather add an option to disable short swipe left universally. Otherwise you could have inconsistent behavior on inbox items vs posts vs comments.

@rsammelson
Copy link
Contributor Author

Thoughts on this look?

@aeharding
Copy link
Owner

Looks great!

@rsammelson
Copy link
Contributor Author

rsammelson commented Jul 23, 2023

I added icons to the lists:





I also added options to turn off left and right completely:

@rsammelson rsammelson marked this pull request as ready for review July 23, 2023 04:10
@rsammelson
Copy link
Contributor Author

Future work is allowing users to disable the back gesture on iOS. Note, I did leave none as an option so far, because I would really like to have that choice; given that it's in a pretty deep menu I imagine it won't bother anyone who doesn't choose it.

src/services/db.ts Outdated Show resolved Hide resolved
src/services/db.ts Outdated Show resolved Hide resolved
src/features/shared/sliding/BaseSlidingVote.tsx Outdated Show resolved Hide resolved
src/features/shared/sliding/BaseSlidingVote.tsx Outdated Show resolved Hide resolved
src/features/shared/sliding/SlidingItem.tsx Outdated Show resolved Hide resolved
*/
Total: "total",
Copy link
Owner

Choose a reason for hiding this comment

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

Was this a bad merge?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I realized the sorting was strange, not its least verbose -> most verbose when you look top to bottom.

Copy link
Owner

Choose a reason for hiding this comment

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

I'm not sure I understand, to me it makes sense to have default be at the top in general.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean that now it's in the order: no information (none) -> some information (only the total) -> all information (separate scores). The default is the middle, and you can choose go up or down a level to see less or more. I can change it if you want.

Copy link
Owner

@aeharding aeharding Jul 23, 2023

Choose a reason for hiding this comment

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

Let's revert this for now.

src/features/shared/sliding/BaseSlidingVote.tsx Outdated Show resolved Hide resolved
src/features/settings/gestures/swipe_long.svg Outdated Show resolved Hide resolved
src/features/settings/gestures/gesturesSlice.tsx Outdated Show resolved Hide resolved
src/features/inbox/inboxSlice.ts Outdated Show resolved Hide resolved
@aeharding
Copy link
Owner

aeharding commented Jul 23, 2023

I'm experiencing some strange behavior:

  1. Open home feed
  2. Go to gestures page
  3. Turn on "disable swipe gestures" both left and right, then turn both off
  4. Go back to feed, try to swipe item
  5. See the swipe item (upvote, reply etc) stays transparent and doesn't fully enable. You also can't swipe to far action
  6. If you let go and swipe again, the next one should work

Can you replicate? It's not a huge bug or anything just strange behabior

@aeharding
Copy link
Owner

aeharding commented Jul 23, 2023

I'm wondering if we should change hide post to bookmark as the default far right swipe item. That would match Apollo and also would avoid confusing new users when they accidentally swipe away a post and lose it. What do you think?

@rsammelson
Copy link
Contributor Author

There's still more to be done, but I wanted to push most of what I have.

@rsammelson rsammelson marked this pull request as draft July 23, 2023 06:29
src/services/db.ts Outdated Show resolved Hide resolved
@aeharding
Copy link
Owner

What do you think about this?

--- a/src/features/settings/gestures/SwipeSettings.tsx
+++ b/src/features/settings/gestures/SwipeSettings.tsx
@@ -145,6 +145,7 @@ export default function SwipeSettings() {
 }

 const swipeIcons = {
+  [OSwipeActionAll.None]: " ",
   [OSwipeActionAll.Upvote]: arrowUpOutline,
   [OSwipeActionAll.Downvote]: arrowDownOutline,
   [OSwipeActionAll.Reply]: arrowUndoOutline,
image

@aeharding
Copy link
Owner

Can we move Upvote above Downvote in the Setting Selector?
image

@rsammelson
Copy link
Contributor Author

Can we move Upvote above Downvote in the Setting Selector?

It should already be like that, see the diff from my force push last night https://github.com/aeharding/voyager/compare/553969f2b5245bdab822ee36d4a0d444c20080e4..bef18183ce489791ad9350d9fb60968e1d6669d4. Is it not for you?

@rsammelson
Copy link
Contributor Author

rsammelson commented Jul 23, 2023

About the bug you mentioned, I can replicate it but I have not been able to figure out why it happens. It actually seems to happen even if you only turn one on and off, and then swipe in that direction. Never mind it only happens when both turn off.

@rsammelson
Copy link
Contributor Author

@aeharding can you take a look at #202? I would like to add share as a swipe option. Otherwise if this gets merged first I can add making it a swipe option to that PR.

@aeharding
Copy link
Owner

@aeharding can you take a look at #202? I would like to add share as a swipe option. Otherwise if this gets merged first I can add making it a swipe option to that PR.

Let's do share in a separate PR so this PR isn't blocked

@rsammelson rsammelson marked this pull request as ready for review July 23, 2023 20:48
@rsammelson rsammelson requested a review from aeharding July 23, 2023 20:48
Change to centralized sliding item action creation based on a dictionary
passed into BaseSlidingVote.
- Add swipe icons to show what each setting means
- Add icons on swipe menu options
- Add switches to completely turn off direction in one shot
@rsammelson
Copy link
Contributor Author

Most recent push was to update to the latest main, I wanted to ensure there were no problems from 9154e0c since it sounded like it might touch something related to this.

@aeharding
Copy link
Owner

I'm still a bit concerned about perf, but I haven't been able to get any conclusive results on perf changes between this and main.

@rsammelson Can you change the default far right swipe for posts from hide post to bookmark? I think this is getting pretty close now.

src/store.tsx Outdated Show resolved Hide resolved
Copy link
Owner

@aeharding aeharding left a comment

Choose a reason for hiding this comment

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

Nice work, this is quite the enhancement.

@aeharding aeharding merged commit f353596 into aeharding:main Jul 24, 2023
@rsammelson
Copy link
Contributor Author

Thanks!

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.

Configurable gestures
2 participants