fix: download gif files (#5445)
* fix: download gif files * add test for gif extension * fix the gif animations at android devices * remove the space Co-authored-by: atulsingh98 <atulsingh.17is@saividya.ac.in>
This commit is contained in:
parent
86a9f4f890
commit
2dc52b26b6
|
@ -380,6 +380,7 @@ dependencies {
|
|||
androidTestImplementation('com.wix:detox:+')
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'com.facebook.soloader:soloader:0.10.4'
|
||||
implementation 'com.facebook.fresco:animated-gif:2.5.0'
|
||||
}
|
||||
|
||||
if (isNewArchitectureEnabled()) {
|
||||
|
|
|
@ -55,4 +55,15 @@ describe('Test the getFilename', () => {
|
|||
const filename = getFilename({ type: 'image', mimeType: image_type, title, url: image_url });
|
||||
expect(filename).toBe('help-image-url.png');
|
||||
});
|
||||
|
||||
it('returns the filename with the gif extension from a gif sent by tenor/giphy', () => {
|
||||
const { image_type, image_url, title } = {
|
||||
title: undefined,
|
||||
image_url: 'https://media4.giphy.com/media/bGtO3RlAPHkeQ/giphy.gif',
|
||||
image_type: undefined
|
||||
};
|
||||
|
||||
const filename = getFilename({ type: 'image', mimeType: image_type, title, url: image_url });
|
||||
expect(filename).toBe('giphy.gif');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -68,6 +68,10 @@ export const getFilename = ({
|
|||
};
|
||||
|
||||
const getExtension = (type: MediaTypes, mimeType?: string, url?: string) => {
|
||||
// support url with gif extension and mimetype undefined, ex.: using the app tenor and giphy.
|
||||
if (url?.split('.').pop() === 'gif') {
|
||||
return 'gif';
|
||||
}
|
||||
if (!mimeType) {
|
||||
return defaultType[type];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue