FEATURE: Add Tactile feedback on likes
This commit is contained in:
parent
bf50087d72
commit
f15264e977
|
@ -46,6 +46,8 @@ export default {
|
|||
|
||||
caps.hasContactPicker =
|
||||
"contacts" in navigator && "ContactsManager" in window;
|
||||
|
||||
caps.canVibrate = "vibrate" in navigator;
|
||||
}
|
||||
|
||||
// We consider high res a device with 1280 horizontal pixels. High DPI tablets like
|
||||
|
|
|
@ -8,6 +8,7 @@ import { Promise } from "rsvp";
|
|||
import ENV from "discourse-common/config/environment";
|
||||
|
||||
const LIKE_ACTION = 2;
|
||||
const VIBRATE_DURATION = 5;
|
||||
|
||||
function animateHeart($elem, start, end, complete) {
|
||||
if (ENV.environment === "test") {
|
||||
|
@ -651,6 +652,10 @@ export default createWidget("post-menu", {
|
|||
return this.sendWidgetAction("showLogin");
|
||||
}
|
||||
|
||||
if (this.capabilities.canVibrate) {
|
||||
navigator.vibrate(VIBRATE_DURATION);
|
||||
}
|
||||
|
||||
if (attrs.liked) {
|
||||
return this.sendWidgetAction("toggleLike");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue