Use new util

This commit is contained in:
Eric Bailey
2025-01-07 10:32:34 -06:00
parent 31ae18591c
commit 1c8b9899bd
+12 -19
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,24 +37,17 @@ 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) return (
} catch {} <Outer style={style}>
if (url) { <GifItem
const {success} = parseTenorGif(url) thumbnail={e.view.external.thumb}
if (success) { alt={e.view.external.title}
return ( />
<Outer style={style}> </Outer>
<GifItem )
thumbnail={e.view.external.thumb}
alt={e.view.external.title}
/>
</Outer>
)
}
}
} else if (e.type === 'video') { } else if (e.type === 'video') {
return ( return (
<Outer style={style}> <Outer style={style}>