keep it simple, use playerUri for images too

This commit is contained in:
Hailey
2023-12-27 18:34:12 -08:00
parent 262c4d60cb
commit 5f32d0d65a
2 changed files with 27 additions and 27 deletions
+17 -17
View File
@@ -580,85 +580,85 @@ describe('parseEmbedPlayerFromUrl', () => {
{
type: 'giphy_gif',
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
},
undefined,
undefined,
{
type: 'giphy_gif',
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
},
{
type: 'giphy_gif',
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
},
{
type: 'giphy_gif',
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
},
{
type: 'giphy_gif',
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
},
{
type: 'giphy_gif',
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
},
{
type: 'giphy_gif',
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
},
undefined,
undefined,
{
type: 'giphy_gif',
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
},
{
type: 'giphy_gif',
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
},
{
type: 'giphy_gif',
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
},
{
type: 'giphy_gif',
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
},
{
type: 'giphy_gif',
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
},
{
type: 'tenor_gif',
imageUri: 'https://media1.tenor.com/m/gifId/someName.gif',
playerUri: 'https://media1.tenor.com/m/gifId/someName.gif',
},
undefined,
undefined,
{
type: 'tenor_gif',
imageUri: 'https://tenor.com/view/gifId.gif',
playerUri: 'https://tenor.com/view/gifId.gif',
},
undefined,
undefined,
{
type: 'tenor_gif',
imageUri: 'https://tenor.com/view/gifId.gif',
playerUri: 'https://tenor.com/view/gifId.gif',
},
{
type: 'tenor_gif',
imageUri: 'https://c.tenor.com/gifId/tenor.gif',
playerUri: 'https://c.tenor.com/gifId/tenor.gif',
},
{
type: 'tenor_gif',
imageUri: 'https://c.tenor.com/gifId/tenor.webp',
playerUri: 'https://c.tenor.com/gifId/tenor.webp',
},
undefined,
]
+10 -10
View File
@@ -16,8 +16,8 @@ export type EmbedPlayerParams =
| {type: 'apple_music_album'; albumId: string; playerUri: string}
| {type: 'apple_music_song'; songId: string; playerUri: string}
| {type: 'vimeo_video'; videoId: string; playerUri: string}
| {type: 'giphy_gif'; imageUri: string}
| {type: 'tenor_gif'; imageUri: string}
| {type: 'giphy_gif'; playerUri: string}
| {type: 'tenor_gif'; playerUri: string}
export function parseEmbedPlayerFromUrl(
url: string,
@@ -188,7 +188,7 @@ export function parseEmbedPlayerFromUrl(
if (id) {
return {
type: 'giphy_gif',
imageUri: `https://i.giphy.com/media/${id}/giphy.gif`,
playerUri: `https://i.giphy.com/media/${id}/giphy.gif`,
}
}
}
@@ -205,12 +205,12 @@ export function parseEmbedPlayerFromUrl(
if (idOrFilename === 'giphy.gif' || idOrFilename === 'giphy.gif') {
return {
type: 'giphy_gif',
imageUri: `https://i.giphy.com/media/${trackingOrId}/giphy.gif`,
playerUri: `https://i.giphy.com/media/${trackingOrId}/giphy.gif`,
}
} else if (filename === 'giphy.gif' || filename === 'giphy.gif') {
return {
type: 'giphy_gif',
imageUri: `https://i.giphy.com/media/${idOrFilename}/giphy.gif`,
playerUri: `https://i.giphy.com/media/${idOrFilename}/giphy.gif`,
}
}
}
@@ -224,14 +224,14 @@ export function parseEmbedPlayerFromUrl(
if (mediaOrFilename === 'media' && filename) {
return {
type: 'giphy_gif',
imageUri: `https://i.giphy.com/media/${
playerUri: `https://i.giphy.com/media/${
filename.split('.')[0]
}/giphy.gif`,
}
} else if (mediaOrFilename) {
return {
type: 'giphy_gif',
imageUri: `https://i.giphy.com/media/${
playerUri: `https://i.giphy.com/media/${
mediaOrFilename.split('.')[0]
}/giphy.gif`,
}
@@ -245,7 +245,7 @@ export function parseEmbedPlayerFromUrl(
if (parts.length === 4 && filename?.split('.').pop() === 'gif') {
return {
type: 'tenor_gif',
imageUri: url,
playerUri: url,
}
}
}
@@ -258,7 +258,7 @@ export function parseEmbedPlayerFromUrl(
return {
type: 'tenor_gif',
imageUri: `${url}${!includesExt ? '.gif' : ''}`,
playerUri: `${url}${!includesExt ? '.gif' : ''}`,
}
}
}
@@ -272,7 +272,7 @@ export function parseEmbedPlayerFromUrl(
if (ext === 'gif' || ext === 'webp') {
return {
type: 'tenor_gif',
imageUri: url,
playerUri: url,
}
}
}