aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-07-21 19:19:30 -0400
committerIvan Chen <ivan@tagg.id>2021-07-21 19:19:30 -0400
commitd518a5e7ae053ef55ca4ede254586f77be86e768 (patch)
tree94dc0014fdd58bf2e4a0b3d8404e4f785ef5ab30 /src/components
parent7dc3d23577355b18e7089251823ff254e65f1137 (diff)
Add service, Add logic for checking upload finished
Diffstat (limited to 'src/components')
-rw-r--r--src/components/moments/MomentUploadProgressBar.tsx16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/components/moments/MomentUploadProgressBar.tsx b/src/components/moments/MomentUploadProgressBar.tsx
index 28fbd8cb..0d84236d 100644
--- a/src/components/moments/MomentUploadProgressBar.tsx
+++ b/src/components/moments/MomentUploadProgressBar.tsx
@@ -4,6 +4,7 @@ import {View} from 'react-native-animatable';
import {Easing, useSharedValue, withTiming} from 'react-native-reanimated';
import {SafeAreaView} from 'react-native-safe-area-context';
import {useSelector} from 'react-redux';
+import {checkMomentUploadFinished} from '../../services';
import {RootState} from '../../store/rootReducer';
import {MomentUploadStatusType} from '../../types';
import {normalize, SCREEN_WIDTH, StatusBarHeight} from '../../utils';
@@ -22,6 +23,21 @@ const MomentUploadProgressBar: React.FC<MomentUploadProgressBarProps> =
if (
momentUploadProgressBar?.status === MomentUploadStatusType.Uploading
) {
+ const timer = setInterval(async () => {
+ if (checkMomentUploadFinished(momentUploadProgressBar.momentId)) {
+ // call upload finished action
+ }
+ }, 5 * 1000);
+ setTimeout(() => {
+ clearInterval(timer);
+ }, 5 * 60 * 1000);
+ }
+ }, []);
+
+ useEffect(() => {
+ if (
+ momentUploadProgressBar?.status === MomentUploadStatusType.Uploading
+ ) {
progress.value = withTiming(1, {
duration: momentUploadProgressBar.originalVideoDuration * 1000,
easing: Easing.out(Easing.quad),