aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/components/moments/MomentPost.tsx4
-rw-r--r--src/screens/moments/CameraScreen.tsx16
-rw-r--r--src/utils/camera.ts29
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.',
+ ),
+ },
+ );