aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/constants/strings.ts1
-rw-r--r--src/routes/tabs/NavigationBar.tsx4
-rw-r--r--src/screens/profile/CaptionScreen.tsx34
3 files changed, 21 insertions, 18 deletions
diff --git a/src/constants/strings.ts b/src/constants/strings.ts
index 112bc546..071b3835 100644
--- a/src/constants/strings.ts
+++ b/src/constants/strings.ts
@@ -45,6 +45,7 @@ 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.';
diff --git a/src/routes/tabs/NavigationBar.tsx b/src/routes/tabs/NavigationBar.tsx
index 12f6ab58..c3f0b9f8 100644
--- a/src/routes/tabs/NavigationBar.tsx
+++ b/src/routes/tabs/NavigationBar.tsx
@@ -66,7 +66,7 @@ const NavigationBar: React.FC = () => {
disabled={!focused}
/>
);
- case 'Profile':
+ case 'ProfileTab':
return <NavigationIcon tab="Profile" disabled={!focused} />;
case 'SuggestedPeople':
return (
@@ -118,7 +118,7 @@ const NavigationBar: React.FC = () => {
}}
/>
<Tabs.Screen
- name="Profile"
+ name="ProfileTab"
component={MainStackScreen}
initialParams={{screenType: ScreenType.Profile}}
/>
diff --git a/src/screens/profile/CaptionScreen.tsx b/src/screens/profile/CaptionScreen.tsx
index 025d81a7..ad301ded 100644
--- a/src/screens/profile/CaptionScreen.tsx
+++ b/src/screens/profile/CaptionScreen.tsx
@@ -23,9 +23,11 @@ import {CaptionScreenHeader} from '../../components/';
import TaggLoadingIndicator from '../../components/common/TaggLoadingIndicator';
import {TAGG_LIGHT_BLUE_2} from '../../constants';
import {
+ ERROR_NO_MOMENT_CATEGORY,
ERROR_SOMETHING_WENT_WRONG_REFRESH,
ERROR_UPLOAD,
} from '../../constants/strings';
+import * as RootNavigation from '../../RootNavigation';
import {MainStackParams} from '../../routes';
import {
handlePresignedURL,
@@ -69,6 +71,7 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
const [tags, setTags] = useState<MomentTagType[]>([]);
const [taggedUsersText, setTaggedUsersText] = useState('');
const [momentCategory, setMomentCategory] = useState<string | undefined>();
+ // const [momentCategory, setMomentCategory] = useState<string | undefined>();
const mediaUri = moment ? moment.moment_url : route.params.media!.uri;
// TODO: change this once moment refactor is done
const isMediaAVideo = moment
@@ -105,27 +108,23 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
setTaggedUsersText(listString);
}, [tags]);
- const navigateToProfile = () => {
- //Since the logged In User is navigating to own profile, useXId is not required
- navigation.navigate('Profile', {
- screenType,
- userXId: undefined,
- });
- };
-
- const handleFailed = () => {
+ const handleFailed = (noCategory = false) => {
setLoading(false);
setTimeout(() => {
- Alert.alert(moment ? ERROR_SOMETHING_WENT_WRONG_REFRESH : ERROR_UPLOAD);
+ if (noCategory) {
+ Alert.alert(ERROR_NO_MOMENT_CATEGORY);
+ } else {
+ Alert.alert(moment ? ERROR_SOMETHING_WENT_WRONG_REFRESH : ERROR_UPLOAD);
+ }
}, 500);
};
const handleSuccess = () => {
setLoading(false);
- if (moment) {
- setLoading(false);
- navigation.goBack();
- } else {
- navigateToProfile();
+ if (!moment) {
+ // if posting, pop all screens until at camera screen (default upload screen)
+ // then switch to the profile tab
+ navigation.popToTop();
+ RootNavigation.navigate('ProfileTab');
setTimeout(() => {
if (isMediaAVideo) {
Alert.alert(
@@ -135,6 +134,9 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
Alert.alert('');
}
}, 500);
+ } else {
+ // if editing, simply go back to (most likely) indiv moment
+ navigation.goBack();
}
};
@@ -150,7 +152,7 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
const handleShare = async () => {
setLoading(true);
if (moment || !momentCategory) {
- handleFailed();
+ handleFailed(true);
return;
}
let profileCompletionStage;