Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

haptics on external link card (#8049)

authored by

Samuel Newman and committed by
GitHub
7daf7a70 6fcf9797

+12 -4
+12 -4
src/view/com/util/post-embeds/ExternalLinkEmbed.tsx
··· 1 1 import React, {useCallback} from 'react' 2 - import {StyleProp, View, ViewStyle} from 'react-native' 2 + import {type StyleProp, View, type ViewStyle} from 'react-native' 3 3 import {Image} from 'expo-image' 4 - import {AppBskyEmbedExternal} from '@atproto/api' 4 + import {type AppBskyEmbedExternal} from '@atproto/api' 5 5 import {msg} from '@lingui/macro' 6 6 import {useLingui} from '@lingui/react' 7 7 8 8 import {parseAltFromGIFDescription} from '#/lib/gif-alt-text' 9 + import {useHaptics} from '#/lib/haptics' 9 10 import {shareUrl} from '#/lib/sharing' 10 11 import {parseEmbedPlayerFromUrl} from '#/lib/strings/embed-player' 11 12 import {toNiceDomain} from '#/lib/strings/url-helpers' ··· 33 34 }) => { 34 35 const {_} = useLingui() 35 36 const t = useTheme() 37 + const playHaptic = useHaptics() 36 38 const externalEmbedPrefs = useExternalEmbedsPrefs() 37 39 const niceUrl = toNiceDomain(link.uri) 38 40 const imageUri = link.thumb ··· 45 47 }, [link.uri, externalEmbedPrefs]) 46 48 const hasMedia = Boolean(imageUri || embedPlayerParams) 47 49 50 + const onPress = useCallback(() => { 51 + playHaptic('Light') 52 + onOpen?.() 53 + }, [playHaptic, onOpen]) 54 + 48 55 const onShareExternal = useCallback(() => { 49 56 if (link.uri && isNative) { 57 + playHaptic('Heavy') 50 58 shareUrl(link.uri) 51 59 } 52 - }, [link.uri]) 60 + }, [link.uri, playHaptic]) 53 61 54 62 if (embedPlayerParams?.source === 'tenor') { 55 63 const parsedAlt = parseAltFromGIFDescription(link.description) ··· 71 79 label={link.title || _(msg`Open link to ${niceUrl}`)} 72 80 to={link.uri} 73 81 shouldProxy={true} 74 - onPress={onOpen} 82 + onPress={onPress} 75 83 onLongPress={onShareExternal}> 76 84 {({hovered}) => ( 77 85 <View