From 52136f47c5b5a0701d8d44c7b606e42941b4d787 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Thu, 14 Aug 2025 11:22:45 +0300 Subject: [PATCH] allow gifs on native, just treat as images --- src/lib/media/video/compress.ts | 6 +++--- src/view/com/composer/SelectMediaButton.tsx | 13 +------------ src/view/com/composer/photos/ImageAltTextDialog.tsx | 5 ++--- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/lib/media/video/compress.ts b/src/lib/media/video/compress.ts index c2d1470c63..ae6eeae3aa 100644 --- a/src/lib/media/video/compress.ts +++ b/src/lib/media/video/compress.ts @@ -1,8 +1,8 @@ import {getVideoMetaData, Video} from 'react-native-compressor' -import {ImagePickerAsset} from 'expo-image-picker' +import {type ImagePickerAsset} from 'expo-image-picker' -import {SUPPORTED_MIME_TYPES, SupportedMimeTypes} from '#/lib/constants' -import {CompressedVideo} from './types' +import {SUPPORTED_MIME_TYPES, type SupportedMimeTypes} from '#/lib/constants' +import {type CompressedVideo} from './types' import {extToMime} from './util' const MIN_SIZE_FOR_COMPRESSION = 25 // 25mb diff --git a/src/view/com/composer/SelectMediaButton.tsx b/src/view/com/composer/SelectMediaButton.tsx index a742f1fe66..7cd140ab72 100644 --- a/src/view/com/composer/SelectMediaButton.tsx +++ b/src/view/com/composer/SelectMediaButton.tsx @@ -60,7 +60,6 @@ enum SelectedAssetError { MaxVideos = 'MaxVideos', VideoTooLong = 'VideoTooLong', MaxGIFs = 'MaxGIFs', - NoGifsOnNative = 'NoGifsOnNative', } /** @@ -177,7 +176,7 @@ function classifyImagePickerAsset(asset: ImagePickerAsset): * Distill this down into a type "class". */ let type: AssetType | undefined - if (mimeType === 'image/gif') { + if (isWeb && mimeType === 'image/gif') { type = 'gif' } else if (mimeType?.startsWith('video/')) { type = 'video' @@ -292,13 +291,6 @@ async function processImagePickerAssets( } } - if (type === 'gif') { - if (isNative) { - errors.add(SelectedAssetError.NoGifsOnNative) - continue - } - } - /* * All validations passed, we have an asset! */ @@ -413,9 +405,6 @@ export function SelectMediaButton({ [SelectedAssetError.MaxGIFs]: _( msg`You can only select one GIF at a time.`, ), - [SelectedAssetError.NoGifsOnNative]: _( - msg`GIFs are only supported on web at this time.`, - ), }[error] }) diff --git a/src/view/com/composer/photos/ImageAltTextDialog.tsx b/src/view/com/composer/photos/ImageAltTextDialog.tsx index 724149937c..b356cde9b7 100644 --- a/src/view/com/composer/photos/ImageAltTextDialog.tsx +++ b/src/view/com/composer/photos/ImageAltTextDialog.tsx @@ -96,13 +96,12 @@ const ImageAltTextInner = ({