play haptics before closing modal (#4283)

This commit is contained in:
Samuel Newman 2024-05-30 15:46:26 +03:00 committed by GitHub
parent b077cbe399
commit 16925baf8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 12 deletions

View file

@ -23,7 +23,6 @@ import {toShareUrl} from '#/lib/strings/url-helpers'
import {s} from '#/lib/styles'
import {Shadow} from '#/state/cache/types'
import {useFeedFeedbackContext} from '#/state/feed-feedback'
import {useModalControls} from '#/state/modals'
import {
usePostLikeMutationQueue,
usePostRepostMutationQueue,
@ -65,7 +64,6 @@ let PostCtrls = ({
const t = useTheme()
const {_} = useLingui()
const {openComposer} = useComposerControls()
const {closeModal} = useModalControls()
const [queueLike, queueUnlike] = usePostLikeMutationQueue(post, logContext)
const [queueRepost, queueUnrepost] = usePostRepostMutationQueue(
post,
@ -118,10 +116,8 @@ let PostCtrls = ({
])
const onRepost = useCallback(async () => {
closeModal()
try {
if (!post.viewer?.repost) {
playHaptic()
sendInteraction({
item: post.uri,
event: 'app.bsky.feed.defs#interactionRepost',
@ -137,10 +133,8 @@ let PostCtrls = ({
}
}
}, [
closeModal,
post.uri,
post.viewer?.repost,
playHaptic,
queueRepost,
queueUnrepost,
sendInteraction,
@ -148,7 +142,6 @@ let PostCtrls = ({
])
const onQuote = useCallback(() => {
closeModal()
sendInteraction({
item: post.uri,
event: 'app.bsky.feed.defs#interactionQuote',
@ -163,16 +156,13 @@ let PostCtrls = ({
indexedAt: post.indexedAt,
},
})
playHaptic()
}, [
closeModal,
openComposer,
post.uri,
post.cid,
post.author,
post.indexedAt,
record.text,
playHaptic,
sendInteraction,
feedContext,
])