about summary refs log tree commit diff
path: root/src/screens/Profile/Header/ProfileHeaderLabeler.tsx
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-04-11 15:20:26 -0700
committerGitHub <noreply@github.com>2024-04-11 15:20:26 -0700
commit740cd029d7162a936d16b427201eb8972e365b94 (patch)
treeff4cf80cc8cd88bd958abd68c3cb3aa46328240e /src/screens/Profile/Header/ProfileHeaderLabeler.tsx
parent9007810cdb5ffc8fbdf8e2a2af6c073b76b318f3 (diff)
downloadvoidsky-740cd029d7162a936d16b427201eb8972e365b94.tar.zst
Improve Android haptic, offer toggle for haptics in the app (#3482)
* improve android haptics, offer toggle for haptics

* update haptics.ts

* default to false

* simplify to `playHaptic`

* just leave them as `feedInfo`

* use a hook for `playHaptic`

* missed one of them
Diffstat (limited to 'src/screens/Profile/Header/ProfileHeaderLabeler.tsx')
-rw-r--r--src/screens/Profile/Header/ProfileHeaderLabeler.tsx7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/screens/Profile/Header/ProfileHeaderLabeler.tsx b/src/screens/Profile/Header/ProfileHeaderLabeler.tsx
index 4d8dbad86..d0fd5e20b 100644
--- a/src/screens/Profile/Header/ProfileHeaderLabeler.tsx
+++ b/src/screens/Profile/Header/ProfileHeaderLabeler.tsx
@@ -10,7 +10,6 @@ import {
 import {msg, Trans} from '@lingui/macro'
 import {useLingui} from '@lingui/react'
 
-import {Haptics} from '#/lib/haptics'
 import {isAppLabeler} from '#/lib/moderation'
 import {pluralize} from '#/lib/strings/helpers'
 import {logger} from '#/logger'
@@ -21,6 +20,7 @@ import {useLikeMutation, useUnlikeMutation} from '#/state/queries/like'
 import {usePreferencesQuery} from '#/state/queries/preferences'
 import {useSession} from '#/state/session'
 import {useAnalytics} from 'lib/analytics/analytics'
+import {useHaptics} from 'lib/haptics'
 import {useProfileShadow} from 'state/cache/profile-shadow'
 import {ProfileMenu} from '#/view/com/profile/ProfileMenu'
 import * as Toast from '#/view/com/util/Toast'
@@ -64,6 +64,7 @@ let ProfileHeaderLabeler = ({
   const {currentAccount, hasSession} = useSession()
   const {openModal} = useModalControls()
   const {track} = useAnalytics()
+  const playHaptic = useHaptics()
   const cantSubscribePrompt = Prompt.usePromptControl()
   const isSelf = currentAccount?.did === profile.did
 
@@ -93,7 +94,7 @@ let ProfileHeaderLabeler = ({
       return
     }
     try {
-      Haptics.default()
+      playHaptic()
 
       if (likeUri) {
         await unlikeMod({uri: likeUri})
@@ -114,7 +115,7 @@ let ProfileHeaderLabeler = ({
       )
       logger.error(`Failed to toggle labeler like`, {message: e.message})
     }
-  }, [labeler, likeUri, likeMod, unlikeMod, track, _])
+  }, [labeler, playHaptic, likeUri, unlikeMod, track, likeMod, _])
 
   const onPressEditProfile = React.useCallback(() => {
     track('ProfileHeader:EditProfileButtonClicked')