Fix external card long press on web (#10739)

This commit is contained in:
Samuel Newman
2026-06-06 00:04:21 +03:00
committed by GitHub
parent b236f274c3
commit fb8316fd85
3 changed files with 47 additions and 44 deletions
-5
View File
@@ -261,11 +261,6 @@
"count": 1 "count": 1
} }
}, },
"src/components/Post/Embed/StandardSiteEmbed/index.tsx": {
"@typescript-eslint/no-floating-promises": {
"count": 3
}
},
"src/components/Post/Embed/VideoEmbed/VideoEmbedInner/VideoEmbedInnerWeb.tsx": { "src/components/Post/Embed/VideoEmbed/VideoEmbedInner/VideoEmbedInnerWeb.tsx": {
"@typescript-eslint/no-floating-promises": { "@typescript-eslint/no-floating-promises": {
"count": 2 "count": 2
@@ -1,4 +1,4 @@
import {useCallback, useMemo} from 'react' import {useMemo} from 'react'
import {type StyleProp, View, type ViewStyle} from 'react-native' import {type StyleProp, View, type ViewStyle} from 'react-native'
import {Image} from 'expo-image' import {Image} from 'expo-image'
import {type AppBskyEmbedExternal} from '@atproto/api' import {type AppBskyEmbedExternal} from '@atproto/api'
@@ -51,17 +51,19 @@ export const ExternalEmbed = ({
}, [link.uri, externalEmbedPrefs]) }, [link.uri, externalEmbedPrefs])
const hasMedia = Boolean(imageUri || embedPlayerParams) const hasMedia = Boolean(imageUri || embedPlayerParams)
const onPress = useCallback(() => { const onPress = () => {
playHaptic('Light') playHaptic('Light')
onOpen?.() onOpen?.()
}, [playHaptic, onOpen]) }
const onShareExternal = useCallback(() => { const onShareExternal = IS_NATIVE
if (link.uri && IS_NATIVE) { ? () => {
playHaptic('Heavy') if (link.uri) {
void shareUrl(link.uri) playHaptic('Heavy')
} void shareUrl(link.uri)
}, [link.uri, playHaptic]) }
}
: undefined
if ( if (
embedPlayerParams?.source === 'tenor' || embedPlayerParams?.source === 'tenor' ||
@@ -79,13 +79,15 @@ export const StandardSiteEmbed = ({
onEmbedInteractionCallback?.() onEmbedInteractionCallback?.()
ax.metric('embed:standardSite:article:press', {url: view.uri}) ax.metric('embed:standardSite:article:press', {url: view.uri})
} }
const onLongPress = () => { const onLongPress = IS_NATIVE
if (view.uri && IS_NATIVE) { ? () => {
playHaptic('Heavy') if (view.uri) {
shareUrl(view.uri) playHaptic('Heavy')
ax.metric('embed:standardSite:article:longPress', {url: view.uri}) void shareUrl(view.uri)
} ax.metric('embed:standardSite:article:longPress', {url: view.uri})
} }
}
: undefined
const onPressPublication = () => { const onPressPublication = () => {
playHaptic('Light') playHaptic('Light')
onEmbedInteractionCallback?.() onEmbedInteractionCallback?.()
@@ -93,15 +95,17 @@ export const StandardSiteEmbed = ({
url: view.source?.uri || '', url: view.source?.uri || '',
}) })
} }
const onLongPressPublication = () => { const onLongPressPublication = IS_NATIVE
if (view.source?.uri && IS_NATIVE) { ? () => {
playHaptic('Heavy') if (view.source?.uri) {
shareUrl(view.source.uri) playHaptic('Heavy')
ax.metric('embed:standardSite:publication:longPress', { void shareUrl(view.source.uri)
url: view.source.uri, ax.metric('embed:standardSite:publication:longPress', {
}) url: view.source.uri,
} })
} }
}
: undefined
if (isStandardPublication) { if (isStandardPublication) {
return ( return (
@@ -465,21 +469,23 @@ export function SubscribeButton({
} }
} }
const onLongPress = () => { const onLongPress = IS_NATIVE
if (view.source?.uri && IS_NATIVE) { ? () => {
playHaptic('Heavy') if (view.source?.uri) {
shareUrl(view.source.uri) playHaptic('Heavy')
if (highlightedPublisher) { void shareUrl(view.source.uri)
ax.metric('embed:standardSite:subscribe:longPress', { if (highlightedPublisher) {
url: view.source?.uri || '', ax.metric('embed:standardSite:subscribe:longPress', {
}) url: view.source?.uri || '',
} else { })
ax.metric('embed:standardSite:publicationCta:longPress', { } else {
url: view.source?.uri || '', ax.metric('embed:standardSite:publicationCta:longPress', {
}) url: view.source?.uri || '',
})
}
}
} }
} : undefined
}
const button = ( const button = (
<Link <Link