aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/components/moments/MomentUploadProgressBar.tsx25
-rw-r--r--src/routes/main/MainStackNavigator.tsx1
-rw-r--r--src/screens/profile/CaptionScreen.tsx16
3 files changed, 21 insertions, 21 deletions
diff --git a/src/components/moments/MomentUploadProgressBar.tsx b/src/components/moments/MomentUploadProgressBar.tsx
index 742c403b..afda16e2 100644
--- a/src/components/moments/MomentUploadProgressBar.tsx
+++ b/src/components/moments/MomentUploadProgressBar.tsx
@@ -10,6 +10,7 @@ import {
import {SafeAreaView} from 'react-native-safe-area-context';
import {useDispatch, useSelector} from 'react-redux';
import {checkMomentUploadFinished} from '../../services';
+import {loadUserMoments} from '../../store/actions';
import {setMomentUploadProgressBar} from '../../store/reducers';
import {RootState} from '../../store/rootReducer';
import {MomentUploadStatusType} from '../../types';
@@ -21,6 +22,9 @@ interface MomentUploadProgressBarProps {}
const MomentUploadProgressBar: React.FC<MomentUploadProgressBarProps> =
({}) => {
const dispatch = useDispatch();
+ const {userId: loggedInUserId} = useSelector(
+ (state: RootState) => state.user.user,
+ );
const {momentUploadProgressBar} = useSelector(
(state: RootState) => state.user,
);
@@ -72,17 +76,19 @@ const MomentUploadProgressBar: React.FC<MomentUploadProgressBarProps> =
}, 5 * 1000);
// timeout if takes longer than 1 minute to process
setTimeout(() => {
- console.error('Check for done processing timed out');
clearInterval(timer);
- dispatch({
- type: setMomentUploadProgressBar.type,
- payload: {
- momentUploadProgressBar: {
- ...momentUploadProgressBar,
- status: MomentUploadStatusType.Error,
+ if (!doneProcessing) {
+ console.error('Check for done processing timed out');
+ dispatch({
+ type: setMomentUploadProgressBar.type,
+ payload: {
+ momentUploadProgressBar: {
+ ...momentUploadProgressBar,
+ status: MomentUploadStatusType.Error,
+ },
},
- },
- });
+ });
+ }
}, 60 * 1000);
return () => clearInterval(timer);
}
@@ -109,6 +115,7 @@ const MomentUploadProgressBar: React.FC<MomentUploadProgressBarProps> =
progress.value = 0;
// clear this component after a duration
setTimeout(() => {
+ dispatch(loadUserMoments(loggedInUserId));
dispatch({
type: setMomentUploadProgressBar.type,
payload: {
diff --git a/src/routes/main/MainStackNavigator.tsx b/src/routes/main/MainStackNavigator.tsx
index 585980b5..8def19e3 100644
--- a/src/routes/main/MainStackNavigator.tsx
+++ b/src/routes/main/MainStackNavigator.tsx
@@ -58,6 +58,7 @@ export type MainStackParams = {
media: {
uri: string;
isVideo: boolean;
+ videoDuration: number | undefined;
};
selectedTags?: MomentTagType[];
};
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<CaptionScreenProps> = ({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<CaptionScreenProps> = ({route, navigation}) => {
);
} else {
handleFailed();
+ return;
}
} else {
const momentResponse = await postMoment(
@@ -330,6 +321,7 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
media: {
uri: mediaUri,
isVideo: isMediaAVideo,
+ videoDuration,
},
selectedTags: tags,
})