App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2021-11-09] Reduce the haptic feedback vibration to a short bip

Open isagoico opened this issue 5 years ago • 57 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!

Upwork posting: https://www.upwork.com/jobs/~0105c031baf3dfd3df


Action Performed:

  1. Navigate to a conversation in mobile
  2. Press and hold on a message

Expected Result:

There should be a short blip of vibration.

Actual Result:

Current vibration is longer that it should be.

To achieve the desired result, we should:

  1. Update our app to use react-native-haptic-feedback
  2. Fork the library, and update the forked lib to have the same vibration as slack does when selecting messages
  3. Once the PR is merged into our codebase, create a PR upstream so that the functionality can be merged into react-native-haptic-feedback

Workaround:

N/A

Platform:

Where is this issue occurring?

  • iOS
  • Android

Version Number: 1.0.82-0

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

Expensify/Expensify Issue URL:

View all open jobs on Upwork


From @quinthar https://expensify.slack.com/archives/C01GTK53T8Q/p1627669368027700

I love the new haptic feedback when you long tap on mobile. However, it uses a kind of strange vibration. Can we match the same vibration that slack uses with long tap? It's just a incredibly short blip.

isagoico avatar Aug 01 '21 17:08 isagoico

Triggered auto assignment to @pecanoro (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

MelvinBot avatar Aug 01 '21 17:08 MelvinBot

Triggered auto assignment to @Jag96 (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

MelvinBot avatar Aug 02 '21 15:08 MelvinBot

It looks like there's some more context on this issue in this slack thread. cc @rushatgabhane since you had some good thoughts here.

Jag96 avatar Aug 02 '21 17:08 Jag96

@Jag96 I'm not able to find any npm package which matches the short blip of Slack.

However, I can get the exact haptic feedback as Slack's using native code for Android.

Here are our options for adding native code.

  1. Directly into New Expensify using NativeModules.
  2. Create a new npm package.

Which one do you prefer?

Alternatively, we could settle for a shorter duration of the strange vibration using rn-haptic-feedback.

rushatgabhane avatar Aug 02 '21 23:08 rushatgabhane

We've used NativeModules before here so I think that would be fine, but I'd reply to the thread in slack (and send to the main channel as well by ticking Also send to expensify-open-source) just to see if anybody has any opinions.

And just to confirm, using NativeModules would you just override the index.android.js functionality and continue using the current lib for iOS?

Jag96 avatar Aug 03 '21 01:08 Jag96

And just to confirm, using NativeModules would you just override the index.android.js functionality and continue using the current lib for iOS?

No. I won't using the current lib (expo-haptics) at all. NativeModules will be used for both iOS and Android.

rushatgabhane avatar Aug 03 '21 01:08 rushatgabhane

I forgot to mention, simulators don't support haptics and I don't own an iPhone. I'm gonna use apple's haptics docs for reference if that's fine.

rushatgabhane avatar Aug 03 '21 02:08 rushatgabhane

Update from slack thread

We decided to add bip() method to Vibration API by creating a PR for React Native.

I won't be available for a few weeks. So I won't be taking this issue. But here are things that might help with implementation.

Android: Vibrate(createPredefined(VibrationEffect.EFFECT_CLICK)) iOS: Selection

Correction: bip() not blip()

rushatgabhane avatar Aug 03 '21 20:08 rushatgabhane

Tiny thing: I vote naming the API call "bip" instead of "blip". When you say it out loud, "bip" is closer to the actual vibrate we're going for.

On Tue, Aug 3, 2021 at 1:34 PM Rushat Gabhane @.***> wrote:

Update from slack thread https://expensify.slack.com/archives/C01GTK53T8Q/p1627669368027700

We decided to add blip() method to Vibration https://reactnative.dev/docs/vibration API by creating a PR for React Native.

I won't be available for a few weeks. So I won't be taking this issue. But here are things that might help with implementation.

Android: Vibrate(createPredefined(VibrationEffect.EFFECT_CLICK)) iOS: Selection https://developer.apple.com/design/human-interface-guidelines/ios/user-interaction/haptics/

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Expensify/App/issues/4355#issuecomment-892146985, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEMNURFQSCEDCPEFWASKN3T3BHD7ANCNFSM5BLKL4VA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

quinthar avatar Aug 03 '21 20:08 quinthar

@Jag96 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

MelvinBot avatar Aug 06 '21 19:08 MelvinBot

In this case we add the code

{<TouchableOpacity
         
         onLongPress={() => Vibration.vibrate(1 * ONE_SECOND_IN_MS)}
     >
....
</TouchableOpacity>}

in InvertedFlatList in "/src/pages/home/report/ReportActionsView.js"

arpitdeveloper avatar Aug 07 '21 06:08 arpitdeveloper

change src\components\PressableWithSecondaryInteraction\index.native.js


import {Vibration} from 'react-native';

<Pressable
...
        onLongPress={(e) => {
            e.preventDefault();
            Vibration.vibrate(20);
            props.onSecondaryInteraction(e);   
        }}
...
    >
        {props.children}
    </Pressable> ````

in src\components\PressableWithSecondaryInteraction

it will reduce time from 50 (with haptics library) millisecond to 20 millisecond

chira37 avatar Aug 07 '21 16:08 chira37

@arpitdeveloper @chira37 please see the description of this issue for the desired implementation:

To achieve the desired result, we should:

  1. Update the Vibration lib in our react native fork to add a new function bip that will use the shortest, strongest vibration possible (see slack thread)
  2. Once the PR is merged, create a PR upstream so that the functionality can be merged into React Native's Vibration library

Jag96 avatar Aug 09 '21 22:08 Jag96

We can reduce the time of vibration. This is possible in React Native.

silverfoxgit avatar Aug 10 '21 03:08 silverfoxgit

Doubled price to $500 in Upwork.

mallenexpensify avatar Aug 17 '21 21:08 mallenexpensify

@arpitdeveloper @chira37 please see the description of this issue for the desired implementation:

To achieve the desired result, we should:

  1. Update the Vibration lib in our react native fork to add a new function bip that will use the shortest, strongest vibration possible (see slack thread)
  2. Once the PR is merged, create a PR upstream so that the functionality can be merged into React Native's Vibration library

I have added the bip() function to the expensify react native fork. PR was created

chira37 avatar Aug 21 '21 08:08 chira37

@chira37 please ensure you've read through the slack thread, and please refrain from making PRs until your proposal has been accepted.

From the slack thread, the current vibrate function does not allow for any customization on iOS, and the vibration on Android is not the vibration we want. The bip function should make use of the native libraries mentioned in the slack thread. If you have any questions, feel free to ask!

Jag96 avatar Aug 23 '21 16:08 Jag96

@Jag96 it looks like no one is assigned to work on this job. Please double the price or add a comment stating why the job isn't being doubled.

MelvinBot avatar Aug 23 '21 19:08 MelvinBot

Doubled the price: https://www.upwork.com/jobs/~0105c031baf3dfd3df

Jag96 avatar Aug 24 '21 20:08 Jag96

Hello @Jag96. I can't reproduce this issue, can you explain a better about testcase?

MTN718 avatar Aug 26 '21 06:08 MTN718