diff options
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/moments/Moment.tsx | 45 |
1 files changed, 13 insertions, 32 deletions
diff --git a/src/components/moments/Moment.tsx b/src/components/moments/Moment.tsx index 8ff05824..eab4b7e3 100644 --- a/src/components/moments/Moment.tsx +++ b/src/components/moments/Moment.tsx @@ -5,7 +5,6 @@ import {Text} from 'react-native-animatable'; import {ScrollView, TouchableOpacity} from 'react-native-gesture-handler'; import ImagePicker from 'react-native-image-crop-picker'; import LinearGradient from 'react-native-linear-gradient'; -import {useDispatch, useSelector} from 'react-redux'; import DeleteIcon from '../../assets/icons/delete-logo.svg'; import DownIcon from '../../assets/icons/down_icon.svg'; import BigPlusIcon from '../../assets/icons/plus-icon-white.svg'; @@ -13,12 +12,6 @@ import PlusIcon from '../../assets/icons/plus-icon.svg'; import UpIcon from '../../assets/icons/up_icon.svg'; import {TAGG_LIGHT_BLUE} from '../../constants'; import {ERROR_UPLOAD} from '../../constants/strings'; -import { - handlePresignedURL, - handleVideoUpload, -} from '../../services/MomentService'; -import {loadUserMoments} from '../../store/actions'; -import {RootState} from '../../store/rootReducer'; import {MomentType, ScreenType} from '../../types'; import {normalize, SCREEN_WIDTH} from '../../utils'; import MomentTile from './MomentTile'; @@ -49,22 +42,18 @@ const Moment: React.FC<MomentProps> = ({ externalStyles, }) => { const navigation = useNavigation(); - const dispatch = useDispatch(); - const { - user: {userId}, - } = useSelector((state: RootState) => state.user); - const uploadVideo = async (filePath: string) => { + const navigateToCaptionScreenForVideo = (uri: string) => { const randHash = Math.random().toString(36).substring(7); - const filename = `poc_${randHash}.mov`; - const presignedURL = await handlePresignedURL(filename, title); - if (presignedURL) { - console.log('presigned' + JSON.stringify(presignedURL)); - Alert.alert('Upload begin in background...'); - await handleVideoUpload(filename, filePath, presignedURL); - Alert.alert('Finish uploading, refreshing moments...'); - dispatch(loadUserMoments(userId)); - } + navigation.navigate('CaptionScreen', { + screenType, + title, + media: { + filename: `poc_${randHash}.mov`, + uri, + isVideo: true, + }, + }); }; /** * This function opens the ImagePicker, only lets you select video files, @@ -78,17 +67,9 @@ const Moment: React.FC<MomentProps> = ({ mediaType: 'video', }) .then(async (vid) => { + console.log(vid); if (vid.path) { - const randHash = Math.random().toString(36).substring(7); - navigation.navigate('CaptionScreen', { - screenType, - title, - media: { - filename: `poc_${randHash}.mov`, - uri: vid.path, - isVideo: true, - }, - }); + navigateToCaptionScreenForVideo(vid.path); } }) .catch((err) => { @@ -183,7 +164,7 @@ const Moment: React.FC<MomentProps> = ({ }).then((vid) => { console.log(vid); if (vid.path) { - uploadVideo(vid.path); + navigateToCaptionScreenForVideo(vid.path); } }), }, |