-
Notifications
You must be signed in to change notification settings - Fork 497
added HapticFeedback #1138
added HapticFeedback #1138
Conversation
Hey @dimonovdd this is a good looking addition. Are you willing to add tests and docs for this? |
One question I have is how different is it from "Vibrate" api. |
I am thinking the same as @jamesmontemagno... Maybe it might be better to merge this? Also, UWP is using the same named device, but a different entirely. The one we have is from phone and this one is from UWP general. I think we should keep both, or even drop phone since that is dead now. |
I think it makes sense to bring this into the Vibrate class perhaps as: public static class Vibration
{
public static void HapticFeedback(HapticFeedbackType type = HapticFeedbackType.Click)
} |
@Redth @jamesmontemagno @mattleibow I will write the documentation this weekend, but there is a problem with the tests, I have never written them, but I will try. Tell me what else needs to be done. |
@dimonovdd I think what we are more saying is that "vibrate" and "haptic feedback" are not the same, they are similar enough for the simplicity of Essentials. I think it is fine to have That is why I think not just because they are similar we should merge, but just because we actually need to. When a user does Any thoughts on that? Anyone? |
I think that the Vibrate Vibrate(HapticFeedbackType) should not be made because it deludes. On iOS and Android the vibration and haptic feedback are absolutely different things, and even if it should be merged, it should not confuse. on iOS the HapticFeadBack is supported only on devices that support iOS13 starting from iPhone. I haven't found any better way of checking than checking the iOS version which is why I left it that way for now. This is the link of the article We'll return to UWP later when we find a more correct way of merging those Vibrate and HapticFeedback Actually I thought and realized that it's worth writing a method that will determine whether Haptic Feedback is supported on a particular device. I'm going to work out this issue in the nearest future |
An example of HapticFeadback is a response when you tap on the keyboard of iOS and Android devices, and if HapticFeadback did not work, in this case the vibration should not be called and even more a vibration for 500ms, the developer himself should decide |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good. Just have a few comments, but nothing too big.
Xamarin.Essentials/HapticFeedback/HapticFeedback.netstandard.tizen.tvos.watchos.cs
Outdated
Show resolved
Hide resolved
@mattleibow @Redth @jamesmontemagno @rookiejava I apologize for the big amount of text Now implemented are only the following types of HapticFeedback
But the platforms have many other different types of response. How do you think which of them we should add to xamarin essentials Android:
UWP:
iOS: UIImpactFeedbackGenerator :
UINotificationFeedbackGenerator :
UISelectionFeedbackGenerator Tizen:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
I think for the first run, lets just keep the two. Once it is merged then we can decide. Unless @Redth or @jamesmontemagno has another opinion? |
@mattleibow |
Using `UISelectionFeedbackGenerator` felt a bit weak compared to long pressing on the iOS home screen. The other benefit to switching to UIImpactFeedbackGenerator is it works on iOS 10+.
Description of Change
Added support for" HapticFeedback " for iOS, Android, and UWP.
But I couldn't test on UWP because I don't have a device that supports " HapticFeedback"
I hope I have correctly created a pull-request