diff options
author | Ivan Chen <ivan@tagg.id> | 2021-07-21 19:11:32 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-07-21 19:11:32 -0400 |
commit | 9b94f60df0b62a9d3762a1963ec7dac024658a51 (patch) | |
tree | e0f16942d1db927ba6c45b19bb79d085490e7027 /src | |
parent | fbb9d410b4a525dd6f21d5de7e1e3844b6cf78a7 (diff) |
Update progress bar type
Diffstat (limited to 'src')
-rw-r--r-- | src/components/moments/MomentUploadProgressBar.tsx | 16 | ||||
-rw-r--r-- | src/constants/api.ts | 1 | ||||
-rw-r--r-- | src/store/initialStates.ts | 3 | ||||
-rw-r--r-- | src/types/types.ts | 7 |
4 files changed, 20 insertions, 7 deletions
diff --git a/src/components/moments/MomentUploadProgressBar.tsx b/src/components/moments/MomentUploadProgressBar.tsx index 285f4e84..07d876e8 100644 --- a/src/components/moments/MomentUploadProgressBar.tsx +++ b/src/components/moments/MomentUploadProgressBar.tsx @@ -13,17 +13,23 @@ interface MomentUploadProgressBarProps {} const MomentUploadProgressBar: React.FC<MomentUploadProgressBarProps> = ({}) => { - const {momentUploadStatus} = useSelector((state: RootState) => state.user); - const progress = useSharedValue(0); + const {momentUploadProgressBar} = useSelector( + (state: RootState) => state.user, + ); + const progress = useSharedValue(0.001); useEffect(() => { - if (momentUploadStatus === MomentUploadStatusType.Uploading) { + if ( + momentUploadProgressBar?.status === MomentUploadStatusType.Uploading + ) { progress.value = withTiming(1, { - duration: 30 * 1000, + duration: momentUploadProgressBar.originalVideoDuration * 1000, easing: Easing.out(Easing.quad), }); } - }, [momentUploadStatus]); + }, [momentUploadProgressBar?.status]); + + useEffect(() => {}, []); return ( <View style={styles.background}> diff --git a/src/constants/api.ts b/src/constants/api.ts index 6dab1153..ec2f0897 100644 --- a/src/constants/api.ts +++ b/src/constants/api.ts @@ -39,6 +39,7 @@ export const COMMENTS_ENDPOINT: string = API_URL + 'comments/'; export const COMMENT_REACTIONS_ENDPOINT: string = API_URL + 'reaction-comment/'; export const COMMENT_REACTIONS_REPLY_ENDPOINT: string = API_URL + 'reaction-reply/'; export const PRESIGNED_URL_ENDPOINT: string = API_URL + 'presigned-url/'; +export const CHECK_MOMENT_UPLOAD_FINISHED_ENDPOINT: string = API_URL + 'moments/check_upload_finished/'; export const FRIENDS_ENDPOINT: string = API_URL + 'friends/'; export const ALL_USERS_ENDPOINT: string = API_URL + 'users/'; export const REPORT_ISSUE_ENDPOINT: string = API_URL + 'report/'; diff --git a/src/store/initialStates.ts b/src/store/initialStates.ts index 5ae62838..ddfdf5d2 100644 --- a/src/store/initialStates.ts +++ b/src/store/initialStates.ts @@ -10,6 +10,7 @@ import { import { CommentThreadType, MomentPostType, + MomentUploadProgressBarType, MomentUploadStatusType, UniversityType, } from './../types/types'; @@ -49,7 +50,7 @@ export const NO_USER_DATA = { profile: <ProfileInfoType>NO_PROFILE, avatar: <string | undefined>undefined, cover: <string | undefined>undefined, - momentUploadStatus: <MomentUploadStatusType>MomentUploadStatusType.Empty, + momentUploadProgressBar: <MomentUploadProgressBarType | undefined>undefined, isOnboardedUser: false, newVersionAvailable: false, newNotificationReceived: false, diff --git a/src/types/types.ts b/src/types/types.ts index 930f833b..2001426a 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -61,8 +61,13 @@ export interface ProfileInfoType { is_private: boolean; } +export interface MomentUploadProgressBarType { + status: MomentUploadStatusType; + originalVideoDuration: number; + momentId: string; +} + export enum MomentUploadStatusType { - Empty = 'Empty', Uploading = 'Uploading', Done = 'Done', Error = 'Error', |