58f532a495
* delete media from existsCache when deleting * revoke media URLs * skip revoking objecturls until the composer is completely closed * [Drafts] Metrics (#9794) * metrics for drafts * Nit: format * nit: use new util for clarity * nit: use new util for clarity --------- Co-authored-by: Eric Bailey <git@esb.lol> --------- Co-authored-by: Eric Bailey <git@esb.lol>
38 lines
1005 B
TypeScript
38 lines
1005 B
TypeScript
import {clearCache, createVideoThumbnail} from 'react-native-compressor'
|
|
import Animated, {FadeIn} from 'react-native-reanimated'
|
|
import {Image} from 'expo-image'
|
|
import {type QueryClient, useQuery} from '@tanstack/react-query'
|
|
|
|
import {atoms as a} from '#/alf'
|
|
|
|
export const RQKEY = 'video-thumbnail'
|
|
|
|
export function clearThumbnailCache(queryClient: QueryClient) {
|
|
clearCache().catch(() => {})
|
|
void queryClient.resetQueries({queryKey: [RQKEY]})
|
|
}
|
|
|
|
export function VideoTranscodeBackdrop({uri}: {uri: string}) {
|
|
const {data: thumbnail} = useQuery({
|
|
queryKey: [RQKEY, uri],
|
|
queryFn: async () => {
|
|
return await createVideoThumbnail(uri)
|
|
},
|
|
})
|
|
|
|
return (
|
|
thumbnail && (
|
|
<Animated.View style={a.flex_1} entering={FadeIn}>
|
|
<Image
|
|
style={a.flex_1}
|
|
source={thumbnail.path}
|
|
cachePolicy="none"
|
|
accessibilityIgnoresInvertColors
|
|
blurRadius={15}
|
|
contentFit="cover"
|
|
/>
|
|
</Animated.View>
|
|
)
|
|
)
|
|
}
|