Use new util

This commit is contained in:
Eric Bailey
2025-01-07 10:32:34 -06:00
parent 31ae18591c
commit 1c8b9899bd
+4 -11
View File
@@ -4,7 +4,7 @@ import {Image} from 'expo-image'
import {AppBskyFeedDefs} from '@atproto/api' import {AppBskyFeedDefs} from '@atproto/api'
import {Trans} from '@lingui/macro' import {Trans} from '@lingui/macro'
import {parseTenorGif} from '#/lib/strings/embed-player' import {isTenorGifUri} from '#/lib/strings/embed-player'
import {atoms as a, useTheme} from '#/alf' import {atoms as a, useTheme} from '#/alf'
import {MediaInsetBorder} from '#/components/MediaInsetBorder' import {MediaInsetBorder} from '#/components/MediaInsetBorder'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
@@ -37,14 +37,9 @@ export function Embed({
))} ))}
</Outer> </Outer>
) )
} else if (e.type === 'link' && e.view.external.thumb) { } else if (e.type === 'link') {
let url: URL | undefined if (!e.view.external.thumb) return null
try { if (!isTenorGifUri(e.view.external.uri)) return null
url = new URL(e.view.external.uri)
} catch {}
if (url) {
const {success} = parseTenorGif(url)
if (success) {
return ( return (
<Outer style={style}> <Outer style={style}>
<GifItem <GifItem
@@ -53,8 +48,6 @@ export function Embed({
/> />
</Outer> </Outer>
) )
}
}
} else if (e.type === 'video') { } else if (e.type === 'video') {
return ( return (
<Outer style={style}> <Outer style={style}>