diff options
author | Ivan Chen <ivan@tagg.id> | 2021-06-30 15:16:02 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-30 15:16:02 -0400 |
commit | 7046c2673c54ecf2f418a85fbcfc2c4872858697 (patch) | |
tree | 68879b4429fbe2736020994d16d716c8a847463c /src | |
parent | 5480267b285812c094246bb941c6deaf83f53ff5 (diff) | |
parent | c6900bc62b2ea9a1eb07088ac02556c0dd1d5ebc (diff) |
Merge pull request #479 from brian-tagg/tma959-gif-handle
[TMA-959] GIF handle
Diffstat (limited to 'src')
-rw-r--r-- | src/components/moments/Moment.tsx | 44 | ||||
-rw-r--r-- | src/components/moments/MomentPost.tsx | 4 |
2 files changed, 46 insertions, 2 deletions
diff --git a/src/components/moments/Moment.tsx b/src/components/moments/Moment.tsx index a43a2830..ec9129c5 100644 --- a/src/components/moments/Moment.tsx +++ b/src/components/moments/Moment.tsx @@ -91,7 +91,13 @@ const Moment: React.FC<MomentProps> = ({ mediaType: 'any', }) .then((picture) => { - if (picture.path && picture.filename) { + if ( + picture.path && + picture.filename && + (picture.filename.endsWith('gif') || picture.filename.endsWith('GIF')) + ) { + showGIFFailureAlert(picture); + } else if (picture.path && picture.filename) { navigation.navigate('ZoomInCropper', { screenType, title, @@ -110,6 +116,42 @@ const Moment: React.FC<MomentProps> = ({ }); }; + /* Handles GIF files */ + const showGIFFailureAlert = (picture) => + Alert.alert( + 'Warning', + 'The app currently cannot handle GIFs, and will only save a static image.', + [ + { + text: 'Cancel', + onPress: () => {}, + style: 'cancel', + }, + { + text: 'Post', + onPress: () => { + navigation.navigate('ZoomInCropper', { + screenType, + title, + media: { + filename: picture.filename, + uri: picture.path, + isVideo: false, + }, + }); + }, + style: 'default', + }, + ], + { + cancelable: true, + onDismiss: () => + Alert.alert( + 'This alert was dismissed by tapping outside of the alert dialog.', + ), + }, + ); + return ( <View style={[styles.container, externalStyles?.container]}> <View style={[styles.header, externalStyles?.header]}> diff --git a/src/components/moments/MomentPost.tsx b/src/components/moments/MomentPost.tsx index cb3a138b..f5a256d6 100644 --- a/src/components/moments/MomentPost.tsx +++ b/src/components/moments/MomentPost.tsx @@ -78,7 +78,9 @@ const MomentPost: React.FC<MomentPostProps> = ({ moment.moment_url.endsWith('jpg') || moment.moment_url.endsWith('JPG') || moment.moment_url.endsWith('PNG') || - moment.moment_url.endsWith('png') + moment.moment_url.endsWith('png') || + moment.moment_url.endsWith('GIF') || + moment.moment_url.endsWith('gif') ); /* |