web: add haptics for all copy actions
& prevent spamming the copy action along with haptic feedback :3 should probably unify all of this cuz this is really messy
This commit is contained in:
@@ -2,10 +2,10 @@ import { device } from "$lib/device";
|
||||
|
||||
// not sure if vibrations feel the same on android,
|
||||
// so they're enabled only on ios 18+ for now
|
||||
const shouldVibrate = device.is.modernIOS;
|
||||
const useHaptics = device.is.modernIOS;
|
||||
|
||||
export const hapticSwitch = () => {
|
||||
if (!shouldVibrate) return;
|
||||
if (!useHaptics) return;
|
||||
|
||||
try {
|
||||
const label = document.createElement("label");
|
||||
@@ -24,3 +24,10 @@ export const hapticSwitch = () => {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
export const hapticConfirm = () => {
|
||||
if (!useHaptics) return;
|
||||
|
||||
hapticSwitch();
|
||||
setTimeout(() => hapticSwitch(), 120);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user