aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/moments/MomentUploadProgressBar.tsx17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/components/moments/MomentUploadProgressBar.tsx b/src/components/moments/MomentUploadProgressBar.tsx
index 0c93ea95..9412fcd6 100644
--- a/src/components/moments/MomentUploadProgressBar.tsx
+++ b/src/components/moments/MomentUploadProgressBar.tsx
@@ -8,7 +8,7 @@ import {
withTiming,
} from 'react-native-reanimated';
import {useDispatch, useSelector} from 'react-redux';
-import {checkMomentUploadFinished} from '../../services';
+import {checkMomentDoneProcessing} from '../../services';
import {loadUserMoments} from '../../store/actions';
import {setMomentUploadProgressBar} from '../../store/reducers';
import {RootState} from '../../store/rootReducer';
@@ -36,10 +36,10 @@ const MomentUploadProgressBar: React.FC<MomentUploadProgressBarProps> =
useEffect(() => {
let doneProcessing = false;
- const checkDone = () => {
+ const checkDone = async () => {
if (
momentUploadProgressBar &&
- checkMomentUploadFinished(momentUploadProgressBar?.momentId)
+ (await checkMomentDoneProcessing(momentUploadProgressBar!.momentId))
) {
doneProcessing = true;
cancelAnimation(progress);
@@ -51,6 +51,7 @@ const MomentUploadProgressBar: React.FC<MomentUploadProgressBarProps> =
});
// change status to Done 1s after the progress bar animation is done
setTimeout(() => {
+ dispatch(loadUserMoments(loggedInUserId));
dispatch({
type: setMomentUploadProgressBar.type,
payload: {
@@ -60,7 +61,7 @@ const MomentUploadProgressBar: React.FC<MomentUploadProgressBarProps> =
},
},
});
- }, finishProgressBarDuration + 1000);
+ }, finishProgressBarDuration);
}
};
if (
@@ -97,11 +98,10 @@ const MomentUploadProgressBar: React.FC<MomentUploadProgressBarProps> =
if (
momentUploadProgressBar?.status === MomentUploadStatusType.UploadingToS3
) {
- // assume it takes video duration (upload) + 1/2 of the video (process) duration to upload
- // e.g. 30s video => 30 + 30 * .5 = 37.5s
+ // e.g. 30s video => 30 * 2 = 60s
const videoDuration =
momentUploadProgressBar.originalVideoDuration ?? 30;
- const durationInSeconds = videoDuration * 1.5;
+ const durationInSeconds = videoDuration * 2;
progress.value = withTiming(1, {
duration: durationInSeconds * 1000,
easing: Easing.out(Easing.quad),
@@ -117,9 +117,6 @@ const MomentUploadProgressBar: React.FC<MomentUploadProgressBarProps> =
progress.value = 0;
// clear this component after a duration
setTimeout(() => {
- if (momentUploadProgressBar?.status === MomentUploadStatusType.Done) {
- dispatch(loadUserMoments(loggedInUserId));
- }
dispatch({
type: setMomentUploadProgressBar.type,
payload: {