From 404f8b7d78674aa5fc57c83a3b44496785124fee Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Thu, 15 Jul 2021 15:04:14 -0400 Subject: Initial changes --- src/components/comments/ZoomInCropper.tsx | 8 +++++++- src/screens/onboarding/ProfileInfoOnboarding.tsx | 1 + src/screens/onboarding/legacy/ProfileOnboarding.tsx | 2 ++ src/screens/profile/EditProfile.tsx | 2 ++ .../SuggestedPeopleUploadPictureScreen.tsx | 1 + src/utils/camera.ts | 2 ++ src/utils/users.ts | 5 +++++ 7 files changed, 20 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/components/comments/ZoomInCropper.tsx b/src/components/comments/ZoomInCropper.tsx index 6f8ff97c..ab45f46b 100644 --- a/src/components/comments/ZoomInCropper.tsx +++ b/src/components/comments/ZoomInCropper.tsx @@ -13,9 +13,10 @@ import { SCREEN_HEIGHT, SCREEN_WIDTH, } from '../../utils'; -import {TaggSquareButton} from '../common'; +import {TaggSquareButton, TaggLoadingIndicator} from '../common'; import ReactNativeZoomableView from '@dudigital/react-native-zoomable-view/src/ReactNativeZoomableView'; import Video from 'react-native-video'; +import Tagg from '../taggs/Tagg'; type ZoomInCropperRouteProps = RouteProp; type ZoomInCropperNavigationProps = StackNavigationProp< @@ -36,6 +37,7 @@ export const ZoomInCropper: React.FC = ({ // width and height of video, if video const [origDimensions, setOrigDimensions] = useState([0, 0]); const vidRef = useRef(null); + const [cropLoading, setCropLoading] = useState(false); // Stores the coordinates of the cropped image const [x0, setX0] = useState(); @@ -136,9 +138,12 @@ export const ZoomInCropper: React.FC = ({ cropHeight: origDimensions[1], })); } + setCropLoading(true); + console.log(cropLoading); cropVideo( media.uri, (croppedURL: string) => { + setCropLoading(false); navigation.navigate('CaptionScreen', { screenType, media: { @@ -255,6 +260,7 @@ export const ZoomInCropper: React.FC = ({ return ( + {cropLoading && } navigation.goBack()}> diff --git a/src/screens/onboarding/ProfileInfoOnboarding.tsx b/src/screens/onboarding/ProfileInfoOnboarding.tsx index cdfbea8f..1d068a2c 100644 --- a/src/screens/onboarding/ProfileInfoOnboarding.tsx +++ b/src/screens/onboarding/ProfileInfoOnboarding.tsx @@ -108,6 +108,7 @@ const ProfileInfoOnboarding: React.FC = ({ cropperToolbarTitle: 'Select Profile Picture', mediaType: 'photo', cropperCircleOverlay: true, + compressVideoPreset: 'Passthrough', }).then((picture) => { if ('path' in picture) { setForm({ diff --git a/src/screens/onboarding/legacy/ProfileOnboarding.tsx b/src/screens/onboarding/legacy/ProfileOnboarding.tsx index e994c1e6..88e9183f 100644 --- a/src/screens/onboarding/legacy/ProfileOnboarding.tsx +++ b/src/screens/onboarding/legacy/ProfileOnboarding.tsx @@ -167,6 +167,7 @@ const ProfileOnboarding: React.FC = ({ cropping: true, cropperToolbarTitle: 'Select Header', mediaType: 'photo', + compressVideoPreset: 'Passthrough', }).then((picture) => { if ('path' in picture) { setForm({ @@ -192,6 +193,7 @@ const ProfileOnboarding: React.FC = ({ cropperToolbarTitle: 'Select Profile Picture', mediaType: 'photo', cropperCircleOverlay: true, + compressVideoPreset: 'Passthrough', }).then((picture) => { if ('path' in picture) { setForm({ diff --git a/src/screens/profile/EditProfile.tsx b/src/screens/profile/EditProfile.tsx index 20a62b19..fca02ffc 100644 --- a/src/screens/profile/EditProfile.tsx +++ b/src/screens/profile/EditProfile.tsx @@ -161,6 +161,7 @@ const EditProfile: React.FC = ({route, navigation}) => { cropping: true, cropperToolbarTitle: 'Select Header', mediaType: 'photo', + compressVideoPreset: 'Passthrough', }).then((picture) => { if ('path' in picture) { setForm({ @@ -186,6 +187,7 @@ const EditProfile: React.FC = ({route, navigation}) => { cropperToolbarTitle: 'Select Profile Picture', mediaType: 'photo', cropperCircleOverlay: true, + compressVideoPreset: 'Passthrough', }).then((picture) => { if ('path' in picture) { setForm({ diff --git a/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx b/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx index f5a9f280..cdd9cedf 100644 --- a/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx +++ b/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx @@ -78,6 +78,7 @@ const SuggestedPeopleUploadPictureScreen: React.FC { if ('path' in picture) { diff --git a/src/utils/camera.ts b/src/utils/camera.ts index 9e37d62e..6c1b9d50 100644 --- a/src/utils/camera.ts +++ b/src/utils/camera.ts @@ -66,6 +66,7 @@ export const navigateToImagePicker = ( 'UserLibrary', ], mediaType: 'any', + compressVideoPreset: 'Passthrough', }) .then((media) => { callback(media); @@ -80,6 +81,7 @@ export const navigateToImagePicker = ( export const navigateToVideoPicker = (callback: (vid: Video) => void) => { ImagePicker.openPicker({ mediaType: 'video', + compressVideoPreset: 'Passthrough', }) .then(async (vid) => { if (vid.path) { diff --git a/src/utils/users.ts b/src/utils/users.ts index c1c3b8bc..75858fe2 100644 --- a/src/utils/users.ts +++ b/src/utils/users.ts @@ -254,6 +254,7 @@ export const patchProfile = async ( cropping: true, cropperToolbarTitle: screenTitle, mediaType: 'photo', + compressVideoPreset: 'Passthrough', }; break; case 'profile': @@ -274,12 +275,16 @@ export const patchProfile = async ( cropperToolbarTitle: screenTitle, mediaType: 'photo', cropperCircleOverlay: true, + compressVideoPreset: 'Passthrough', }; break; default: screenTitle = ''; requestTitle = ''; fileName = ''; + imageSettings = { + compressVideoPreset: 'Passthrough', + }; } return await ImagePicker.openPicker(imageSettings) -- cgit v1.2.3-70-g09d2 From 82e2ebed641463e31eb304846eafd664368f60b8 Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Thu, 15 Jul 2021 15:23:18 -0400 Subject: Account for lint --- src/components/comments/ZoomInCropper.tsx | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/components/comments/ZoomInCropper.tsx b/src/components/comments/ZoomInCropper.tsx index ab45f46b..77159119 100644 --- a/src/components/comments/ZoomInCropper.tsx +++ b/src/components/comments/ZoomInCropper.tsx @@ -16,7 +16,6 @@ import { import {TaggSquareButton, TaggLoadingIndicator} from '../common'; import ReactNativeZoomableView from '@dudigital/react-native-zoomable-view/src/ReactNativeZoomableView'; import Video from 'react-native-video'; -import Tagg from '../taggs/Tagg'; type ZoomInCropperRouteProps = RouteProp; type ZoomInCropperNavigationProps = StackNavigationProp< -- cgit v1.2.3-70-g09d2 From 44edf83220a50b96fbdc67f505f4117bae6eb235 Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Fri, 16 Jul 2021 14:52:52 -0400 Subject: Clean up code --- src/components/comments/ZoomInCropper.tsx | 1 - src/screens/onboarding/ProfileInfoOnboarding.tsx | 1 - src/screens/onboarding/legacy/ProfileOnboarding.tsx | 2 -- src/screens/profile/EditProfile.tsx | 2 -- .../SuggestedPeopleUploadPictureScreen.tsx | 1 - src/utils/camera.ts | 17 ----------------- src/utils/users.ts | 6 +----- 7 files changed, 1 insertion(+), 29 deletions(-) (limited to 'src') diff --git a/src/components/comments/ZoomInCropper.tsx b/src/components/comments/ZoomInCropper.tsx index 77159119..3581168d 100644 --- a/src/components/comments/ZoomInCropper.tsx +++ b/src/components/comments/ZoomInCropper.tsx @@ -138,7 +138,6 @@ export const ZoomInCropper: React.FC = ({ })); } setCropLoading(true); - console.log(cropLoading); cropVideo( media.uri, (croppedURL: string) => { diff --git a/src/screens/onboarding/ProfileInfoOnboarding.tsx b/src/screens/onboarding/ProfileInfoOnboarding.tsx index 1d068a2c..cdfbea8f 100644 --- a/src/screens/onboarding/ProfileInfoOnboarding.tsx +++ b/src/screens/onboarding/ProfileInfoOnboarding.tsx @@ -108,7 +108,6 @@ const ProfileInfoOnboarding: React.FC = ({ cropperToolbarTitle: 'Select Profile Picture', mediaType: 'photo', cropperCircleOverlay: true, - compressVideoPreset: 'Passthrough', }).then((picture) => { if ('path' in picture) { setForm({ diff --git a/src/screens/onboarding/legacy/ProfileOnboarding.tsx b/src/screens/onboarding/legacy/ProfileOnboarding.tsx index 88e9183f..e994c1e6 100644 --- a/src/screens/onboarding/legacy/ProfileOnboarding.tsx +++ b/src/screens/onboarding/legacy/ProfileOnboarding.tsx @@ -167,7 +167,6 @@ const ProfileOnboarding: React.FC = ({ cropping: true, cropperToolbarTitle: 'Select Header', mediaType: 'photo', - compressVideoPreset: 'Passthrough', }).then((picture) => { if ('path' in picture) { setForm({ @@ -193,7 +192,6 @@ const ProfileOnboarding: React.FC = ({ cropperToolbarTitle: 'Select Profile Picture', mediaType: 'photo', cropperCircleOverlay: true, - compressVideoPreset: 'Passthrough', }).then((picture) => { if ('path' in picture) { setForm({ diff --git a/src/screens/profile/EditProfile.tsx b/src/screens/profile/EditProfile.tsx index fca02ffc..20a62b19 100644 --- a/src/screens/profile/EditProfile.tsx +++ b/src/screens/profile/EditProfile.tsx @@ -161,7 +161,6 @@ const EditProfile: React.FC = ({route, navigation}) => { cropping: true, cropperToolbarTitle: 'Select Header', mediaType: 'photo', - compressVideoPreset: 'Passthrough', }).then((picture) => { if ('path' in picture) { setForm({ @@ -187,7 +186,6 @@ const EditProfile: React.FC = ({route, navigation}) => { cropperToolbarTitle: 'Select Profile Picture', mediaType: 'photo', cropperCircleOverlay: true, - compressVideoPreset: 'Passthrough', }).then((picture) => { if ('path' in picture) { setForm({ diff --git a/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx b/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx index cdd9cedf..f5a9f280 100644 --- a/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx +++ b/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx @@ -78,7 +78,6 @@ const SuggestedPeopleUploadPictureScreen: React.FC { if ('path' in picture) { diff --git a/src/utils/camera.ts b/src/utils/camera.ts index 6c1b9d50..e719162c 100644 --- a/src/utils/camera.ts +++ b/src/utils/camera.ts @@ -78,23 +78,6 @@ export const navigateToImagePicker = ( }); }; -export const navigateToVideoPicker = (callback: (vid: Video) => void) => { - ImagePicker.openPicker({ - mediaType: 'video', - compressVideoPreset: 'Passthrough', - }) - .then(async (vid) => { - if (vid.path) { - callback(vid); - } - }) - .catch((err) => { - if (err.code && err.code !== 'E_PICKER_CANCELLED') { - Alert.alert(ERROR_UPLOAD); - } - }); -}; - export const showGIFFailureAlert = (onSuccess: () => void) => Alert.alert( 'Warning', diff --git a/src/utils/users.ts b/src/utils/users.ts index 75858fe2..992d7721 100644 --- a/src/utils/users.ts +++ b/src/utils/users.ts @@ -254,7 +254,6 @@ export const patchProfile = async ( cropping: true, cropperToolbarTitle: screenTitle, mediaType: 'photo', - compressVideoPreset: 'Passthrough', }; break; case 'profile': @@ -275,16 +274,13 @@ export const patchProfile = async ( cropperToolbarTitle: screenTitle, mediaType: 'photo', cropperCircleOverlay: true, - compressVideoPreset: 'Passthrough', }; break; default: screenTitle = ''; requestTitle = ''; fileName = ''; - imageSettings = { - compressVideoPreset: 'Passthrough', - }; + imageSettings = {}; } return await ImagePicker.openPicker(imageSettings) -- cgit v1.2.3-70-g09d2 From 6c7a8531bd133e4e58ac2d3463800d7f7cac4e31 Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Fri, 16 Jul 2021 15:24:15 -0400 Subject: Fix lint --- src/utils/camera.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/utils/camera.ts b/src/utils/camera.ts index e719162c..c0b0c6bf 100644 --- a/src/utils/camera.ts +++ b/src/utils/camera.ts @@ -9,7 +9,7 @@ import { TakePictureResponse, } from 'react-native-camera'; import {ProcessingManager} from 'react-native-video-processing'; -import ImagePicker, {ImageOrVideo, Video} from 'react-native-image-crop-picker'; +import ImagePicker, {ImageOrVideo} from 'react-native-image-crop-picker'; import {ERROR_UPLOAD} from '../constants/strings'; /* -- cgit v1.2.3-70-g09d2