diff options
author | Ivan Chen <ivan@tagg.id> | 2021-06-30 15:57:55 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-06-30 15:57:55 -0400 |
commit | 9eb246e92aad427ac4d12840960f0be531f43d19 (patch) | |
tree | 70e24d0a72a3a006adf2e456ff19ce090dc7ebd5 /src | |
parent | 919a7c14633f0a381613cebf73e8f29d84d3ebe2 (diff) |
Squashed commit of the following:
commit 7046c2673c54ecf2f418a85fbcfc2c4872858697
Merge: 5480267b c6900bc6
Author: Ivan Chen <ivan@tagg.id>
Date: Wed Jun 30 15:16:02 2021 -0400
Merge pull request #479 from brian-tagg/tma959-gif-handle
[TMA-959] GIF handle
commit c6900bc62b2ea9a1eb07088ac02556c0dd1d5ebc
Author: Brian Kim <brian@tagg.id>
Date: Thu Jul 1 04:00:53 2021 +0900
Redo extraneous file
commit 4eda8db632ca996ff9712872b2076a8675a63523
Author: Brian Kim <brian@tagg.id>
Date: Thu Jul 1 03:52:50 2021 +0900
Updates from product
commit 1c1975265fb6013c34c8e766a7f11b0c5b8d1e11
Author: Brian Kim <brian@tagg.id>
Date: Thu Jul 1 01:23:19 2021 +0900
Respond to comments
commit 50344b4236e235fdd42997c1fe85f2c1bd014e47
Author: Brian Kim <brian@tagg.id>
Date: Tue Jun 29 23:04:22 2021 +0900
Fixed up some merge issues
commit 014af4ac61bae6e38a4965ceb274b147ac3395c6
Author: Brian Kim <brian@tagg.id>
Date: Tue Jun 29 23:01:24 2021 +0900
Construct and merge with master
Diffstat (limited to 'src')
-rw-r--r-- | src/components/moments/MomentPost.tsx | 4 | ||||
-rw-r--r-- | src/screens/moments/CameraScreen.tsx | 16 | ||||
-rw-r--r-- | src/utils/camera.ts | 29 |
3 files changed, 43 insertions, 6 deletions
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') ); /* diff --git a/src/screens/moments/CameraScreen.tsx b/src/screens/moments/CameraScreen.tsx index 7b71f9e5..4ca79c4f 100644 --- a/src/screens/moments/CameraScreen.tsx +++ b/src/screens/moments/CameraScreen.tsx @@ -16,7 +16,11 @@ import { } from '../../components'; import {MainStackParams} from '../../routes'; import {HeaderHeight, normalize, SCREEN_WIDTH} from '../../utils'; -import {navigateToImagePicker, takePicture} from '../../utils/camera'; +import { + navigateToImagePicker, + showGIFFailureAlert, + takePicture, +} from '../../utils/camera'; type CameraScreenRouteProps = RouteProp<MainStackParams, 'CameraScreen'>; export type CameraScreenNavigationProps = StackNavigationProp< @@ -146,7 +150,15 @@ const CameraScreen: React.FC<CameraScreenProps> = ({route, navigation}) => { mostRecentPhotoUri={mostRecentPhoto} callback={() => navigateToImagePicker((pic) => { - navigateToCropper(pic.path); + const filename = pic.filename; + if ( + filename && + (filename.endsWith('gif') || filename.endsWith('GIF')) + ) { + showGIFFailureAlert(() => navigateToCropper(pic.path)); + } else { + navigateToCropper(pic.path); + } }) } /> diff --git a/src/utils/camera.ts b/src/utils/camera.ts index e5eba5f8..0be4d27c 100644 --- a/src/utils/camera.ts +++ b/src/utils/camera.ts @@ -48,9 +48,7 @@ export const navigateToImagePicker = (callback: (pic: Image) => void) => { mediaType: 'photo', }) .then((pic) => { - if (pic.path && pic.filename) { - callback(pic); - } + callback(pic); }) .catch((err) => { if (err.code && err.code !== 'E_PICKER_CANCELLED') { @@ -81,3 +79,28 @@ export const navigateToVideoPicker = (callback: (vid: Video) => void) => { } }); }; + +export const showGIFFailureAlert = (onSuccess: () => void) => + Alert.alert( + 'Warning', + 'The app currently cannot handle GIFs, and will only save a static image.', + [ + { + text: 'Cancel', + onPress: () => {}, + style: 'cancel', + }, + { + text: 'Post', + onPress: onSuccess, + style: 'default', + }, + ], + { + cancelable: true, + onDismiss: () => + Alert.alert( + 'This alert was dismissed by tapping outside of the alert dialog.', + ), + }, + ); |