From 8181eacc003342fc6bff649b8d1bd793a88efee5 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Thu, 22 Jul 2021 18:13:08 -0400 Subject: Handle error case for displaying alert, Add logic to auto reload --- src/screens/profile/CaptionScreen.tsx | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/screens') diff --git a/src/screens/profile/CaptionScreen.tsx b/src/screens/profile/CaptionScreen.tsx index 88ff0ecc..6ba1791c 100644 --- a/src/screens/profile/CaptionScreen.tsx +++ b/src/screens/profile/CaptionScreen.tsx @@ -34,13 +34,7 @@ import { } from '../../constants/strings'; import * as RootNavigation from '../../RootNavigation'; import {MainStackParams} from '../../routes'; -import { - handlePresignedURL, - handleVideoUpload, - patchMoment, - postMoment, - postMomentTags, -} from '../../services'; +import {patchMoment, postMoment, postMomentTags} from '../../services'; import { handleVideoMomentUpload, loadUserMoments, @@ -136,11 +130,7 @@ const CaptionScreen: React.FC = ({route, navigation}) => { navigation.popToTop(); RootNavigation.navigate('ProfileTab'); setTimeout(() => { - if (isMediaAVideo) { - Alert.alert( - 'Beautiful, the Moment was uploaded successfully! Check back in a bit and refresh to see it!', - ); - } else { + if (!isMediaAVideo) { Alert.alert(SUCCESS_PIC_UPLOAD); } }, 500); @@ -182,6 +172,7 @@ const CaptionScreen: React.FC = ({route, navigation}) => { ); } else { handleFailed(); + return; } } else { const momentResponse = await postMoment( @@ -330,6 +321,7 @@ const CaptionScreen: React.FC = ({route, navigation}) => { media: { uri: mediaUri, isVideo: isMediaAVideo, + videoDuration, }, selectedTags: tags, }) -- cgit v1.2.3-70-g09d2