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

Fix - Reduce the haptic feedback vibration to a short bip #5960

Merged
merged 18 commits into from
Oct 29, 2021
Merged

Fix - Reduce the haptic feedback vibration to a short bip #5960

merged 18 commits into from
Oct 29, 2021

Conversation

rushatgabhane
Copy link
Member

@rushatgabhane rushatgabhane commented Oct 20, 2021

cc: @Jag96 Creating a draft PR. Looking forward for your feedback!

Details

This PR removes react-native-unimodules and expo-haptics as they aren't required anymore.

Now that my PR is merged into react-native-haptic-feedback, we can use it directly instead of Expensify's fork.

Use the lib junina-de/react-native-haptic-feedback for haptic feedback.

Android

Create a new file: components/PressableWithSecondaryInteraction/index.android.js
Call ReactNativeHapticFeedback.trigger('effectHeavyClick'); for a long press.

iOS

Create a new file: components/PressableWithSecondaryInteraction/index.ios.js
Call ReactNativeHapticFeedback.trigger('selection'); for a long press.

Fixed Issues

$ #4355

Tests / QA

  1. Navigate to a conversation on mobile (iOS, Android).
  2. Long press on a message.
  3. Verify that the haptic feeback is same as slack's long press on a message.

Tested On

  • iOS
  • Android

Screenshots

Not Applicable

@rushatgabhane

This comment has been minimized.

@Jag96
Copy link
Contributor

Jag96 commented Oct 21, 2021

@rushatgabhane we've fixed the e2e tests on main, please merge main into your branch to confirm they pass again!

@rushatgabhane
Copy link
Member Author

All checks have passed!

@parasharrajat
Copy link
Member

I believe that we should be good to drop react-native-unimodules modules and expo-haptic packages.

@rushatgabhane
Copy link
Member Author

rushatgabhane commented Oct 22, 2021

Yup, from Rory's comment #4355 (comment)
dropping unimodules and expo-haptic would be the next step.

If this draft PR is given a go ahead, I'll remove those libs as cleanup commits.

@Jag96
Copy link
Contributor

Jag96 commented Oct 26, 2021

cc @Julesssss @Beamanator since they volunteered to test this previously, could you confirm the feedback pattern is the same as slack on your physical Android devices on this PR?

ref={props.forwardedRef}
onPress={props.onPress}
onPressIn={props.onPressIn}
delayLongPress={200}
Copy link
Contributor

@Julesssss Julesssss Oct 26, 2021

Choose a reason for hiding this comment

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

Why not use the default value of 500? If this is to precisely match Slack, then does Slack not match the native delay length on iOS?

Copy link
Member Author

Choose a reason for hiding this comment

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

Didn't notice it.
Changing long press delay to 500ms for iOS.

Copy link
Member

Choose a reason for hiding this comment

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

This was intentional. Menu itself takes 300 to show so adding 500 here means 800ms delay before menu is completely visible and interactive.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a reasonable choice, but I would prefer to keep longPress time at the iOS default. If the menu is slow to appear we should optimise that instead.

Copy link
Contributor

@Julesssss Julesssss left a comment

Choose a reason for hiding this comment

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

I'm getting a crash on Android 8.1:

Error when loading lib: dlopen failed: library "libjsc.so" not found lib hash: eae0e884bac6a338b8c53618b45e2515 search path is /data/app/com.expensify.chat-4zdOjJAUwAHOSjq0TXDQ8Q==/lib/arm64
2021-10-26 11:36:08.075 16636-16636/com.expensify.chat W/System.err: java.lang.UnsatisfiedLinkError: dlopen failed: library "libjsc.so" not found
2021-10-26 11:36:08.076 16636-16636/com.expensify.chat W/System.err:     at com.facebook.soloader.SoLoader$1.load(SoLoader.java:384)
2021-10-26 11:36:08.077 16636-16636/com.expensify.chat W/System.err:     at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:77)
2021-10-26 11:36:08.077 16636-16636/com.expensify.chat W/System.err:     at com.facebook.soloader.DirectorySoSource.loadLibrary(DirectorySoSource.java:50)
2021-10-26 11:36:08.077 16636-16636/com.expensify.chat W/System.err:     at com.facebook.soloader.ApplicationSoSource.loadLibrary(ApplicationSoSource.java:89)

device-2021-10-26-114021

@rushatgabhane
Copy link
Member Author

rushatgabhane commented Oct 26, 2021

@Julesssss Thanks for testing it out!
I've fixed the crash on versions below Android 10.

Tested it on Samsung S8 (android 9), Pixel 3 (android 11), and the haptics match Slack.

Also tested on android 5, 6, 7, 8 on emulator to check for crashes.

Copy link
Contributor

@Jag96 Jag96 left a comment

Choose a reason for hiding this comment

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

Tested on my physical iPhone and the 500ms matches slack exactly 👍

Copy link
Contributor

@Julesssss Julesssss left a comment

Choose a reason for hiding this comment

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

Tests well on Android, the vibration pattern matches slack.

I requested one minor change, but once that's done I think we're good to merge 👍

@Julesssss
Copy link
Contributor

@rushatgabhane is there any reason for this to still be a draft?

@rushatgabhane
Copy link
Member Author

@Julesssss from this comment, I think we're good to remove react-native-unimodules and expo-haptics.

Should I remove it in this PR, or create a new one?

Copy link
Contributor

@Julesssss Julesssss left a comment

Choose a reason for hiding this comment

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

Nnoticed a few small things to change

@Julesssss
Copy link
Contributor

@rushatgabhane nice spot, it would be great if you remove it in this PR so we can run the vibration tests against it.

@rushatgabhane
Copy link
Member Author

rushatgabhane commented Oct 28, 2021

Status: PR ready for review.

ToDo

  • remove iOS config for react-native-unimodules

@rushatgabhane rushatgabhane marked this pull request as ready for review October 29, 2021 00:49
@rushatgabhane rushatgabhane requested a review from a team as a code owner October 29, 2021 00:49
@botify botify requested a review from Jag96 October 29, 2021 00:49
@MelvinBot MelvinBot removed the request for review from a team October 29, 2021 00:49
Copy link
Contributor

@Julesssss Julesssss left a comment

Choose a reason for hiding this comment

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

Confirmed the vibration pattern matches on Android.

Copy link
Contributor

@Jag96 Jag96 left a comment

Choose a reason for hiding this comment

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

LGTM, great work on this!

@Jag96 Jag96 merged commit 17aab27 into Expensify:main Oct 29, 2021
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @Jag96 in version: 1.1.11-2 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

OSBotify commented Nov 2, 2021

🚀 Deployed to production by @yuwenmemon in version: 1.1.12-3 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

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.

5 participants