play haptic on like
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import React, {useCallback, useMemo, useRef, useState} from 'react'
|
import {useCallback, useEffect, useMemo, useRef, useState} from 'react'
|
||||||
import {
|
import {
|
||||||
LayoutAnimation,
|
LayoutAnimation,
|
||||||
ListRenderItem,
|
ListRenderItem,
|
||||||
@@ -45,6 +45,7 @@ import {
|
|||||||
import {NativeStackScreenProps} from '@react-navigation/native-stack'
|
import {NativeStackScreenProps} from '@react-navigation/native-stack'
|
||||||
|
|
||||||
import {HITSLOP_20} from '#/lib/constants'
|
import {HITSLOP_20} from '#/lib/constants'
|
||||||
|
import {useHaptics} from '#/lib/haptics'
|
||||||
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
|
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
|
||||||
import {CommonNavigatorParams, NavigationProp} from '#/lib/routes/types'
|
import {CommonNavigatorParams, NavigationProp} from '#/lib/routes/types'
|
||||||
import {sanitizeDisplayName} from '#/lib/strings/display-names'
|
import {sanitizeDisplayName} from '#/lib/strings/display-names'
|
||||||
@@ -173,7 +174,7 @@ function Feed() {
|
|||||||
const {data, error, hasNextPage, isFetchingNextPage, fetchNextPage} =
|
const {data, error, hasNextPage, isFetchingNextPage, fetchNextPage} =
|
||||||
usePostFeedQuery(feedDesc)
|
usePostFeedQuery(feedDesc)
|
||||||
|
|
||||||
const videos = React.useMemo(() => {
|
const videos = useMemo(() => {
|
||||||
let vids =
|
let vids =
|
||||||
data?.pages
|
data?.pages
|
||||||
.flatMap(page => page.slices.flatMap(slice => slice.items))
|
.flatMap(page => page.slices.flatMap(slice => slice.items))
|
||||||
@@ -406,7 +407,7 @@ function VideoItem({
|
|||||||
const {width, height} = useSafeAreaFrame()
|
const {width, height} = useSafeAreaFrame()
|
||||||
const {onItemSeen} = useFeedFeedbackContext()
|
const {onItemSeen} = useFeedFeedbackContext()
|
||||||
|
|
||||||
React.useEffect(() => {
|
useEffect(() => {
|
||||||
let to: NodeJS.Timeout | null = null
|
let to: NodeJS.Timeout | null = null
|
||||||
if (active) {
|
if (active) {
|
||||||
to = setTimeout(() => {
|
to = setTimeout(() => {
|
||||||
@@ -733,6 +734,7 @@ function PlayPauseTapArea({
|
|||||||
post: Shadow<AppBskyFeedDefs.PostView>
|
post: Shadow<AppBskyFeedDefs.PostView>
|
||||||
}) {
|
}) {
|
||||||
const doubleTapRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
const doubleTapRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
||||||
|
const playHaptic = useHaptics()
|
||||||
const [queueLike] = usePostLikeMutationQueue(post, 'ImmersiveVideo')
|
const [queueLike] = usePostLikeMutationQueue(post, 'ImmersiveVideo')
|
||||||
|
|
||||||
const {sendInteraction} = useFeedFeedbackContext()
|
const {sendInteraction} = useFeedFeedbackContext()
|
||||||
@@ -751,6 +753,7 @@ function PlayPauseTapArea({
|
|||||||
if (doubleTapRef.current) {
|
if (doubleTapRef.current) {
|
||||||
clearTimeout(doubleTapRef.current)
|
clearTimeout(doubleTapRef.current)
|
||||||
doubleTapRef.current = null
|
doubleTapRef.current = null
|
||||||
|
playHaptic('Light')
|
||||||
queueLike()
|
queueLike()
|
||||||
sendInteraction({
|
sendInteraction({
|
||||||
item: post.uri,
|
item: post.uri,
|
||||||
|
|||||||
Reference in New Issue
Block a user