From d050a78a2d4302d0c2c10ff01f98b575074b1be6 Mon Sep 17 00:00:00 2001
From: Samuel Newman <mozzius@protonmail.com>
Date: Mon, 28 Oct 2024 22:03:08 +0200
Subject: Tweak haptics, add to post controls (#5977)

* change timing to 10ms, make ios only

* add haptics to post controls

* rm from like button
---
 src/view/com/post-thread/PostThreadComposePrompt.tsx | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

(limited to 'src/view/com/post-thread/PostThreadComposePrompt.tsx')

diff --git a/src/view/com/post-thread/PostThreadComposePrompt.tsx b/src/view/com/post-thread/PostThreadComposePrompt.tsx
index 7af0be999..2b58cc5fe 100644
--- a/src/view/com/post-thread/PostThreadComposePrompt.tsx
+++ b/src/view/com/post-thread/PostThreadComposePrompt.tsx
@@ -5,10 +5,11 @@ import {useLingui} from '@lingui/react'
 
 import {PressableScale} from '#/lib/custom-animations/PressableScale'
 import {useHaptics} from '#/lib/haptics'
+import {isIOS} from '#/platform/detection'
 import {useProfileQuery} from '#/state/queries/profile'
 import {useSession} from '#/state/session'
 import {UserAvatar} from '#/view/com/util/UserAvatar'
-import {atoms as a, native, useBreakpoints, useTheme} from '#/alf'
+import {atoms as a, ios, useBreakpoints, useTheme} from '#/alf'
 import {useInteractionState} from '#/components/hooks/useInteractionState'
 import {Text} from '#/components/Typography'
 
@@ -41,14 +42,18 @@ export function PostThreadComposePrompt({
         t.atoms.border_contrast_low,
         t.atoms.bg,
       ]}
-      onPressIn={() => playHaptic('Light')}
+      onPressIn={ios(() => playHaptic('Light'))}
       onPress={() => {
         onPressCompose()
-        setTimeout(() => playHaptic('Medium'), 200)
+        if (isIOS) {
+          setTimeout(() => playHaptic('Medium'), 10)
+        } else {
+          playHaptic('Light')
+        }
       }}
-      onLongPress={native(() => {
+      onLongPress={ios(() => {
         onPressCompose()
-        setTimeout(() => playHaptic('Heavy'), 200)
+        playHaptic('Heavy')
       })}
       onHoverIn={onHoverIn}
       onHoverOut={onHoverOut}>
-- 
cgit 1.4.1

