aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/App.tsx19
-rw-r--r--src/RootNavigation.ts3
-rw-r--r--src/components/comments/AddComment.tsx5
-rw-r--r--src/components/common/FriendsButton.tsx8
-rw-r--r--src/components/moments/TagFriendsFoooter.tsx35
-rw-r--r--src/components/profile/Content.tsx8
-rw-r--r--src/components/profile/ProfileBody.tsx8
-rw-r--r--src/components/profile/PublicProfile.tsx5
-rw-r--r--src/constants/regex.ts9
-rw-r--r--src/routes/tabs/NavigationBar.tsx6
-rw-r--r--src/screens/main/NotificationsScreen.tsx5
-rw-r--r--src/screens/moments/TagFriendsScreen.tsx3
-rw-r--r--src/screens/profile/CaptionScreen.tsx35
-rw-r--r--src/screens/profile/IndividualMoment.tsx5
-rw-r--r--src/screens/profile/MomentCommentsScreen.tsx10
-rw-r--r--src/screens/profile/MomentUploadPromptScreen.tsx8
-rw-r--r--src/screens/profile/SocialMediaTaggs.tsx6
-rw-r--r--src/screens/suggestedPeople/MutualBadgeHolders.tsx5
-rw-r--r--src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx245
-rw-r--r--src/services/NotificationService.ts51
-rw-r--r--src/services/SocialLinkingService.ts21
-rw-r--r--src/store/actions/momentCategories.tsx80
-rw-r--r--src/store/actions/notifications.ts29
-rw-r--r--src/store/actions/socials.ts62
-rw-r--r--src/store/actions/taggUsers.ts29
-rw-r--r--src/store/actions/user.ts389
-rw-r--r--src/store/actions/userBlock.ts80
-rw-r--r--src/store/actions/userFriends.ts346
-rw-r--r--src/store/actions/userMoments.ts60
-rw-r--r--src/store/actions/userX.ts257
-rw-r--r--src/store/reducers/userMomentsReducer.ts6
-rw-r--r--src/store/reducers/userSocialsReducer.ts6
-rw-r--r--src/store/reducers/userXReducer.ts5
-rw-r--r--src/utils/layouts.ts5
34 files changed, 914 insertions, 940 deletions
diff --git a/src/App.tsx b/src/App.tsx
index 64f40bae..92e7abee 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -27,15 +27,16 @@ export const ChatContext = React.createContext({} as ChatContextType);
const App = () => {
const routeNameRef = useRef();
const [channel, setChannel] = useState<ChannelGroupedType>();
- const chatClient = StreamChat.getInstance<
- LocalAttachmentType,
- LocalChannelType,
- LocalCommandType,
- LocalEventType,
- LocalMessageType,
- LocalResponseType,
- LocalUserType
- >(STREAM_CHAT_API);
+ const chatClient =
+ StreamChat.getInstance<
+ LocalAttachmentType,
+ LocalChannelType,
+ LocalCommandType,
+ LocalEventType,
+ LocalMessageType,
+ LocalResponseType,
+ LocalUserType
+ >(STREAM_CHAT_API);
return (
<Provider store={store}>
<NavigationContainer
diff --git a/src/RootNavigation.ts b/src/RootNavigation.ts
index 56ccfca4..9baa7828 100644
--- a/src/RootNavigation.ts
+++ b/src/RootNavigation.ts
@@ -1,7 +1,8 @@
import {NavigationContainerRef} from '@react-navigation/native';
import React from 'react';
-export const navigationRef: React.RefObject<NavigationContainerRef> = React.createRef();
+export const navigationRef: React.RefObject<NavigationContainerRef> =
+ React.createRef();
export function navigate(name: string) {
if (navigationRef.current) {
diff --git a/src/components/comments/AddComment.tsx b/src/components/comments/AddComment.tsx
index befaa8fe..b229d010 100644
--- a/src/components/comments/AddComment.tsx
+++ b/src/components/comments/AddComment.tsx
@@ -27,9 +27,8 @@ export interface AddCommentProps {
}
const AddComment: React.FC<AddCommentProps> = ({momentId, placeholderText}) => {
- const {setShouldUpdateAllComments, commentTapped} = useContext(
- CommentContext,
- );
+ const {setShouldUpdateAllComments, commentTapped} =
+ useContext(CommentContext);
const [inReplyToMention, setInReplyToMention] = useState('');
const [comment, setComment] = useState('');
const [keyboardVisible, setKeyboardVisible] = useState(false);
diff --git a/src/components/common/FriendsButton.tsx b/src/components/common/FriendsButton.tsx
index ae901229..e7a1f8c7 100644
--- a/src/components/common/FriendsButton.tsx
+++ b/src/components/common/FriendsButton.tsx
@@ -31,11 +31,9 @@ const FriendsButton: React.FC<FriendsButtonProps> = ({
}) => {
const dispatch = useDispatch();
- const {
- user = NO_USER,
- profile = NO_PROFILE,
- } = useSelector((state: RootState) =>
- userXId ? state.userX[screenType][userXId] : state.user,
+ const {user = NO_USER, profile = NO_PROFILE} = useSelector(
+ (state: RootState) =>
+ userXId ? state.userX[screenType][userXId] : state.user,
);
const {user: loggedInUser = NO_USER} = useSelector(
diff --git a/src/components/moments/TagFriendsFoooter.tsx b/src/components/moments/TagFriendsFoooter.tsx
index 6b8fc62a..7b109877 100644
--- a/src/components/moments/TagFriendsFoooter.tsx
+++ b/src/components/moments/TagFriendsFoooter.tsx
@@ -27,29 +27,23 @@ const TagFriendsFooter: React.FC<TagFriendsFooterProps> = ({
selectedUsers: taggedUsers,
})
}
- style={{
- flexDirection: 'column',
- alignItems: 'center',
- }}>
+ style={styles.tagMoreContainer}>
<Image
source={require('../../assets/icons/tagging/white-plus-icon.png')}
- style={{width: 38, height: 38, top: -2}}
+ style={styles.tagMoreIcon}
/>
- <Text style={styles.taggMoreLabel}>{'Tagg More'}</Text>
+ <Text style={styles.tagMoreLabel}>{'Tagg More'}</Text>
</TouchableOpacity>
);
const TaggedUser = (user: ProfilePreviewType) => (
- <View style={{flexDirection: 'row-reverse'}} key={user.id}>
+ <View style={styles.taggedUserContainer} key={user.id}>
<TouchableOpacity
style={styles.closeIconContainer}
onPress={() => handleRemoveTag(user)}>
<Image
source={require('../../assets/icons/tagging/x-icon.png')}
- style={{
- width: 20,
- height: 20,
- }}
+ style={styles.closeIcon}
/>
</TouchableOpacity>
<ProfilePreview
@@ -67,9 +61,7 @@ const TagFriendsFooter: React.FC<TagFriendsFooterProps> = ({
*/
const TagFriendsTitle = () => (
<TouchableOpacity
- style={{
- flexDirection: 'row',
- }}
+ style={styles.tagFriendsTitleContainer}
disabled={taggedUsers.length !== 0}
onPress={() =>
navigation.navigate('TagSelectionScreen', {
@@ -112,7 +104,7 @@ const styles = StyleSheet.create({
flexWrap: 'wrap',
justifyContent: 'flex-start',
},
- taggMoreLabel: {
+ tagMoreLabel: {
fontWeight: '500',
fontSize: normalize(9),
lineHeight: normalize(10),
@@ -127,6 +119,19 @@ const styles = StyleSheet.create({
right: -20,
zIndex: 1,
},
+ tagMoreContainer: {
+ flexDirection: 'column',
+ alignItems: 'center',
+ },
+ tagMoreIcon: {width: 38, height: 38, top: -2},
+ taggedUserContainer: {flexDirection: 'row-reverse'},
+ closeIcon: {
+ width: 20,
+ height: 20,
+ },
+ tagFriendsTitleContainer: {
+ flexDirection: 'row',
+ },
});
export default TagFriendsFooter;
diff --git a/src/components/profile/Content.tsx b/src/components/profile/Content.tsx
index 8298dc9a..2d1002dd 100644
--- a/src/components/profile/Content.tsx
+++ b/src/components/profile/Content.tsx
@@ -38,11 +38,9 @@ interface ContentProps {
}
const Content: React.FC<ContentProps> = ({userXId, screenType}) => {
const dispatch = useDispatch();
- const {
- user = NO_USER,
- profile = NO_PROFILE,
- } = useSelector((state: RootState) =>
- userXId ? state.userX[screenType][userXId] : state.user,
+ const {user = NO_USER, profile = NO_PROFILE} = useSelector(
+ (state: RootState) =>
+ userXId ? state.userX[screenType][userXId] : state.user,
);
const {blockedUsers = EMPTY_PROFILE_PREVIEW_LIST} = useSelector(
(state: RootState) => state.blocked,
diff --git a/src/components/profile/ProfileBody.tsx b/src/components/profile/ProfileBody.tsx
index 7557de00..8743acfb 100644
--- a/src/components/profile/ProfileBody.tsx
+++ b/src/components/profile/ProfileBody.tsx
@@ -42,12 +42,8 @@ const ProfileBody: React.FC<ProfileBodyProps> = ({
userXId ? state.userX[screenType][userXId] : state.user,
);
- const {
- biography,
- website,
- friendship_status,
- friendship_requester_id,
- } = profile;
+ const {biography, website, friendship_status, friendship_requester_id} =
+ profile;
const {id, username, first_name, last_name} = getUserAsProfilePreviewType(
user,
diff --git a/src/components/profile/PublicProfile.tsx b/src/components/profile/PublicProfile.tsx
index b8920351..8a80c56f 100644
--- a/src/components/profile/PublicProfile.tsx
+++ b/src/components/profile/PublicProfile.tsx
@@ -55,9 +55,8 @@ const PublicProfile: React.FC<ContentProps> = ({
const [isStageTwoPromptClosed, setIsStageTwoPromptClosed] = useState(false);
const [isStageOnePromptClosed, setIsStageOnePromptClosed] = useState(false);
- const [isStageThreePromptClosed, setIsStageThreePromptClosed] = useState(
- false,
- );
+ const [isStageThreePromptClosed, setIsStageThreePromptClosed] =
+ useState(false);
const move = (direction: 'up' | 'down', title: string) => {
let categories = [...momentCategories];
diff --git a/src/constants/regex.ts b/src/constants/regex.ts
index 7de36492..61523203 100644
--- a/src/constants/regex.ts
+++ b/src/constants/regex.ts
@@ -1,7 +1,8 @@
/**
* The email regex has complex constraints compliant with RFC 5322 standards. More details can be found [here](https://emailregex.com/).
*/
-export const emailRegex: RegExp = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
+export const emailRegex: RegExp =
+ /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
/**
* The password regex has the following constraints
@@ -11,7 +12,8 @@ export const emailRegex: RegExp = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@
* - at least one uppercase letter ([A-Z])
* - at least one special character ([^a-zA-z0-9])
*/
-export const passwordRegex: RegExp = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{8,120}$/;
+export const passwordRegex: RegExp =
+ /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{8,120}$/;
/**
* The username regex has the following constraints
@@ -33,7 +35,8 @@ export const nameRegex: RegExp = /^[A-Za-z'\-,. ]{2,20}$/;
* - min. 2 chars, max. 50 chars on website name
* - match alphanumerics, and special characters used in URLs
*/
-export const websiteRegex: RegExp = /^$|^(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,50}\.[a-zA-Z0-9()]{2,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]{0,35})$/;
+export const websiteRegex: RegExp =
+ /^$|^(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,50}\.[a-zA-Z0-9()]{2,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]{0,35})$/;
/**
* The website regex has the following constraints
diff --git a/src/routes/tabs/NavigationBar.tsx b/src/routes/tabs/NavigationBar.tsx
index 9b8427e7..000ac614 100644
--- a/src/routes/tabs/NavigationBar.tsx
+++ b/src/routes/tabs/NavigationBar.tsx
@@ -19,10 +19,8 @@ const NavigationBar: React.FC = () => {
(state: RootState) => state,
);
- const [
- unreadNotificationsPresent,
- setUnreadNotificationsPresent,
- ] = useState<boolean>(false);
+ const [unreadNotificationsPresent, setUnreadNotificationsPresent] =
+ useState<boolean>(false);
useEffect(() => {
const determine = async () => {
diff --git a/src/screens/main/NotificationsScreen.tsx b/src/screens/main/NotificationsScreen.tsx
index bce48ef2..ebcccc8e 100644
--- a/src/screens/main/NotificationsScreen.tsx
+++ b/src/screens/main/NotificationsScreen.tsx
@@ -36,9 +36,8 @@ const NotificationsScreen: React.FC = () => {
);
const [refreshing, setRefreshing] = useState(false);
// used for figuring out which ones are unread
- const [lastViewed, setLastViewed] = useState<moment.Moment | undefined>(
- undefined,
- );
+ const [lastViewed, setLastViewed] =
+ useState<moment.Moment | undefined>(undefined);
const {notifications} = useSelector(
(state: RootState) => state.notifications,
);
diff --git a/src/screens/moments/TagFriendsScreen.tsx b/src/screens/moments/TagFriendsScreen.tsx
index e6a9f5fb..b0722efc 100644
--- a/src/screens/moments/TagFriendsScreen.tsx
+++ b/src/screens/moments/TagFriendsScreen.tsx
@@ -99,7 +99,7 @@ const TagFriendsScreen: React.FC<TagFriendsScreenProps> = ({route}) => {
}
/>
)}
- <View style={{marginHorizontal: '5%', marginTop: '3%'}}>
+ <View style={styles.footerContainer}>
<TagFriendsFooter
taggedUsers={taggedUsers}
setTaggedUsers={setTaggedUsers}
@@ -150,6 +150,7 @@ const styles = StyleSheet.create({
flex: {
flex: 1,
},
+ footerContainer: {marginHorizontal: '5%', marginTop: '3%'},
});
export default TagFriendsScreen;
diff --git a/src/screens/profile/CaptionScreen.tsx b/src/screens/profile/CaptionScreen.tsx
index 188ccc1f..43665428 100644
--- a/src/screens/profile/CaptionScreen.tsx
+++ b/src/screens/profile/CaptionScreen.tsx
@@ -176,28 +176,13 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
selectedUsers: taggedUsers,
})
}
- style={{
- marginHorizontal: '5%',
- marginTop: '3%',
- flexDirection: 'row',
- justifyContent: 'space-between',
- alignItems: 'center',
- }}>
+ style={styles.tagFriendsContainer}>
<Image
source={require('../../assets/icons/tagging/tag-icon.png')}
- style={{width: 20, height: 20}}
+ style={styles.tagIcon}
/>
<Text style={styles.tagFriendsTitle}>Tag Friends</Text>
- <Text
- numberOfLines={1}
- style={{
- color: 'white',
- width: 150,
- fontSize: normalize(10),
- lineHeight: normalize(11),
- letterSpacing: normalize(0.3),
- textAlign: 'right',
- }}>
+ <Text numberOfLines={1} style={styles.taggedListContainer}>
{taggedList}
{taggedList.length > 21 ? '. . .' : ''}
</Text>
@@ -255,9 +240,21 @@ const styles = StyleSheet.create({
fontWeight: '600',
},
tagFriendsContainer: {
- flexDirection: 'row',
+ marginHorizontal: '5%',
marginTop: '3%',
+ flexDirection: 'row',
+ justifyContent: 'space-between',
+ alignItems: 'center',
+ },
+ taggedListContainer: {
+ color: 'white',
+ width: 150,
+ fontSize: normalize(10),
+ lineHeight: normalize(11),
+ letterSpacing: normalize(0.3),
+ textAlign: 'right',
},
+ tagIcon: {width: 20, height: 20},
});
export default CaptionScreen;
diff --git a/src/screens/profile/IndividualMoment.tsx b/src/screens/profile/IndividualMoment.tsx
index 4baca5b2..515cbacf 100644
--- a/src/screens/profile/IndividualMoment.tsx
+++ b/src/screens/profile/IndividualMoment.tsx
@@ -1,17 +1,14 @@
-import AsyncStorage from '@react-native-community/async-storage';
import {BlurView} from '@react-native-community/blur';
import {RouteProp} from '@react-navigation/native';
import {StackNavigationProp} from '@react-navigation/stack';
import React from 'react';
-import {Alert, FlatList, StyleSheet, View} from 'react-native';
+import {FlatList, StyleSheet, View} from 'react-native';
import {useSelector} from 'react-redux';
import {
IndividualMomentTitleBar,
MomentPostContent,
MomentPostHeader,
} from '../../components';
-import {MOMENT_TAGS_ENDPOINT} from '../../constants';
-import {ERROR_SOMETHING_WENT_WRONG_REFRESH} from '../../constants/strings';
import {MainStackParams} from '../../routes';
import {RootState} from '../../store/rootreducer';
import {MomentType} from '../../types';
diff --git a/src/screens/profile/MomentCommentsScreen.tsx b/src/screens/profile/MomentCommentsScreen.tsx
index 4b332b56..402e5f44 100644
--- a/src/screens/profile/MomentCommentsScreen.tsx
+++ b/src/screens/profile/MomentCommentsScreen.tsx
@@ -44,14 +44,12 @@ const MomentCommentsScreen: React.FC<MomentCommentsScreenProps> = ({route}) => {
//Receives comment length from child CommentsContainer
const [commentsLength, setCommentsLength] = useState<number>(0);
- const [shouldUpdateAllComments, setShouldUpdateAllComments] = React.useState(
- true,
- );
+ const [shouldUpdateAllComments, setShouldUpdateAllComments] =
+ React.useState(true);
//Keeps track of the current comments object in focus so that the application knows which comment to post a reply to
- const [commentTapped, setCommentTapped] = useState<
- CommentType | CommentThreadType | undefined
- >();
+ const [commentTapped, setCommentTapped] =
+ useState<CommentType | CommentThreadType | undefined>();
useEffect(() => {
navigation.setOptions({
diff --git a/src/screens/profile/MomentUploadPromptScreen.tsx b/src/screens/profile/MomentUploadPromptScreen.tsx
index f0aaffc4..7e04063c 100644
--- a/src/screens/profile/MomentUploadPromptScreen.tsx
+++ b/src/screens/profile/MomentUploadPromptScreen.tsx
@@ -28,12 +28,8 @@ const MomentUploadPromptScreen: React.FC<MomentUploadPromptScreenProps> = ({
route,
navigation,
}) => {
- const {
- screenType,
- momentCategory,
- profileBodyHeight,
- socialsBarHeight,
- } = route.params;
+ const {screenType, momentCategory, profileBodyHeight, socialsBarHeight} =
+ route.params;
return (
<View style={styles.container}>
<CloseIcon
diff --git a/src/screens/profile/SocialMediaTaggs.tsx b/src/screens/profile/SocialMediaTaggs.tsx
index 52d20683..0e2ebb63 100644
--- a/src/screens/profile/SocialMediaTaggs.tsx
+++ b/src/screens/profile/SocialMediaTaggs.tsx
@@ -85,9 +85,9 @@ const SocialMediaTaggs: React.FC<SocialMediaTaggsProps> = ({
type={socialMediaType}
handle={accountData?.handle}
/>
- {(accountData?.posts as Array<
- SimplePostType | TwitterPostType
- >).map((post, index) =>
+ {(
+ accountData?.posts as Array<SimplePostType | TwitterPostType>
+ ).map((post, index) =>
socialMediaType === 'Twitter' ? (
<TwitterTaggPost
key={index}
diff --git a/src/screens/suggestedPeople/MutualBadgeHolders.tsx b/src/screens/suggestedPeople/MutualBadgeHolders.tsx
index e3b69f7a..f715bd5e 100644
--- a/src/screens/suggestedPeople/MutualBadgeHolders.tsx
+++ b/src/screens/suggestedPeople/MutualBadgeHolders.tsx
@@ -37,9 +37,8 @@ const MutualBadgeHolders: React.FC<MutualBadgeHoldersProps> = ({
useEffect(() => {
const getUsers = async () => {
- let localUsers:
- | ProfilePreviewType[]
- | undefined = await getMutualBadgeHolders(badge_id);
+ let localUsers: ProfilePreviewType[] | undefined =
+ await getMutualBadgeHolders(badge_id);
setUsers(localUsers);
};
diff --git a/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx b/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx
index af5fd579..f5a9f280 100644
--- a/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx
+++ b/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx
@@ -38,139 +38,138 @@ type SuggestedPeopleUploadPictureScreenProps = {
route: SuggestedPeopleUploadPictureScreenRouteProp;
};
-const SuggestedPeopleUploadPictureScreen: React.FC<SuggestedPeopleUploadPictureScreenProps> = ({
- route,
-}) => {
- const {editing} = route.params;
- const [image, setImage] = useState<string | undefined>(undefined);
- const [oldImage, setOldImage] = useState<string | undefined>(undefined);
- const [loading, setLoading] = useState(false);
- const dispatch = useDispatch();
- const navigation = useNavigation();
- const {
- user: {userId: loggedInUserId},
- } = useSelector((state: RootState) => state.user);
+const SuggestedPeopleUploadPictureScreen: React.FC<SuggestedPeopleUploadPictureScreenProps> =
+ ({route}) => {
+ const {editing} = route.params;
+ const [image, setImage] = useState<string | undefined>(undefined);
+ const [oldImage, setOldImage] = useState<string | undefined>(undefined);
+ const [loading, setLoading] = useState(false);
+ const dispatch = useDispatch();
+ const navigation = useNavigation();
+ const {
+ user: {userId: loggedInUserId},
+ } = useSelector((state: RootState) => state.user);
- useEffect(() => {
- const loadData = async () => {
- const response = await getSuggestedPeopleProfile(loggedInUserId);
- if (response) {
- setImage(response.suggested_people_url);
- setOldImage(response.suggested_people_url);
+ useEffect(() => {
+ const loadData = async () => {
+ const response = await getSuggestedPeopleProfile(loggedInUserId);
+ if (response) {
+ setImage(response.suggested_people_url);
+ setOldImage(response.suggested_people_url);
+ }
+ };
+ // if we're in edit SP, attempt to load current sp image
+ if (editing) {
+ loadData();
}
- };
- // if we're in edit SP, attempt to load current sp image
- if (editing) {
- loadData();
- }
- }, []);
+ }, []);
- const openImagePicker = () => {
- ImagePicker.openPicker({
- smartAlbums: [
- 'Favorites',
- 'RecentlyAdded',
- 'SelfPortraits',
- 'Screenshots',
- 'UserLibrary',
- ],
- width: SP_WIDTH,
- height: SP_HEIGHT,
- cropping: true,
- cropperToolbarTitle: 'Select Photo',
- mediaType: 'photo',
- })
- .then((picture) => {
- if ('path' in picture) {
- setImage(picture.path);
- }
+ const openImagePicker = () => {
+ ImagePicker.openPicker({
+ smartAlbums: [
+ 'Favorites',
+ 'RecentlyAdded',
+ 'SelfPortraits',
+ 'Screenshots',
+ 'UserLibrary',
+ ],
+ width: SP_WIDTH,
+ height: SP_HEIGHT,
+ cropping: true,
+ cropperToolbarTitle: 'Select Photo',
+ mediaType: 'photo',
})
- .catch((_) => {});
- };
+ .then((picture) => {
+ if ('path' in picture) {
+ setImage(picture.path);
+ }
+ })
+ .catch((_) => {});
+ };
- const uploadImage = async () => {
- // Uploading image only if initially loaded image is not the same as the image being uploaded
- if (image && oldImage !== image) {
- setLoading(true);
- const success = await sendSuggestedPeoplePhoto(image);
- if (success) {
- dispatch(uploadedSuggestedPeoplePhoto(image));
- if (!editing) {
- navigation.navigate('BadgeSelection', {editing: false});
+ const uploadImage = async () => {
+ // Uploading image only if initially loaded image is not the same as the image being uploaded
+ if (image && oldImage !== image) {
+ setLoading(true);
+ const success = await sendSuggestedPeoplePhoto(image);
+ if (success) {
+ dispatch(uploadedSuggestedPeoplePhoto(image));
+ if (!editing) {
+ navigation.navigate('BadgeSelection', {editing: false});
+ }
+ } else {
+ Alert.alert(ERROR_UPLOAD);
+ }
+ setLoading(false);
+ // Navigated back to Profile if user is editing their Suggested People Picture
+ if (editing) {
+ navigation.goBack();
+ setTimeout(() => {
+ Alert.alert(success ? SUCCESS_PIC_UPLOAD : ERROR_UPLOAD_SP_PHOTO);
+ }, 500);
}
- } else {
- Alert.alert(ERROR_UPLOAD);
- }
- setLoading(false);
- // Navigated back to Profile if user is editing their Suggested People Picture
- if (editing) {
- navigation.goBack();
- setTimeout(() => {
- Alert.alert(success ? SUCCESS_PIC_UPLOAD : ERROR_UPLOAD_SP_PHOTO);
- }, 500);
}
- }
- };
+ };
- return (
- <>
- {loading && <TaggLoadingIndicator fullscreen />}
- <StatusBar barStyle={'light-content'} />
- <SafeAreaView style={styles.container}>
- <Text style={editing ? styles.titleEditSuggested : styles.titlePHOTO}>
- {editing ? 'Edit Suggested' : 'PHOTO'}
- </Text>
- {image ? (
- <Text style={styles.body}>
- {editing
- ? 'Tap to upload new photo'
- : 'Tap again to choose another photo'}
+ return (
+ <>
+ {loading && <TaggLoadingIndicator fullscreen />}
+ <StatusBar barStyle={'light-content'} />
+ <SafeAreaView style={styles.container}>
+ <Text style={editing ? styles.titleEditSuggested : styles.titlePHOTO}>
+ {editing ? 'Edit Suggested' : 'PHOTO'}
</Text>
- ) : (
- <Text style={styles.body}>
- Upload a photo, this is what other users will see
- </Text>
- )}
- {image ? (
- <TouchableOpacity onPress={openImagePicker}>
- <ImageBackground
- source={{uri: image, cache: 'reload'}}
- style={[styles.imageContainer, styles.overlay]}
- borderRadius={30}>
- <Image
- style={styles.overlay}
+ {image ? (
+ <Text style={styles.body}>
+ {editing
+ ? 'Tap to upload new photo'
+ : 'Tap again to choose another photo'}
+ </Text>
+ ) : (
+ <Text style={styles.body}>
+ Upload a photo, this is what other users will see
+ </Text>
+ )}
+ {image ? (
+ <TouchableOpacity onPress={openImagePicker}>
+ <ImageBackground
+ source={{uri: image, cache: 'reload'}}
+ style={[styles.imageContainer, styles.overlay]}
+ borderRadius={30}>
+ <Image
+ style={styles.overlay}
+ source={require('../../assets/images/suggested-people-preview-silhouette.png')}
+ />
+ </ImageBackground>
+ </TouchableOpacity>
+ ) : (
+ <TouchableOpacity onPress={openImagePicker}>
+ <ImageBackground
source={require('../../assets/images/suggested-people-preview-silhouette.png')}
- />
- </ImageBackground>
- </TouchableOpacity>
- ) : (
- <TouchableOpacity onPress={openImagePicker}>
- <ImageBackground
- source={require('../../assets/images/suggested-people-preview-silhouette.png')}
- style={[styles.imageContainer, styles.overlay]}>
- <Image
- style={styles.images}
- source={require('../../assets/images/images.png')}
- />
- <Text style={styles.body}>Upload Photo</Text>
- </ImageBackground>
- </TouchableOpacity>
- )}
- {image && (
- <TaggSquareButton
- onPress={uploadImage}
- title={'Done'}
- buttonStyle={'normal'}
- buttonColor={editing ? 'blue' : 'purple'}
- labelColor={'white'}
- style={styles.buttonStyle}
- labelStyle={styles.buttonLabel}
- />
- )}
- </SafeAreaView>
- </>
- );
-};
+ style={[styles.imageContainer, styles.overlay]}>
+ <Image
+ style={styles.images}
+ source={require('../../assets/images/images.png')}
+ />
+ <Text style={styles.body}>Upload Photo</Text>
+ </ImageBackground>
+ </TouchableOpacity>
+ )}
+ {image && (
+ <TaggSquareButton
+ onPress={uploadImage}
+ title={'Done'}
+ buttonStyle={'normal'}
+ buttonColor={editing ? 'blue' : 'purple'}
+ labelColor={'white'}
+ style={styles.buttonStyle}
+ labelStyle={styles.buttonLabel}
+ />
+ )}
+ </SafeAreaView>
+ </>
+ );
+ };
const styles = StyleSheet.create({
container: {
diff --git a/src/services/NotificationService.ts b/src/services/NotificationService.ts
index a62b0df9..c5c843f5 100644
--- a/src/services/NotificationService.ts
+++ b/src/services/NotificationService.ts
@@ -2,31 +2,30 @@ import AsyncStorage from '@react-native-community/async-storage';
import {NOTIFICATIONS_ENDPOINT} from '../constants';
import {NotificationType} from '../types';
-export const getNotificationsData: () => Promise<
- NotificationType[]
-> = async () => {
- try {
- const token = await AsyncStorage.getItem('token');
- const response = await fetch(NOTIFICATIONS_ENDPOINT, {
- method: 'GET',
- headers: {
- Authorization: 'Token ' + token,
- },
- });
- if (response.status === 200) {
- const data: any[] = await response.json();
- let typedData: NotificationType[] = [];
- for (const o of data) {
- typedData.push({
- ...o.notification,
- unread: false,
- });
+export const getNotificationsData: () => Promise<NotificationType[]> =
+ async () => {
+ try {
+ const token = await AsyncStorage.getItem('token');
+ const response = await fetch(NOTIFICATIONS_ENDPOINT, {
+ method: 'GET',
+ headers: {
+ Authorization: 'Token ' + token,
+ },
+ });
+ if (response.status === 200) {
+ const data: any[] = await response.json();
+ let typedData: NotificationType[] = [];
+ for (const o of data) {
+ typedData.push({
+ ...o.notification,
+ unread: false,
+ });
+ }
+ return typedData;
}
- return typedData;
+ return [];
+ } catch (error) {
+ console.log('Unable to fetch notifications');
+ return [];
}
- return [];
- } catch (error) {
- console.log('Unable to fetch notifications');
- return [];
- }
-};
+ };
diff --git a/src/services/SocialLinkingService.ts b/src/services/SocialLinkingService.ts
index 90b26c96..77caceec 100644
--- a/src/services/SocialLinkingService.ts
+++ b/src/services/SocialLinkingService.ts
@@ -107,17 +107,16 @@ export const registerIntegratedSocialLink: (
// Twitter is a special case since they use OAuth1, we will need to request
// for a request_token before we can begin browser signin.
-export const getTwitterRequestToken: (
- user_token: string,
-) => Promise<string> = async (user_token) => {
- const response = await fetch(integratedEndpoints.Twitter[0], {
- method: 'GET',
- headers: {
- Authorization: `Token ${user_token}`,
- },
- });
- return response.url;
-};
+export const getTwitterRequestToken: (user_token: string) => Promise<string> =
+ async (user_token) => {
+ const response = await fetch(integratedEndpoints.Twitter[0], {
+ method: 'GET',
+ headers: {
+ Authorization: `Token ${user_token}`,
+ },
+ });
+ return response.url;
+ };
// one stop shop for handling all browser sign-in social linkings
export const handlePressForAuthBrowser: (
diff --git a/src/store/actions/momentCategories.tsx b/src/store/actions/momentCategories.tsx
index c91e9ec8..bac27db2 100644
--- a/src/store/actions/momentCategories.tsx
+++ b/src/store/actions/momentCategories.tsx
@@ -11,54 +11,54 @@ import {getTokenOrLogout} from '../../utils';
* Load all categories for user
* @param userId id of the user for whom categories should be loaded
*/
-export const loadUserMomentCategories = (
- userId: string,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- const token = await getTokenOrLogout(dispatch);
- const categories = await loadMomentCategories(userId, token);
- dispatch({
- type: momentCategoriesFetched.type,
- payload: {categories},
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const loadUserMomentCategories =
+ (
+ userId: string,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ const token = await getTokenOrLogout(dispatch);
+ const categories = await loadMomentCategories(userId, token);
+ dispatch({
+ type: momentCategoriesFetched.type,
+ payload: {categories},
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
/**
* Handle addition / deletion of categories for a user
* @param categories List of categories
* @param add true if the call to his function is to add categories
*/
-export const updateMomentCategories = (
- categories: string[],
- add: boolean,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- const token = await getTokenOrLogout(dispatch);
- let success = false;
- let stage: number | undefined = 1;
+export const updateMomentCategories =
+ (
+ categories: string[],
+ add: boolean,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ const token = await getTokenOrLogout(dispatch);
+ let success = false;
+ let stage: number | undefined = 1;
- stage = await postMomentCategories(categories, token);
- success = stage ? true : false;
- if (success) {
- dispatch({
- type: momentCategoriesFetched.type,
- payload: {categories},
- });
- if (add) {
+ stage = await postMomentCategories(categories, token);
+ success = stage ? true : false;
+ if (success) {
dispatch({
- type: profileCompletionStageUpdated.type,
- payload: {stage},
+ type: momentCategoriesFetched.type,
+ payload: {categories},
});
+ if (add) {
+ dispatch({
+ type: profileCompletionStageUpdated.type,
+ payload: {stage},
+ });
+ }
}
+ } catch (error) {
+ console.log(error);
}
- } catch (error) {
- console.log(error);
- }
-};
+ };
diff --git a/src/store/actions/notifications.ts b/src/store/actions/notifications.ts
index bace1776..88a1cf94 100644
--- a/src/store/actions/notifications.ts
+++ b/src/store/actions/notifications.ts
@@ -3,19 +3,16 @@ import {getNotificationsData} from '../../services';
import {userNotificationsFetched} from '../reducers';
import {RootState} from '../rootReducer';
-export const loadUserNotifications = (): ThunkAction<
- Promise<void>,
- RootState,
- unknown,
- Action<string>
-> => async (dispatch) => {
- try {
- const notifications = await getNotificationsData();
- dispatch({
- type: userNotificationsFetched.type,
- payload: notifications,
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const loadUserNotifications =
+ (): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ const notifications = await getNotificationsData();
+ dispatch({
+ type: userNotificationsFetched.type,
+ payload: notifications,
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
diff --git a/src/store/actions/socials.ts b/src/store/actions/socials.ts
index f79b4ad1..1824ca53 100644
--- a/src/store/actions/socials.ts
+++ b/src/store/actions/socials.ts
@@ -4,35 +4,35 @@ import {Action, ThunkAction} from '@reduxjs/toolkit';
import {userSocialsFetched, individualSocialfetched} from '../reducers';
import {loadAllSocialsForUser} from '../../utils';
-export const loadIndividualSocial = (
- userId: string,
- socialType: string,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- const social = await loadSocialPosts(userId, socialType);
- dispatch({
- type: individualSocialfetched.type,
- payload: {socialType, social},
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const loadIndividualSocial =
+ (
+ userId: string,
+ socialType: string,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ const social = await loadSocialPosts(userId, socialType);
+ dispatch({
+ type: individualSocialfetched.type,
+ payload: {socialType, social},
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
-export const loadAllSocials = (
- userId: string,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- const socials = await loadAllSocialsForUser(userId);
- dispatch({
- type: userSocialsFetched.type,
- payload: socials,
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const loadAllSocials =
+ (
+ userId: string,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ const socials = await loadAllSocialsForUser(userId);
+ dispatch({
+ type: userSocialsFetched.type,
+ payload: socials,
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
diff --git a/src/store/actions/taggUsers.ts b/src/store/actions/taggUsers.ts
index 0cd94e92..bcb39cc5 100644
--- a/src/store/actions/taggUsers.ts
+++ b/src/store/actions/taggUsers.ts
@@ -3,19 +3,16 @@ import {loadRecentlySearchedUsers} from '../../services';
import {taggUsersFetched} from '../reducers';
import {RootState} from '../rootReducer';
-export const loadRecentlySearched = (): ThunkAction<
- Promise<void>,
- RootState,
- unknown,
- Action<string>
-> => async (dispatch) => {
- try {
- const recentSearches = await loadRecentlySearchedUsers();
- dispatch({
- type: taggUsersFetched.type,
- payload: {recentSearches},
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const loadRecentlySearched =
+ (): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ const recentSearches = await loadRecentlySearchedUsers();
+ dispatch({
+ type: taggUsersFetched.type,
+ payload: {recentSearches},
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts
index 96e636f6..941101df 100644
--- a/src/store/actions/user.ts
+++ b/src/store/actions/user.ts
@@ -36,220 +36,219 @@ import {CommentThreadType} from './../../types/types';
* https://github.com/reduxjs/redux-thunk
*/
-export const loadUserData = (
- user: UserType,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- await dispatch({type: userLoggedIn.type, payload: user});
- const token = await getTokenOrLogout(dispatch);
- const [profile, avatar, cover] = await Promise.all([
- loadProfileInfo(token, user.userId),
- getProfilePic(token, user.userId, 'profile'),
- getProfilePic(token, user.userId, 'header'),
- ]);
- dispatch({
- type: userDetailsFetched.type,
- payload: {profile, cover, avatar},
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const loadUserData =
+ (
+ user: UserType,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ await dispatch({type: userLoggedIn.type, payload: user});
+ const token = await getTokenOrLogout(dispatch);
+ const [profile, avatar, cover] = await Promise.all([
+ loadProfileInfo(token, user.userId),
+ getProfilePic(token, user.userId, 'profile'),
+ getProfilePic(token, user.userId, 'header'),
+ ]);
+ dispatch({
+ type: userDetailsFetched.type,
+ payload: {profile, cover, avatar},
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
-export const resetHeaderAndProfileImage = (): ThunkAction<
- Promise<void>,
- RootState,
- unknown,
- Action<string>
-> => async (dispatch) => {
- await dispatch({
- type: clearHeaderAndProfileImages.type,
- payload: {},
- });
-};
+export const resetHeaderAndProfileImage =
+ (): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ await dispatch({
+ type: clearHeaderAndProfileImages.type,
+ payload: {},
+ });
+ };
/**
* To update editable socials
* @param social social to be updated
* @param value username of social to be updated
*/
-export const updateSocial = (
- social: string,
- value: string,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- dispatch({
- type: socialEdited.type,
- payload: {social, value},
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const updateSocial =
+ (
+ social: string,
+ value: string,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ dispatch({
+ type: socialEdited.type,
+ payload: {social, value},
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
/**
* To update new user badges
* @param badges current selection of badges
*/
-export const updateUserBadges = (
- badges: UniversityBadge[],
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- dispatch({
- type: profileBadgesUpdated.type,
- payload: {badges},
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const updateUserBadges =
+ (
+ badges: UniversityBadge[],
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ dispatch({
+ type: profileBadgesUpdated.type,
+ payload: {badges},
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
-export const updateProfileCompletionStage = (
- stage: number,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- dispatch({
- type: profileCompletionStageUpdated.type,
- payload: {stage},
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const updateProfileCompletionStage =
+ (
+ stage: number,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ dispatch({
+ type: profileCompletionStageUpdated.type,
+ payload: {stage},
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
-export const updateIsOnboardedUser = (
- isOnboardedUser: boolean,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- dispatch({
- type: setIsOnboardedUser.type,
- payload: {isOnboardedUser},
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const updateIsOnboardedUser =
+ (
+ isOnboardedUser: boolean,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ dispatch({
+ type: setIsOnboardedUser.type,
+ payload: {isOnboardedUser},
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
-export const updateNewVersionAvailable = (
- newVersionAvailable: boolean,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- dispatch({
- type: setNewVersionAvailable.type,
- payload: {newVersionAvailable},
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const updateNewVersionAvailable =
+ (
+ newVersionAvailable: boolean,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ dispatch({
+ type: setNewVersionAvailable.type,
+ payload: {newVersionAvailable},
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
-export const updateNewNotificationReceived = (
- newNotificationReceived: boolean,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- dispatch({
- type: setNewNotificationReceived.type,
- payload: {newNotificationReceived},
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const updateNewNotificationReceived =
+ (
+ newNotificationReceived: boolean,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ dispatch({
+ type: setNewNotificationReceived.type,
+ payload: {newNotificationReceived},
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
-export const updateReplyPosted = (
- replyPosted: CommentThreadType | undefined,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- dispatch({
- type: setReplyPosted.type,
- payload: {replyPosted},
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const updateReplyPosted =
+ (
+ replyPosted: CommentThreadType | undefined,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ dispatch({
+ type: setReplyPosted.type,
+ payload: {replyPosted},
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
-export const logout = (
- client?: StreamChat,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- // do our best effort here to gracefully disconnect the user
- if (client) {
- client.disconnectUser();
+export const logout =
+ (
+ client?: StreamChat,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ // do our best effort here to gracefully disconnect the user
+ if (client) {
+ client.disconnectUser();
+ }
+ await AsyncStorage.clear();
+ dispatch({type: userLoggedIn.type, payload: {userId: '', username: ''}});
+ } catch (error) {
+ console.log(error);
}
- await AsyncStorage.clear();
- dispatch({type: userLoggedIn.type, payload: {userId: '', username: ''}});
- } catch (error) {
- console.log(error);
- }
-};
+ };
-export const uploadedSuggestedPeoplePhoto = (
- imageUri: string,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- await dispatch({
- type: setSuggestedPeopleImage.type,
- payload: {suggestedPeopleImage: imageUri},
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const uploadedSuggestedPeoplePhoto =
+ (
+ imageUri: string,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ await dispatch({
+ type: setSuggestedPeopleImage.type,
+ payload: {suggestedPeopleImage: imageUri},
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
-export const suggestedPeopleBadgesFinished = (): ThunkAction<
- Promise<void>,
- RootState,
- unknown,
- Action<string>
-> => async (dispatch) => {
- try {
- dispatch({
- type: setSuggestedPeopleLinked.type,
- payload: {suggested_people_linked: 1},
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const suggestedPeopleBadgesFinished =
+ (): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ dispatch({
+ type: setSuggestedPeopleLinked.type,
+ payload: {suggested_people_linked: 1},
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
-export const suggestedPeopleAnimatedTutorialFinished = (
- userId: string,
-): ThunkAction<
- Promise<boolean | undefined>,
- RootState,
- unknown,
- Action<string>
-> => async (dispatch) => {
- try {
- // update store first, assume request is successful
- dispatch({
- type: setSuggestedPeopleLinked.type,
- payload: {suggested_people_linked: 2},
- });
- // need to tell the server that the stage is now 2
- return await sendSuggestedPeopleLinked(userId, 2);
- } catch (error) {
- console.log('Error while updating suggested people linked state: ', error);
- }
-};
+export const suggestedPeopleAnimatedTutorialFinished =
+ (
+ userId: string,
+ ): ThunkAction<
+ Promise<boolean | undefined>,
+ RootState,
+ unknown,
+ Action<string>
+ > =>
+ async (dispatch) => {
+ try {
+ // update store first, assume request is successful
+ dispatch({
+ type: setSuggestedPeopleLinked.type,
+ payload: {suggested_people_linked: 2},
+ });
+ // need to tell the server that the stage is now 2
+ return await sendSuggestedPeopleLinked(userId, 2);
+ } catch (error) {
+ console.log(
+ 'Error while updating suggested people linked state: ',
+ error,
+ );
+ }
+ };
diff --git a/src/store/actions/userBlock.ts b/src/store/actions/userBlock.ts
index be6f9331..82796682 100644
--- a/src/store/actions/userBlock.ts
+++ b/src/store/actions/userBlock.ts
@@ -5,44 +5,44 @@ import {getTokenOrLogout} from '../../utils';
import {updateBlockedList, userBlockFetched} from '../reducers';
import {RootState} from '../rootReducer';
-export const loadBlockedList = (
- userId: string,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- const token = await getTokenOrLogout(dispatch);
- const blocked = await loadBlockedUsers(userId, token);
- dispatch({
- type: userBlockFetched.type,
- payload: blocked,
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const loadBlockedList =
+ (
+ userId: string,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ const token = await getTokenOrLogout(dispatch);
+ const blocked = await loadBlockedUsers(userId, token);
+ dispatch({
+ type: userBlockFetched.type,
+ payload: blocked,
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
-export const blockUnblockUser = (
- blocker: UserType,
- blocked: ProfilePreviewType,
- isBlocked: boolean,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- const token = await getTokenOrLogout(dispatch);
- const success = blockOrUnblockUser(
- blocker.userId,
- blocked.id,
- token,
- isBlocked,
- );
- if (success) {
- dispatch({
- type: updateBlockedList.type,
- payload: {
- isBlocked,
- data: blocked,
- },
- });
- }
-};
+export const blockUnblockUser =
+ (
+ blocker: UserType,
+ blocked: ProfilePreviewType,
+ isBlocked: boolean,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ const token = await getTokenOrLogout(dispatch);
+ const success = blockOrUnblockUser(
+ blocker.userId,
+ blocked.id,
+ token,
+ isBlocked,
+ );
+ if (success) {
+ dispatch({
+ type: updateBlockedList.type,
+ payload: {
+ isBlocked,
+ data: blocked,
+ },
+ });
+ }
+ };
diff --git a/src/store/actions/userFriends.ts b/src/store/actions/userFriends.ts
index 4183d0f6..07dab544 100644
--- a/src/store/actions/userFriends.ts
+++ b/src/store/actions/userFriends.ts
@@ -20,196 +20,198 @@ import {
} from '../reducers';
import {RootState} from '../rootReducer';
-export const loadFriendsData = (
- userId: string,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- const token = await getTokenOrLogout(dispatch);
- const friends = await loadFriends(userId, token);
- dispatch({
- type: userFriendsFetched.type,
- payload: {friends},
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const loadFriendsData =
+ (
+ userId: string,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ const token = await getTokenOrLogout(dispatch);
+ const friends = await loadFriends(userId, token);
+ dispatch({
+ type: userFriendsFetched.type,
+ payload: {friends},
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
+
+export const friendUnfriendUser =
+ (
+ user: UserType, //logged in user
+ friend: ProfilePreviewType, // userX's profile preview
+ friendship_status: FriendshipStatusType, // friendshp status with userx
+ screenType: ScreenType, //screentype from content
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ const token = await getTokenOrLogout(dispatch);
+ // Calls method to send post or delete request
+ const success = await friendOrUnfriendUser(
+ friend.id,
+ token,
+ friendship_status,
+ );
+ if (success) {
+ let data = 'no_record';
+ switch (friendship_status) {
+ case 'no_record': // send request: update to requested
+ data = 'requested';
+ break;
+ case 'requested': // cancel request: update to no relationship
+ break;
+ case 'friends': // unfriend: update to no relationship
+ dispatch({
+ type: updateFriends.type,
+ payload: {
+ data: friend,
+ isFriend: true,
+ },
+ });
+ data = 'no_record';
+ break;
+ }
+ dispatch({
+ type: userXFriendshipEdited.type,
+ payload: {
+ userId: friend.id,
+ screenType,
+ data,
+ },
+ });
+ }
+ } catch (error) {
+ console.log(error);
+ }
+ };
-export const friendUnfriendUser = (
- user: UserType, //logged in user
- friend: ProfilePreviewType, // userX's profile preview
- friendship_status: FriendshipStatusType, // friendshp status with userx
- screenType: ScreenType, //screentype from content
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- const token = await getTokenOrLogout(dispatch);
- // Calls method to send post or delete request
- const success = await friendOrUnfriendUser(
- friend.id,
- token,
- friendship_status,
- );
- if (success) {
- let data = 'no_record';
- switch (friendship_status) {
- case 'no_record': // send request: update to requested
- data = 'requested';
- break;
- case 'requested': // cancel request: update to no relationship
- break;
- case 'friends': // unfriend: update to no relationship
+export const addFriend =
+ (
+ friend: ProfilePreviewType, // userX's profile preview
+ screenType: ScreenType, //screentype from content
+ state: RootState,
+ ): ThunkAction<
+ Promise<boolean | undefined>,
+ RootState,
+ unknown,
+ Action<string>
+ > =>
+ async (dispatch) => {
+ try {
+ const token = await getTokenOrLogout(dispatch);
+ const success = await addFriendService(friend.id, token);
+ if (success) {
+ if (userXInStore(state, screenType, friend.id)) {
dispatch({
- type: updateFriends.type,
+ type: userXFriendshipEdited.type,
payload: {
- data: friend,
- isFriend: true,
+ userId: friend.id,
+ screen: screenType,
+ data: 'requested',
},
});
- data = 'no_record';
- break;
+ }
+ return true;
}
- dispatch({
- type: userXFriendshipEdited.type,
- payload: {
- userId: friend.id,
- screenType,
- data,
- },
- });
+ } catch (error) {
+ console.log(error);
}
- } catch (error) {
- console.log(error);
- }
-};
+ };
-export const addFriend = (
- friend: ProfilePreviewType, // userX's profile preview
- screenType: ScreenType, //screentype from content
- state: RootState,
-): ThunkAction<
- Promise<boolean | undefined>,
- RootState,
- unknown,
- Action<string>
-> => async (dispatch) => {
- try {
- const token = await getTokenOrLogout(dispatch);
- const success = await addFriendService(friend.id, token);
- if (success) {
- if (userXInStore(state, screenType, friend.id)) {
- dispatch({
+export const unfriendUser =
+ (
+ friend: ProfilePreviewType, // userX's profile preview
+ screenType: ScreenType, //screentype from content
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ const token = await getTokenOrLogout(dispatch);
+ // Calls method to send post or delete request
+ const reason = 'unfriended';
+ const success = await deleteFriendshipService(friend.id, reason, token);
+ if (success) {
+ let data = 'no_record';
+ await dispatch({
+ type: updateFriends.type,
+ payload: {
+ data: friend,
+ isFriend: true,
+ },
+ });
+ await dispatch({
type: userXFriendshipEdited.type,
payload: {
userId: friend.id,
- screen: screenType,
- data: 'requested',
+ screenType,
+ data,
},
});
}
- return true;
- }
- } catch (error) {
- console.log(error);
- }
-};
-
-export const unfriendUser = (
- friend: ProfilePreviewType, // userX's profile preview
- screenType: ScreenType, //screentype from content
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- const token = await getTokenOrLogout(dispatch);
- // Calls method to send post or delete request
- const reason = 'unfriended';
- const success = await deleteFriendshipService(friend.id, reason, token);
- if (success) {
- let data = 'no_record';
- await dispatch({
- type: updateFriends.type,
- payload: {
- data: friend,
- isFriend: true,
- },
- });
- await dispatch({
- type: userXFriendshipEdited.type,
- payload: {
- userId: friend.id,
- screenType,
- data,
- },
- });
+ } catch (error) {
+ console.log(error);
}
- } catch (error) {
- console.log(error);
- }
-};
+ };
-export const acceptFriendRequest = (
- requester: ProfilePreviewType,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- const token = await getTokenOrLogout(dispatch);
- const success = await acceptFriendRequestService(requester.id, token);
- if (success) {
- dispatch({
- type: updateFriends.type,
- payload: {
- data: requester,
- isFriend: false,
- },
- });
+export const acceptFriendRequest =
+ (
+ requester: ProfilePreviewType,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ const token = await getTokenOrLogout(dispatch);
+ const success = await acceptFriendRequestService(requester.id, token);
+ if (success) {
+ dispatch({
+ type: updateFriends.type,
+ payload: {
+ data: requester,
+ isFriend: false,
+ },
+ });
+ }
+ } catch (error) {
+ console.log(error);
}
- } catch (error) {
- console.log(error);
- }
-};
+ };
-export const declineFriendRequest = (
- user_id: string,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- const token = await getTokenOrLogout(dispatch);
- const reason = 'declined';
- const success = await deleteFriendshipService(user_id, reason, token);
- if (success) {
- // Get profile of requester
- console.log('declined request: ', success);
- } else {
- console.log('Unsuccessful call');
+export const declineFriendRequest =
+ (
+ user_id: string,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ const token = await getTokenOrLogout(dispatch);
+ const reason = 'declined';
+ const success = await deleteFriendshipService(user_id, reason, token);
+ if (success) {
+ // Get profile of requester
+ console.log('declined request: ', success);
+ } else {
+ console.log('Unsuccessful call');
+ }
+ } catch (error) {
+ console.log(error);
}
- } catch (error) {
- console.log(error);
- }
-};
+ };
-export const cancelFriendRequest = (
- user_id: string,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- console.log('cancelFriendRequest!');
- const token = await getTokenOrLogout(dispatch);
- const reason = 'cancelled';
- const success = await deleteFriendshipService(user_id, reason, token);
- if (success) {
- // Get profile of requester
- console.log('cancelled request: ', success);
- } else {
- console.log('Unsuccessful call');
+export const cancelFriendRequest =
+ (
+ user_id: string,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ console.log('cancelFriendRequest!');
+ const token = await getTokenOrLogout(dispatch);
+ const reason = 'cancelled';
+ const success = await deleteFriendshipService(user_id, reason, token);
+ if (success) {
+ // Get profile of requester
+ console.log('cancelled request: ', success);
+ } else {
+ console.log('Unsuccessful call');
+ }
+ } catch (error) {
+ console.log(error);
}
- } catch (error) {
- console.log(error);
- }
-};
+ };
diff --git a/src/store/actions/userMoments.ts b/src/store/actions/userMoments.ts
index 4d739129..23cd09ac 100644
--- a/src/store/actions/userMoments.ts
+++ b/src/store/actions/userMoments.ts
@@ -4,34 +4,34 @@ import {Action, ThunkAction} from '@reduxjs/toolkit';
import {userMomentsFetched, momentCategoryDeleted} from '../reducers';
import {getTokenOrLogout} from '../../utils';
-export const loadUserMoments = (
- userId: string,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- const token = await getTokenOrLogout(dispatch);
- const moments = await loadMoments(userId, token);
- dispatch({
- type: userMomentsFetched.type,
- payload: moments,
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const loadUserMoments =
+ (
+ userId: string,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ const token = await getTokenOrLogout(dispatch);
+ const moments = await loadMoments(userId, token);
+ dispatch({
+ type: userMomentsFetched.type,
+ payload: moments,
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
-export const deleteUserMomentsForCategory = (
- category: string,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- dispatch({
- type: momentCategoryDeleted.type,
- payload: category,
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const deleteUserMomentsForCategory =
+ (
+ category: string,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ dispatch({
+ type: momentCategoryDeleted.type,
+ payload: category,
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
diff --git a/src/store/actions/userX.ts b/src/store/actions/userX.ts
index f32a4d8f..855aaeaf 100644
--- a/src/store/actions/userX.ts
+++ b/src/store/actions/userX.ts
@@ -23,138 +23,141 @@ import {RootState} from '../rootReducer';
import {getTokenOrLogout, loadAllSocialsForUser} from './../../utils';
import {userXInStore} from './../../utils/';
-export const loadUserX = (
- user: UserType,
- screenType: ScreenType,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- const {userId} = user;
- await dispatch({type: userXRequested.type, payload: {screenType, userId}});
- await dispatch({
- type: userXUserFetched.type,
- payload: {screenType, userId, user},
- });
- const token = await getTokenOrLogout(dispatch);
- fetchUserProfile(userId, token).then((profile) => {
- if (profile) {
- const birthday = profile.profile_info.birthday;
- dispatch({
- type: userXProfileFetched.type,
- payload: {
- screenType,
- userId,
- data: {
- ...profile.profile_info,
- birthday: birthday && moment(birthday).format('YYYY-MM-DD'),
+export const loadUserX =
+ (
+ user: UserType,
+ screenType: ScreenType,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ const {userId} = user;
+ await dispatch({
+ type: userXRequested.type,
+ payload: {screenType, userId},
+ });
+ await dispatch({
+ type: userXUserFetched.type,
+ payload: {screenType, userId, user},
+ });
+ const token = await getTokenOrLogout(dispatch);
+ fetchUserProfile(userId, token).then((profile) => {
+ if (profile) {
+ const birthday = profile.profile_info.birthday;
+ dispatch({
+ type: userXProfileFetched.type,
+ payload: {
+ screenType,
+ userId,
+ data: {
+ ...profile.profile_info,
+ birthday: birthday && moment(birthday).format('YYYY-MM-DD'),
+ },
},
- },
- });
+ });
+ dispatch({
+ type: userXAvatarFetched.type,
+ payload: {screenType, userId, data: profile.profile_pic},
+ });
+ dispatch({
+ type: userXCoverFetched.type,
+ payload: {screenType, userId, data: profile.header_pic},
+ });
+ dispatch({
+ type: userXMomentCategoriesFetched.type,
+ payload: {screenType, userId, data: profile.moment_categories},
+ });
+ }
+ });
+ loadAllSocialsForUser(userId, token).then((data) =>
dispatch({
- type: userXAvatarFetched.type,
- payload: {screenType, userId, data: profile.profile_pic},
- });
+ type: userXSocialsFetched.type,
+ payload: {screenType, userId, data},
+ }),
+ );
+ loadFriends(userId, token).then((data) =>
dispatch({
- type: userXCoverFetched.type,
- payload: {screenType, userId, data: profile.header_pic},
- });
+ type: userXFriendsFetched.type,
+ payload: {screenType, userId, data},
+ }),
+ );
+ loadMoments(userId, token).then((data) =>
dispatch({
- type: userXMomentCategoriesFetched.type,
- payload: {screenType, userId, data: profile.moment_categories},
- });
- }
- });
- loadAllSocialsForUser(userId, token).then((data) =>
- dispatch({
- type: userXSocialsFetched.type,
- payload: {screenType, userId, data},
- }),
- );
- loadFriends(userId, token).then((data) =>
- dispatch({
- type: userXFriendsFetched.type,
- payload: {screenType, userId, data},
- }),
- );
- loadMoments(userId, token).then((data) =>
- dispatch({
- type: userXMomentsFetched.type,
- payload: {screenType, userId, data},
- }),
- );
- } catch (error) {
- console.log(error);
- }
-};
+ type: userXMomentsFetched.type,
+ payload: {screenType, userId, data},
+ }),
+ );
+ } catch (error) {
+ console.log(error);
+ }
+ };
-export const updateUserXFriends = (
- userId: string,
- state: RootState,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- const screens = <ScreenType[]>[
- ScreenType.Profile,
- ScreenType.Search,
- ScreenType.Notifications,
- ];
- const token = await getTokenOrLogout(dispatch);
- screens.forEach((screenType) => {
- if (userXInStore(state, screenType, userId)) {
- loadFriends(userId, token).then((data) =>
- dispatch({
- type: userXFriendsFetched.type,
- payload: {screenType, userId, data},
- }),
- );
- }
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const updateUserXFriends =
+ (
+ userId: string,
+ state: RootState,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ const screens = <ScreenType[]>[
+ ScreenType.Profile,
+ ScreenType.Search,
+ ScreenType.Notifications,
+ ];
+ const token = await getTokenOrLogout(dispatch);
+ screens.forEach((screenType) => {
+ if (userXInStore(state, screenType, userId)) {
+ loadFriends(userId, token).then((data) =>
+ dispatch({
+ type: userXFriendsFetched.type,
+ payload: {screenType, userId, data},
+ }),
+ );
+ }
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
-export const resetScreenType = (
- screenType: ScreenType,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- dispatch({
- type: resetScreen.type,
- payload: {screenType},
- });
- } catch (error) {
- console.log(error);
- }
-};
+export const resetScreenType =
+ (
+ screenType: ScreenType,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ dispatch({
+ type: resetScreen.type,
+ payload: {screenType},
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
-export const updateUserXProfileAllScreens = (
- userId: string,
- state: RootState,
-): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
- dispatch,
-) => {
- try {
- const screens = <ScreenType[]>[
- ScreenType.Profile,
- ScreenType.Search,
- ScreenType.Notifications,
- ];
- const token = await getTokenOrLogout(dispatch);
- screens.forEach((screenType) => {
- if (userXInStore(state, screenType, userId)) {
- loadProfileInfo(token, userId).then((data) => {
- dispatch({
- type: userXProfileFetched.type,
- payload: {screenType, userId, data},
+export const updateUserXProfileAllScreens =
+ (
+ userId: string,
+ state: RootState,
+ ): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
+ async (dispatch) => {
+ try {
+ const screens = <ScreenType[]>[
+ ScreenType.Profile,
+ ScreenType.Search,
+ ScreenType.Notifications,
+ ];
+ const token = await getTokenOrLogout(dispatch);
+ screens.forEach((screenType) => {
+ if (userXInStore(state, screenType, userId)) {
+ loadProfileInfo(token, userId).then((data) => {
+ dispatch({
+ type: userXProfileFetched.type,
+ payload: {screenType, userId, data},
+ });
});
- });
- }
- });
- } catch (error) {
- console.log(error);
- }
-};
+ }
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ };
diff --git a/src/store/reducers/userMomentsReducer.ts b/src/store/reducers/userMomentsReducer.ts
index 97c9a1fd..e1e8d96c 100644
--- a/src/store/reducers/userMomentsReducer.ts
+++ b/src/store/reducers/userMomentsReducer.ts
@@ -18,8 +18,6 @@ const userMomentsSlice = createSlice({
},
});
-export const {
- userMomentsFetched,
- momentCategoryDeleted,
-} = userMomentsSlice.actions;
+export const {userMomentsFetched, momentCategoryDeleted} =
+ userMomentsSlice.actions;
export const userMomentsReducer = userMomentsSlice.reducer;
diff --git a/src/store/reducers/userSocialsReducer.ts b/src/store/reducers/userSocialsReducer.ts
index de79568c..1186fa80 100644
--- a/src/store/reducers/userSocialsReducer.ts
+++ b/src/store/reducers/userSocialsReducer.ts
@@ -14,8 +14,6 @@ const userSocialsSlice = createSlice({
},
});
-export const {
- userSocialsFetched,
- individualSocialfetched,
-} = userSocialsSlice.actions;
+export const {userSocialsFetched, individualSocialfetched} =
+ userSocialsSlice.actions;
export const userSocialsReducer = userSocialsSlice.reducer;
diff --git a/src/store/reducers/userXReducer.ts b/src/store/reducers/userXReducer.ts
index 9f90d58d..0a9e71bb 100644
--- a/src/store/reducers/userXReducer.ts
+++ b/src/store/reducers/userXReducer.ts
@@ -7,9 +7,8 @@ const userXSlice = createSlice({
initialState: EMPTY_SCREEN_TO_USERS_LIST,
reducers: {
userXRequested: (state, action) => {
- state[<ScreenType>action.payload.screenType][
- action.payload.userId
- ] = EMPTY_USER_X;
+ state[<ScreenType>action.payload.screenType][action.payload.userId] =
+ EMPTY_USER_X;
},
userXProfileFetched: (state, action) => {
diff --git a/src/utils/layouts.ts b/src/utils/layouts.ts
index 4d0d557d..c7b39700 100644
--- a/src/utils/layouts.ts
+++ b/src/utils/layouts.ts
@@ -1,9 +1,8 @@
import {PixelRatio, Platform, StatusBar} from 'react-native';
import {Dimensions} from 'react-native';
-export const {width: SCREEN_WIDTH, height: SCREEN_HEIGHT} = Dimensions.get(
- 'window',
-);
+export const {width: SCREEN_WIDTH, height: SCREEN_HEIGHT} =
+ Dimensions.get('window');
export const SCREEN_RATIO = SCREEN_HEIGHT / SCREEN_WIDTH;