aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-07-23 15:08:53 -0400
committerIvan Chen <ivan@tagg.id>2021-07-23 15:08:53 -0400
commite3302c00072ab8275ccd01f58037fcadf54a9614 (patch)
tree3b8bf82a22e9c45db574a3b3ac20f8f3cbf45d9c
parent9a043ad37aefb5c1b5908c4171cef36977acd5f4 (diff)
Add check to prevent multiple uploads
-rw-r--r--src/constants/strings.ts13
-rw-r--r--src/screens/upload/EditMedia.tsx47
2 files changed, 39 insertions, 21 deletions
diff --git a/src/constants/strings.ts b/src/constants/strings.ts
index 071b3835..450d7e5c 100644
--- a/src/constants/strings.ts
+++ b/src/constants/strings.ts
@@ -2,8 +2,8 @@
// Below is the regex to convert this into a csv for the Google Sheet
// export const (.*) = .*?(['|"|`])(.*)\2;
// replace with: $1\t$3
-export const APP_STORE_LINK = 'https://apps.apple.com/us/app/tagg-discover-your-community/id1537853613'
export const ADD_COMMENT_TEXT = (username?: string) => username ? `Reply to ${username}` : 'Add a comment...'
+export const APP_STORE_LINK = 'https://apps.apple.com/us/app/tagg-discover-your-community/id1537853613'
export const COMING_SOON_MSG = 'Creating more fun things for you, surprises coming soon πŸ˜‰';
export const ERROR_ATTEMPT_EDIT_SP = 'Can\'t let you do that yet! Please onboard Suggested People first!';
export const ERROR_AUTHENTICATION = 'An error occurred during authentication. Please login again!';
@@ -31,8 +31,10 @@ export const ERROR_INVLAID_CODE = 'The code entered is not valid!';
export const ERROR_LINK = (str: string) => `Unable to link with ${str}, Please check your login and try again`;
export const ERROR_LOGIN = 'There was a problem logging you in, please refresh and try again';
export const ERROR_LOGIN_FAILED = 'Login failed. Check your username and password, and try again';
+export const ERROR_MOMENT_UPLOAD_IN_PROGRESS = 'Please wait, there is a Moment upload in progress.';
export const ERROR_NEXT_PAGE = 'There was a problem while loading the next page πŸ˜“, try again in a couple minutes';
export const ERROR_NO_CONTACT_INVITE_LEFT = 'You have no more invites left!'
+export const ERROR_NO_MOMENT_CATEGORY = 'Please select a category!';
export const ERROR_NOT_ONBOARDED = 'You are now on waitlist, please enter your invitation code if you have one';
export const ERROR_PHONE_IN_USE = 'Phone already in use, please try another one';
export const ERROR_PROFILE_CREATION_SHORT = 'Profile creation failed πŸ˜“';
@@ -45,7 +47,6 @@ export const ERROR_SELECT_GENDER = 'Please select your gender';
export const ERROR_SELECT_UNIVERSITY = 'Please select your University';
export const ERROR_SERVER_DOWN = 'mhm, looks like our servers are down, please refresh and try again in a few mins';
export const ERROR_SOMETHING_WENT_WRONG = 'Oh dear, don’t worry someone will be held responsible for this error, In the meantime refresh the app';
-export const ERROR_NO_MOMENT_CATEGORY = 'Please select a category!';
export const ERROR_SOMETHING_WENT_WRONG_REFRESH = "Ha, looks like this one's on us, please refresh and try again";
export const ERROR_SOMETHING_WENT_WRONG_RELOAD = "You broke it, Just kidding! we don't know what happened... Please reload the app and try again";
export const ERROR_T_AND_C_NOT_ACCEPTED = 'You must first agree to the terms and conditions.';
@@ -61,6 +62,7 @@ export const ERROR_UPLOAD_SMALL_PROFILE_PIC = "Can't have a profile without a pi
export const ERROR_UPLOAD_SP_PHOTO = 'Unable to update suggested people photo. Please retry!';
export const ERROR_VERIFICATION_FAILED_SHORT = 'Verification failed πŸ˜“';
export const FIRST_MESSAGE = 'How about sending your first message to your friend';
+export const INVITE_USER_SMS_BODY = (invitedUserName: string, invitee: string, inviteCode: string) => `Hey ${invitedUserName}!\nYou've been tagged by ${invitee}. Follow the instructions below to skip the line and join them on Tagg!\nSign up and use this code to get in: ${inviteCode}\n ${APP_STORE_LINK}`;
export const MARKED_AS_MSG = (str: string) => `Marked as ${str}`;
export const MOMENT_DELETED_MSG = 'Moment deleted....Some moments have to go, to create space for greater ones';
export const NO_NEW_NOTIFICATIONS = 'You have no new notifications';
@@ -69,13 +71,10 @@ export const PRIVATE_ACCOUNT = 'This account is private';
export const START_CHATTING = 'Let’s Start Chatting!';
export const SUCCESS_BADGES_UPDATE = 'Badges updated successfully!'
export const SUCCESS_CATEGORY_DELETE = 'Category successfully deleted, but its memory will live on';
+export const SUCCESS_CONFIRM_INVITE_CONTACT_MESSAGE = 'Use one now?';
+export const SUCCESS_CONFIRM_INVITE_CONTACT_TITLE = (str: string) => `You have ${str} invites left!`;
export const SUCCESS_INVITATION_CODE = 'Welcome to Tagg!';
export const SUCCESS_INVITE_CONTACT = (str: string) => `Success! You now have ${str} invites left!`;
-export const SUCCESS_CONFIRM_INVITE_CONTACT_TITLE = (str: string) => `You have ${str} invites left!`;
-export const SUCCESS_CONFIRM_INVITE_CONTACT_MESSAGE = 'Use one now?';
-export const INVITE_USER_SMS_BODY = (invitedUserName: string, invitee: string, inviteCode: string) => `Hey ${invitedUserName}!\n
-You've been tagged by ${invitee}. Follow the instructions below to skip the line and join them on Tagg!\n
-Sign up and use this code to get in: ${inviteCode}\n ${APP_STORE_LINK}`;
export const SUCCESS_LAST_CONTACT_INVITE = 'Done! That was your last invite, hope you used it wisely!';
export const SUCCESS_LINK = (str: string) => `Successfully linked ${str} πŸŽ‰`;
export const SUCCESS_PIC_UPLOAD = 'Beautiful, the Moment was uploaded successfully!';
diff --git a/src/screens/upload/EditMedia.tsx b/src/screens/upload/EditMedia.tsx
index 9a061a53..07d20a7b 100644
--- a/src/screens/upload/EditMedia.tsx
+++ b/src/screens/upload/EditMedia.tsx
@@ -2,14 +2,24 @@ import ReactNativeZoomableView from '@dudigital/react-native-zoomable-view/src/R
import {RouteProp} from '@react-navigation/core';
import {StackNavigationProp} from '@react-navigation/stack';
import React, {useEffect, useRef, useState} from 'react';
-import {Image, StyleSheet, Text, TouchableOpacity, View} from 'react-native';
+import {
+ Alert,
+ Image,
+ StyleSheet,
+ Text,
+ TouchableOpacity,
+ View,
+} from 'react-native';
import ImageZoom, {IOnMove} from 'react-native-image-pan-zoom';
import PhotoManipulator from 'react-native-photo-manipulator';
+import {useSelector} from 'react-redux';
import TrimIcon from '../../assets/icons/trim.svg';
import CloseIcon from '../../assets/ionicons/close-outline.svg';
import {SaveButton, TrimmerPlayer} from '../../components';
import {TaggLoadingIndicator, TaggSquareButton} from '../../components/common';
+import {ERROR_MOMENT_UPLOAD_IN_PROGRESS} from '../../constants/strings';
import {MainStackParams} from '../../routes';
+import {RootState} from '../../store/rootReducer';
import {
cropVideo,
HeaderHeight,
@@ -36,6 +46,9 @@ export const EditMedia: React.FC<EditMediaProps> = ({route, navigation}) => {
selectedCategory,
media: {isVideo},
} = route.params;
+ const {momentUploadProgressBar} = useSelector(
+ (state: RootState) => state.user,
+ );
const [aspectRatio, setAspectRatio] = useState<number>(1);
// width and height of video, if video
const [origDimensions, setOrigDimensions] = useState<number[]>([0, 0]);
@@ -252,6 +265,24 @@ export const EditMedia: React.FC<EditMediaProps> = ({route, navigation}) => {
);
};
+ const handleNext = () => {
+ if (momentUploadProgressBar) {
+ Alert.alert(ERROR_MOMENT_UPLOAD_IN_PROGRESS);
+ } else {
+ processVideo((uri) =>
+ navigation.navigate('CaptionScreen', {
+ screenType,
+ media: {
+ uri,
+ isVideo,
+ videoDuration,
+ },
+ selectedCategory,
+ }),
+ );
+ }
+ };
+
return (
<View style={styles.container}>
{cropLoading && <TaggLoadingIndicator fullscreen />}
@@ -391,19 +422,7 @@ export const EditMedia: React.FC<EditMediaProps> = ({route, navigation}) => {
/>
<TaggSquareButton
style={styles.button}
- onPress={() =>
- processVideo((uri) =>
- navigation.navigate('CaptionScreen', {
- screenType,
- media: {
- uri,
- isVideo,
- videoDuration,
- },
- selectedCategory,
- }),
- )
- }
+ onPress={handleNext}
title={'Next'}
buttonStyle={'large'}
buttonColor={'blue'}