From 8569dafb631d99f325236fb7a134a0087d95b212 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Mon, 15 Mar 2021 15:20:08 -0700 Subject: removed unnecesary concole.log --- src/components/search/SearchBar.tsx | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/components/search/SearchBar.tsx b/src/components/search/SearchBar.tsx index 1a855f20..62bda77e 100644 --- a/src/components/search/SearchBar.tsx +++ b/src/components/search/SearchBar.tsx @@ -70,8 +70,6 @@ const SearchBar: React.FC = ({ // TODO: FIGURE OUT WHY CHANGES IN placeholderId ARE NOT REFLECTED HERE // my thought: the value is set when the function is defined, so it keeps // its inital value of -1 forever. - console.log(`Previous ID: ${placeholderId}`); - console.log(`Next ID: ${nextId}`); setPlaceholderId(nextId); }; -- cgit v1.2.3-70-g09d2 From 1080adb75c18f6da6b91be4264c69a9bf908ff0d Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Thu, 18 Mar 2021 02:06:02 -0700 Subject: works --- .../icons/findFriends/find-friends-blue-icon.svg | 1 + src/components/friends/InviteFriendTile.tsx | 86 ++++++ src/components/friends/index.ts | 1 + src/components/profile/Friends.tsx | 162 +++++++++- src/constants/api.ts | 4 + src/routes/main/MainStackNavigator.tsx | 3 + src/routes/main/MainStackScreen.tsx | 14 + src/screens/profile/FriendsListScreen.tsx | 3 +- src/screens/profile/InviteFriendsScreen.tsx | 330 +++++++++++++++++++++ src/screens/profile/index.ts | 1 + src/store/actions/userFriends.ts | 21 +- src/utils/users.ts | 2 +- 12 files changed, 601 insertions(+), 27 deletions(-) create mode 100644 src/assets/icons/findFriends/find-friends-blue-icon.svg create mode 100644 src/components/friends/InviteFriendTile.tsx create mode 100644 src/components/friends/index.ts create mode 100644 src/screens/profile/InviteFriendsScreen.tsx (limited to 'src') diff --git a/src/assets/icons/findFriends/find-friends-blue-icon.svg b/src/assets/icons/findFriends/find-friends-blue-icon.svg new file mode 100644 index 00000000..26ca145d --- /dev/null +++ b/src/assets/icons/findFriends/find-friends-blue-icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/friends/InviteFriendTile.tsx b/src/components/friends/InviteFriendTile.tsx new file mode 100644 index 00000000..2d2b8e04 --- /dev/null +++ b/src/components/friends/InviteFriendTile.tsx @@ -0,0 +1,86 @@ +import React, {useState} from 'react'; +import { + StyleSheet, + Text, + TouchableOpacity, + TouchableWithoutFeedback, + View, +} from 'react-native'; +import {useSelector} from 'react-redux'; +import {RootState} from '../../store/rootReducer'; +import {TAGG_LIGHT_BLUE} from '../../constants'; +import {inviteFriendService} from '../../services'; +import {normalize} from '../../utils'; + +interface InviteFriendTileProps { + item: Object; +} + +const InviteFriendTile: React.FC = ({item}) => { + const [invited, setInvited] = useState(false); + const {profile} = useSelector((state: RootState) => state.user); + const handleInviteFriend = async () => { + const response = await inviteFriendService( + item.phoneNumber, + item.firstName, + item.lastName, + profile.name, + ); + if (response) { + setInvited(response); + } + }; + + return ( + + + {item.firstName + ' ' + item.lastName} + + + {invited ? 'Invited' : 'Invite'} + + + + + ); +}; + +const styles = StyleSheet.create({ + container: { + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'space-between', + height: normalize(42), + backgroundColor: 'thistle', + }, + label: { + fontWeight: '500', + fontSize: normalize(14), + }, + button: { + alignSelf: 'center', + justifyContent: 'center', + alignItems: 'center', + width: 82, + height: 25, + borderColor: TAGG_LIGHT_BLUE, + borderWidth: 2, + borderRadius: 2, + padding: 0, + backgroundColor: 'transparent', + }, + buttonTitle: { + color: TAGG_LIGHT_BLUE, + padding: 0, + fontSize: normalize(11), + fontWeight: '700', + lineHeight: normalize(13.13), + letterSpacing: normalize(0.6), + paddingHorizontal: '3.8%', + }, +}); + +export default InviteFriendTile; diff --git a/src/components/friends/index.ts b/src/components/friends/index.ts new file mode 100644 index 00000000..42727784 --- /dev/null +++ b/src/components/friends/index.ts @@ -0,0 +1 @@ +export {default as InviteFriendTile} from './InviteFriendTile'; diff --git a/src/components/profile/Friends.tsx b/src/components/profile/Friends.tsx index 7c7265c5..a1030b49 100644 --- a/src/components/profile/Friends.tsx +++ b/src/components/profile/Friends.tsx @@ -1,14 +1,18 @@ -import React from 'react'; -import {View, StyleSheet, ScrollView, Text} from 'react-native'; -import {ProfilePreviewType, ScreenType} from '../../types'; -import {ProfilePreview} from '../profile'; -import {normalize, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; +import {useNavigation} from '@react-navigation/native'; +import React, {useEffect, useState} from 'react'; +import {ScrollView, StyleSheet, Text, View} from 'react-native'; +import {checkPermission, getAll} from 'react-native-contacts'; +import {TouchableOpacity} from 'react-native-gesture-handler'; +import {useDispatch, useSelector, useStore} from 'react-redux'; import {TAGG_LIGHT_BLUE} from '../../constants'; -import {RootState} from '../../store/rootReducer'; -import {useDispatch, useStore} from 'react-redux'; -import {handleUnfriend} from '../../utils/friends'; +import {usersFromContactsService} from '../../services'; import {NO_USER} from '../../store/initialStates'; -import {TouchableOpacity} from 'react-native-gesture-handler'; +import {RootState} from '../../store/rootReducer'; +import {ProfilePreviewType, ScreenType} from '../../types'; +import {normalize, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; +import {handleAddFriend, handleUnfriend} from '../../utils/friends'; +import {ProfilePreview} from '../profile'; +import FindFriendsBlueIcon from '../../assets/icons/findFriends/find-friends-blue-icon.svg'; interface FriendsProps { result: Array; @@ -17,16 +21,102 @@ interface FriendsProps { } const Friends: React.FC = ({result, screenType, userId}) => { - const state: RootState = useStore().getState(); const dispatch = useDispatch(); + const navigation = useNavigation(); + const {user: loggedInUser = NO_USER} = useSelector( + (state: RootState) => state.user, + ); + const state = useStore().getState(); + const [usersFromContacts, setUsersFromContacts] = useState< + ProfilePreviewType[] + >([]); + + const extractPhoneNumbers = async () => { + let phoneNumbers: Array = []; + await getAll().then((contacts) => { + contacts.map((contact) => { + contact.phoneNumbers.map(async (phoneNumber) => { + phoneNumbers.push(await phoneNumber.number); + }); + }); + }); + return phoneNumbers; + }; - const {user: loggedInUser = NO_USER} = state; + useEffect(() => { + const handleFindFriends = () => { + extractPhoneNumbers().then(async (phoneNumbers) => { + const permission = await checkPermission(); + if (permission === 'authorized') { + let response = await usersFromContactsService(phoneNumbers); + await setUsersFromContacts(response.existing_tagg_users); + usersFromContacts.map((user) => console.log('user: ', user.username)); + } else if (permission === 'undefined') { + navigation.navigate('RequestContactsAccess'); + } else { + console.log('Go to settings'); + } + }); + }; + handleFindFriends(); + }, []); + + const UsersFromContacts = () => ( + <> + {usersFromContacts?.splice(0, 2).map((profilePreview) => ( + + + + + { + console.log('screentype: ', screenType); + handleAddFriend(screenType, profilePreview, dispatch, state).then( + (success) => { + if (success) { + let users = usersFromContacts; + setUsersFromContacts( + users.filter( + (user) => user.username !== profilePreview.username, + ), + ); + } + }, + ); + }}> + Add Friend + + + ))} + + ); return ( <> - {/* Friends */} + + Add Friends + + navigation.navigate('InviteFriendsScreen', { + screenType: ScreenType.Profile, + }) + }> + + Find Friends + + + + + Friends + = ({result, screenType, userId}) => { screenType={screenType} /> - {loggedInUser.userId === userId && ( + {loggedInUser.userId !== userId && ( @@ -63,12 +153,19 @@ const styles = StyleSheet.create({ alignSelf: 'center', width: SCREEN_WIDTH * 0.85, }, + firstScrollView: {}, scrollViewContent: { alignSelf: 'center', paddingBottom: SCREEN_HEIGHT / 7, width: SCREEN_WIDTH * 0.85, marginTop: '1%', }, + addFriendHeaderContainer: { + flexDirection: 'row', + justifyContent: 'space-between', + marginBottom: '3%', + marginTop: '2%', + }, header: {flexDirection: 'row'}, subheader: { alignSelf: 'center', @@ -81,6 +178,18 @@ const styles = StyleSheet.create({ fontWeight: '600', lineHeight: normalize(14.32), }, + friendsSubheaderText: { + alignSelf: 'center', + width: SCREEN_WIDTH * 0.85, + marginVertical: '1%', + marginBottom: '2%', + }, + findFriendsSubheaderText: { + color: '#08E2E2', + fontSize: normalize(12), + fontWeight: '600', + lineHeight: normalize(14.32), + }, container: { alignSelf: 'center', flexDirection: 'row', @@ -94,7 +203,7 @@ const styles = StyleSheet.create({ alignSelf: 'center', height: '100%', }, - button: { + addFriendButton: { alignSelf: 'center', justifyContent: 'center', alignItems: 'center', @@ -104,10 +213,31 @@ const styles = StyleSheet.create({ borderWidth: 2, borderRadius: 2, padding: 0, - backgroundColor: 'transparent', + backgroundColor: TAGG_LIGHT_BLUE, + }, + addFriendButtonTitle: { + color: 'white', + padding: 0, + fontSize: normalize(11), + fontWeight: '700', + lineHeight: normalize(13.13), + letterSpacing: normalize(0.6), + paddingHorizontal: '3.8%', + }, + button: { + alignSelf: 'center', + justifyContent: 'center', + alignItems: 'center', + width: 82, + height: '55%', + borderColor: TAGG_LIGHT_BLUE, + borderWidth: 2, + borderRadius: 2, + padding: 0, + backgroundColor: TAGG_LIGHT_BLUE, }, buttonTitle: { - color: TAGG_LIGHT_BLUE, + color: 'white', padding: 0, fontSize: normalize(11), fontWeight: '700', diff --git a/src/constants/api.ts b/src/constants/api.ts index 34ef9a1c..eeac583e 100644 --- a/src/constants/api.ts +++ b/src/constants/api.ts @@ -33,6 +33,10 @@ export const DISCOVER_ENDPOINT: string = API_URL + 'discover/'; export const SEARCH_BUTTONS_ENDPOPINT: string = DISCOVER_ENDPOINT + 'search_buttons/'; export const WAITLIST_USER_ENDPOINT: string = API_URL + 'waitlist-user/'; export const COMMENT_THREAD_ENDPOINT: string = API_URL + 'reply/'; +export const USERS_FROM_CONTACTS_ENDPOINT: string = + API_URL + 'users-from-contacts/'; +export const INVITE_FRIEND_ENDPOINT: string = +USERS_FROM_CONTACTS_ENDPOINT + 'invite_friend/'; // Suggested People export const SP_USERS_ENDPOINT: string = API_URL + 'suggested_people/'; diff --git a/src/routes/main/MainStackNavigator.tsx b/src/routes/main/MainStackNavigator.tsx index 142249ce..f848a5ab 100644 --- a/src/routes/main/MainStackNavigator.tsx +++ b/src/routes/main/MainStackNavigator.tsx @@ -84,6 +84,9 @@ export type MainStackParams = { badge_title: string; badge_img: string; }; + InviteFriendsScreen: { + screenType: ScreenType; + }; }; export const MainStack = createStackNavigator(); diff --git a/src/routes/main/MainStackScreen.tsx b/src/routes/main/MainStackScreen.tsx index 95d45d32..4f655a64 100644 --- a/src/routes/main/MainStackScreen.tsx +++ b/src/routes/main/MainStackScreen.tsx @@ -15,6 +15,7 @@ import { EditProfile, FriendsListScreen, IndividualMoment, + InviteFriendsScreen, MomentCommentsScreen, MomentUploadPromptScreen, NotificationsScreen, @@ -220,6 +221,19 @@ const MainStackScreen: React.FC = ({route}) => { ...headerBarOptions('black', 'Friends'), }} /> + + = ({route}) => { return ( <> + diff --git a/src/screens/profile/InviteFriendsScreen.tsx b/src/screens/profile/InviteFriendsScreen.tsx new file mode 100644 index 00000000..8fc12a5e --- /dev/null +++ b/src/screens/profile/InviteFriendsScreen.tsx @@ -0,0 +1,330 @@ +import React, {useEffect, useState} from 'react'; +import { + View, + Text, + TouchableOpacity, + SafeAreaView, + StyleSheet, + TextInput, + FlatList, + Keyboard, + Linking, + StatusBar, + TouchableWithoutFeedback, +} from 'react-native'; +import {useDispatch, useStore} from 'react-redux'; +import {ProfilePreviewType, ScreenType} from '../../types'; +import { + handleAddFriend, + HeaderHeight, + normalize, + SCREEN_HEIGHT, + SCREEN_WIDTH, +} from '../../utils'; +import {checkPermission, getAll} from 'react-native-contacts'; +import {usersFromContactsService} from '../../services/UserFriendsService'; +import {ProfilePreview, TabsGradient} from '../../components'; +import Animated from 'react-native-reanimated'; +import Icon from 'react-native-vector-icons/Feather'; +import {InviteFriendTile} from '../../components/friends'; +import {TAGG_LIGHT_BLUE} from '../../constants'; +const AnimatedIcon = Animated.createAnimatedComponent(Icon); + +interface InviteFriendsScreenProps { + screenType: ScreenType; +} + +const InviteFriendsScreen: React.FC = ({ + screenType, +}) => { + const dispatch = useDispatch(); + const state = useStore().getState(); + const [usersFromContacts, setUsersFromContacts] = useState< + ProfilePreviewType[] + >([]); + const [nonUsersFromContacts, setNonUsersFromContacts] = useState<[]>([]); + type SearchResultType = { + usersFromContacts: ProfilePreviewType[]; + nonUsersFromContacts: []; + }; + const [results, setResults] = useState({ + usersFromContacts: usersFromContacts, + nonUsersFromContacts: nonUsersFromContacts, + }); + const [query, setQuery] = useState(''); + + const extractPhoneNumbers = async () => { + let phoneNumbers: Array = []; + await getAll().then((contacts) => { + contacts.map((contact) => { + contact.phoneNumbers.map(async (phoneNumber) => { + phoneNumbers.push(await phoneNumber.number); + }); + }); + }); + return phoneNumbers; + }; + + useEffect(() => { + const handleFindFriends = () => { + extractPhoneNumbers().then(async (phoneNumbers) => { + const permission = await checkPermission(); + if (permission === 'authorized') { + let response = await usersFromContactsService(phoneNumbers); + await setUsersFromContacts(response.existing_tagg_users); + await setNonUsersFromContacts(response.invite_from_contacts); + usersFromContacts.map((user) => console.log('user: ', user.username)); + setResults({ + usersFromContacts: response.existing_tagg_users, + nonUsersFromContacts: response.invite_from_contacts, + }); + } else { + Linking.openSettings(); + } + }); + }; + handleFindFriends(); + }, []); + + /* + * Main handler for changes in query. + */ + useEffect(() => { + const search = async () => { + if (query.length > 0) { + const searchResultsUsers = usersFromContacts.filter( + (item: ProfilePreviewType) => { + if ( + item.first_name.includes(query) || + item.last_name.includes(query) || + item.username.includes(query) + ) { + return item; + } + }, + ); + const searchResultsNonUsers = nonUsersFromContacts.filter((item) => { + if (item.firstName.includes(query) || item.lastName.includes(query)) { + return item; + } + }); + const sanitizedResult = { + usersFromContacts: searchResultsUsers, + nonUsersFromContacts: searchResultsNonUsers, + }; + setResults(sanitizedResult); + } else { + setResults({ + usersFromContacts: usersFromContacts, + nonUsersFromContacts: nonUsersFromContacts, + }); + } + }; + search(); + }, [query]); + + const UsersFromContacts = () => ( + <> + item.username} + renderItem={({item}) => ( + + + + + { + handleAddFriend(screenType, item, dispatch, state).then( + (success) => { + if (success) { + let users = usersFromContacts; + const filteredUsers = users.filter( + (user) => user.username !== item.username, + ); + console.log('filteredUsers: ', filteredUsers); + setResults({ + ...results, + usersFromContacts: filteredUsers, + }); + } + }, + ); + }}> + Add Friend + + + )} + /> + + ); + + const NonUsersFromContacts = () => ( + <> + item.phoneNumber} + renderItem={({item}) => } + /> + + ); + + return ( + + + + + + + + Sharing is caring, invite friends, and create moments together! + + + + + + { + setQuery(text); + }} + onBlur={() => { + Keyboard.dismiss(); + }} + onEndEditing={() => { + Keyboard.dismiss(); + }} + value={query} + placeholder={'Search'} + /> + + + + + Add Friends + + + + + Invite your friends! + + + + + + + + ); +}; + +const styles = StyleSheet.create({ + body: { + paddingTop: HeaderHeight * 1.3, + height: SCREEN_HEIGHT * 0.8, + backgroundColor: '#fff', + }, + subheader: { + alignSelf: 'center', + width: SCREEN_WIDTH * 0.85, + marginBottom: '5%', + }, + subheaderText: { + color: '#828282', + fontSize: normalize(12), + fontWeight: '600', + lineHeight: normalize(14.32), + }, + container: { + alignSelf: 'center', + flexDirection: 'row', + justifyContent: 'space-between', + width: '100%', + height: normalize(42), + alignItems: 'center', + marginBottom: '3%', + marginHorizontal: 10, + }, + ppContainer: { + alignSelf: 'center', + flexDirection: 'row', + justifyContent: 'space-between', + width: '100%', + height: normalize(42), + alignItems: 'center', + marginBottom: '5%', + marginHorizontal: 10, + }, + inputContainer: { + flexGrow: 1, + flexDirection: 'row', + alignItems: 'center', + paddingHorizontal: 8, + marginHorizontal: '3%', + borderRadius: 20, + backgroundColor: '#F0F0F0', + height: 34, + }, + searchIcon: { + marginRight: '5%', + }, + input: { + flex: 1, + fontSize: normalize(16), + color: '#000', + letterSpacing: normalize(0.5), + }, + cancelButton: { + height: '100%', + position: 'absolute', + justifyContent: 'center', + paddingHorizontal: 8, + }, + cancelText: { + color: '#818181', + fontWeight: '500', + }, + friend: { + alignSelf: 'center', + height: '100%', + }, + addFriendButton: { + alignSelf: 'center', + justifyContent: 'center', + alignItems: 'center', + width: 82, + height: 25, + borderColor: TAGG_LIGHT_BLUE, + borderWidth: 2, + borderRadius: 2, + padding: 0, + backgroundColor: TAGG_LIGHT_BLUE, + }, + addFriendButtonTitle: { + color: 'white', + padding: 0, + fontSize: normalize(11), + fontWeight: '700', + lineHeight: normalize(13.13), + letterSpacing: normalize(0.6), + paddingHorizontal: '3.8%', + }, +}); + +export default InviteFriendsScreen; diff --git a/src/screens/profile/index.ts b/src/screens/profile/index.ts index 9d651729..f74946a6 100644 --- a/src/screens/profile/index.ts +++ b/src/screens/profile/index.ts @@ -6,3 +6,4 @@ export {default as MomentCommentsScreen} from './MomentCommentsScreen'; export {default as FriendsListScreen} from './FriendsListScreen'; export {default as EditProfile} from './EditProfile'; export {default as MomentUploadPromptScreen} from './MomentUploadPromptScreen'; +export {default as InviteFriendsScreen} from './InviteFriendsScreen'; diff --git a/src/store/actions/userFriends.ts b/src/store/actions/userFriends.ts index 4f55acc8..9da3cb4a 100644 --- a/src/store/actions/userFriends.ts +++ b/src/store/actions/userFriends.ts @@ -1,4 +1,4 @@ -import {getTokenOrLogout} from '../../utils'; +import {getTokenOrLogout, userXInStore} from '../../utils'; import {RootState} from '../rootReducer'; import { FriendshipStatusType, @@ -90,6 +90,7 @@ export const friendUnfriendUser = ( export const addFriend = ( friend: ProfilePreviewType, // userX's profile preview screenType: ScreenType, //screentype from content + state: RootState, ): ThunkAction< Promise, RootState, @@ -100,14 +101,16 @@ export const addFriend = ( const token = await getTokenOrLogout(dispatch); const success = await addFriendService(friend.id, token); if (success) { - dispatch({ - type: userXFriendshipEdited.type, - payload: { - userId: friend.id, - screenType, - data: 'requested', - }, - }); + if (userXInStore(state, screenType, friend.id)) { + dispatch({ + type: userXFriendshipEdited.type, + payload: { + userId: friend.id, + screen: screenType, + data: 'requested', + }, + }); + } return true; } } catch (error) { diff --git a/src/utils/users.ts b/src/utils/users.ts index af4f3813..82bcb309 100644 --- a/src/utils/users.ts +++ b/src/utils/users.ts @@ -96,7 +96,7 @@ export const userXInStore = ( userId: string, ) => { const userX = state.userX[screen]; - return userId in userX && userX[userId].user.userId; + return userX && userId in userX && userX[userId].user.userId; }; /** -- cgit v1.2.3-70-g09d2 From fe5ff5ec516302811b7323cadf8e3dd0939beea4 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Thu, 18 Mar 2021 02:45:46 -0700 Subject: services + --- src/components/profile/Friends.tsx | 37 +++++++++------- src/screens/profile/InviteFriendsScreen.tsx | 21 ++++++--- src/services/UserFriendsService.ts | 67 ++++++++++++++++++++++++++++- src/types/types.ts | 6 +++ src/utils/friends.ts | 2 +- 5 files changed, 107 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/components/profile/Friends.tsx b/src/components/profile/Friends.tsx index a1030b49..36e0ef8a 100644 --- a/src/components/profile/Friends.tsx +++ b/src/components/profile/Friends.tsx @@ -98,22 +98,27 @@ const Friends: React.FC = ({result, screenType, userId}) => { return ( <> - - - Add Friends - - navigation.navigate('InviteFriendsScreen', { - screenType: ScreenType.Profile, - }) - }> - - Find Friends - - - - + {loggedInUser.userId === userId || + (userId === undefined && ( + + + Add Friends + + navigation.navigate('InviteFriendsScreen', { + screenType: ScreenType.Profile, + }) + }> + + + Find Friends + + + + + + ))} Friends diff --git a/src/screens/profile/InviteFriendsScreen.tsx b/src/screens/profile/InviteFriendsScreen.tsx index 8fc12a5e..1a5de1ce 100644 --- a/src/screens/profile/InviteFriendsScreen.tsx +++ b/src/screens/profile/InviteFriendsScreen.tsx @@ -13,7 +13,7 @@ import { TouchableWithoutFeedback, } from 'react-native'; import {useDispatch, useStore} from 'react-redux'; -import {ProfilePreviewType, ScreenType} from '../../types'; +import {ContactType, ProfilePreviewType, ScreenType} from '../../types'; import { handleAddFriend, HeaderHeight, @@ -53,24 +53,30 @@ const InviteFriendsScreen: React.FC = ({ }); const [query, setQuery] = useState(''); - const extractPhoneNumbers = async () => { - let phoneNumbers: Array = []; + const extractContacts = async () => { + let retrievedContacts: Array = []; await getAll().then((contacts) => { contacts.map((contact) => { + let obj: ContactType = { + first_name: contact.givenName, + last_name: contact.familyName, + }; contact.phoneNumbers.map(async (phoneNumber) => { - phoneNumbers.push(await phoneNumber.number); + obj.phone_number = phoneNumber.number; + retrievedContacts.push(obj); + console.log('contact: ', obj); }); }); }); - return phoneNumbers; + return retrievedContacts; }; useEffect(() => { const handleFindFriends = () => { - extractPhoneNumbers().then(async (phoneNumbers) => { + extractContacts().then(async (retrievedContacts) => { const permission = await checkPermission(); if (permission === 'authorized') { - let response = await usersFromContactsService(phoneNumbers); + let response = await usersFromContactsService(retrievedContacts); await setUsersFromContacts(response.existing_tagg_users); await setNonUsersFromContacts(response.invite_from_contacts); usersFromContacts.map((user) => console.log('user: ', user.username)); @@ -169,6 +175,7 @@ const InviteFriendsScreen: React.FC = ({ const NonUsersFromContacts = () => ( <> item.phoneNumber} diff --git a/src/services/UserFriendsService.ts b/src/services/UserFriendsService.ts index dbec1974..86339868 100644 --- a/src/services/UserFriendsService.ts +++ b/src/services/UserFriendsService.ts @@ -1,8 +1,13 @@ //Abstracted common friends api calls out here +import AsyncStorage from '@react-native-community/async-storage'; import {Alert} from 'react-native'; -import {FriendshipStatusType} from '../types'; -import {FRIENDS_ENDPOINT} from '../constants'; +import {ContactType, FriendshipStatusType} from '../types'; +import { + FRIENDS_ENDPOINT, + INVITE_FRIEND_ENDPOINT, + USERS_FROM_CONTACTS_ENDPOINT, +} from '../constants'; import {ERROR_SOMETHING_WENT_WRONG_REFRESH} from '../constants/strings'; export const loadFriends = async (userId: string, token: string) => { @@ -181,3 +186,61 @@ export const deleteFriendshipService = async ( return false; } }; + +export const usersFromContactsService = async ( + contacts: Array, +) => { + console.log('Contacts: ', contacts); + try { + const token = await AsyncStorage.getItem('token'); + const response = await fetch(USERS_FROM_CONTACTS_ENDPOINT, { + method: 'POST', + headers: { + Authorization: 'Token ' + token, + }, + body: JSON.stringify({ + contacts: contacts, + }), + }); + const status = response.status; + if (Math.floor(status / 100) === 2) { + const users_data = await response.json(); + return users_data; + } else { + console.log( + 'Something went wrong! 😭', + 'Not able to retrieve tagg users list', + ); + } + } catch (error) { + console.log(error); + Alert.alert(ERROR_SOMETHING_WENT_WRONG_REFRESH); + return false; + } +}; + +export const inviteFriendService = async ( + phoneNumber: string, + inviteeFirstName: string, + inviteeLastName: string, + inviterFullName: string, +) => { + const token = await AsyncStorage.getItem('token'); + const response = await fetch(INVITE_FRIEND_ENDPOINT, { + method: 'POST', + headers: { + Authorization: 'Token ' + token, + }, + body: JSON.stringify({ + phone_number: phoneNumber, + invitee_first_name: inviteeFirstName, + invitee_last_name: inviteeLastName, + inviter_full_name: inviterFullName, + }), + }); + if (response.status === 201) { + const response_body = await response.json(); + return response_body; + } + return false; +}; diff --git a/src/types/types.ts b/src/types/types.ts index e068eeba..dc2817bd 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -256,3 +256,9 @@ export type SearchCategoryType = { name: string; category: string; }; + +export type ContactType = { + phone_number: string; + first_name: string; + last_name: string; +}; diff --git a/src/utils/friends.ts b/src/utils/friends.ts index 3398c123..55d65170 100644 --- a/src/utils/friends.ts +++ b/src/utils/friends.ts @@ -60,7 +60,7 @@ export const handleAddFriend = async ( dispatch: AppDispatch, state: RootState, ) => { - const success = await dispatch(addFriend(friend, screenType)); + const success = await dispatch(addFriend(friend, screenType, state)); await dispatch(updateUserXFriends(friend.id, state)); await dispatch(updateUserXProfileAllScreens(friend.id, state)); return success; -- cgit v1.2.3-70-g09d2 From ab97d0e0f0dff6ac4fc334fe12b9b93f0c8fc8c4 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Thu, 18 Mar 2021 12:13:40 -0700 Subject: removed thistle color --- src/components/friends/InviteFriendTile.tsx | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/components/friends/InviteFriendTile.tsx b/src/components/friends/InviteFriendTile.tsx index 2d2b8e04..96b73378 100644 --- a/src/components/friends/InviteFriendTile.tsx +++ b/src/components/friends/InviteFriendTile.tsx @@ -54,7 +54,6 @@ const styles = StyleSheet.create({ alignItems: 'center', justifyContent: 'space-between', height: normalize(42), - backgroundColor: 'thistle', }, label: { fontWeight: '500', -- cgit v1.2.3-70-g09d2 From 30916f3809a3712593b45968ba560914d43f3564 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Thu, 18 Mar 2021 12:33:59 -0700 Subject: styling invite friend tile + ph_no unformatted --- src/components/friends/InviteFriendTile.tsx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/components/friends/InviteFriendTile.tsx b/src/components/friends/InviteFriendTile.tsx index 96b73378..0110fb74 100644 --- a/src/components/friends/InviteFriendTile.tsx +++ b/src/components/friends/InviteFriendTile.tsx @@ -34,7 +34,25 @@ const InviteFriendTile: React.FC = ({item}) => { return ( - {item.firstName + ' ' + item.lastName} + + + {item.firstName + ' ' + item.lastName} + + + {item.phoneNumber} + + Date: Thu, 18 Mar 2021 12:49:24 -0700 Subject: added format phone number function --- src/components/friends/InviteFriendTile.tsx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/components/friends/InviteFriendTile.tsx b/src/components/friends/InviteFriendTile.tsx index 0110fb74..c49792f9 100644 --- a/src/components/friends/InviteFriendTile.tsx +++ b/src/components/friends/InviteFriendTile.tsx @@ -1,4 +1,4 @@ -import React, {useState} from 'react'; +import React, {useEffect, useState} from 'react'; import { StyleSheet, Text, @@ -18,6 +18,7 @@ interface InviteFriendTileProps { const InviteFriendTile: React.FC = ({item}) => { const [invited, setInvited] = useState(false); + const [formatedPhoneNumber, setFormattedPhoneNumber] = useState(''); const {profile} = useSelector((state: RootState) => state.user); const handleInviteFriend = async () => { const response = await inviteFriendService( @@ -31,6 +32,21 @@ const InviteFriendTile: React.FC = ({item}) => { } }; + useEffect(() => { + const formatPhoneNumer = () => { + const unformatted_number: string = item.phoneNumber; + const part_one: string = unformatted_number.substring(2, 5); + const part_two: string = unformatted_number.substring(5, 8); + const part_three: string = unformatted_number.substring( + 8, + unformatted_number.length, + ); + const temp = '(' + part_one + ')' + part_two + '-' + part_three; + setFormattedPhoneNumber(temp); + }; + formatPhoneNumer(); + }); + return ( @@ -50,7 +66,7 @@ const InviteFriendTile: React.FC = ({item}) => { color: '#6C6C6C', letterSpacing: normalize(0.1), }}> - {item.phoneNumber} + {formatedPhoneNumber} Date: Thu, 18 Mar 2021 13:02:24 -0700 Subject: changed endpoints --- src/constants/api.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/constants/api.ts b/src/constants/api.ts index eeac583e..26afaddd 100644 --- a/src/constants/api.ts +++ b/src/constants/api.ts @@ -34,9 +34,9 @@ export const SEARCH_BUTTONS_ENDPOPINT: string = DISCOVER_ENDPOINT + 'search_butt export const WAITLIST_USER_ENDPOINT: string = API_URL + 'waitlist-user/'; export const COMMENT_THREAD_ENDPOINT: string = API_URL + 'reply/'; export const USERS_FROM_CONTACTS_ENDPOINT: string = - API_URL + 'users-from-contacts/'; + API_URL + 'user_contacts/find_friends/'; export const INVITE_FRIEND_ENDPOINT: string = -USERS_FROM_CONTACTS_ENDPOINT + 'invite_friend/'; +USERS_FROM_CONTACTS_ENDPOINT + 'user_contacts/invite_friend/'; // Suggested People export const SP_USERS_ENDPOINT: string = API_URL + 'suggested_people/'; -- cgit v1.2.3-70-g09d2 From a44e8d02c117783c19618d3af204299ae5c7a9ff Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Thu, 18 Mar 2021 13:38:31 -0700 Subject: erroneous endpoint for invite contacts --- src/constants/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/constants/api.ts b/src/constants/api.ts index 26afaddd..1e2e887a 100644 --- a/src/constants/api.ts +++ b/src/constants/api.ts @@ -36,7 +36,7 @@ export const COMMENT_THREAD_ENDPOINT: string = API_URL + 'reply/'; export const USERS_FROM_CONTACTS_ENDPOINT: string = API_URL + 'user_contacts/find_friends/'; export const INVITE_FRIEND_ENDPOINT: string = -USERS_FROM_CONTACTS_ENDPOINT + 'user_contacts/invite_friend/'; +API_URL + 'user_contacts/invite_friend/'; // Suggested People export const SP_USERS_ENDPOINT: string = API_URL + 'suggested_people/'; -- cgit v1.2.3-70-g09d2 From f81a4e1a05ca3fa66c2798b047d4bfd6995f462d Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Thu, 18 Mar 2021 13:44:19 -0700 Subject: Support modified endpoints + refactoring --- src/components/friends/InviteFriendTile.tsx | 2 -- src/components/profile/Friends.tsx | 23 ++++++++------------- src/screens/profile/InviteFriendsScreen.tsx | 32 +++++++++-------------------- src/services/UserFriendsService.ts | 10 +++++---- src/utils/common.ts | 21 ++++++++++++++++++- 5 files changed, 44 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/components/friends/InviteFriendTile.tsx b/src/components/friends/InviteFriendTile.tsx index c49792f9..f56d3514 100644 --- a/src/components/friends/InviteFriendTile.tsx +++ b/src/components/friends/InviteFriendTile.tsx @@ -19,13 +19,11 @@ interface InviteFriendTileProps { const InviteFriendTile: React.FC = ({item}) => { const [invited, setInvited] = useState(false); const [formatedPhoneNumber, setFormattedPhoneNumber] = useState(''); - const {profile} = useSelector((state: RootState) => state.user); const handleInviteFriend = async () => { const response = await inviteFriendService( item.phoneNumber, item.firstName, item.lastName, - profile.name, ); if (response) { setInvited(response); diff --git a/src/components/profile/Friends.tsx b/src/components/profile/Friends.tsx index 36e0ef8a..7d57177c 100644 --- a/src/components/profile/Friends.tsx +++ b/src/components/profile/Friends.tsx @@ -9,7 +9,12 @@ import {usersFromContactsService} from '../../services'; import {NO_USER} from '../../store/initialStates'; import {RootState} from '../../store/rootReducer'; import {ProfilePreviewType, ScreenType} from '../../types'; -import {normalize, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; +import { + extractContacts, + normalize, + SCREEN_HEIGHT, + SCREEN_WIDTH, +} from '../../utils'; import {handleAddFriend, handleUnfriend} from '../../utils/friends'; import {ProfilePreview} from '../profile'; import FindFriendsBlueIcon from '../../assets/icons/findFriends/find-friends-blue-icon.svg'; @@ -31,24 +36,12 @@ const Friends: React.FC = ({result, screenType, userId}) => { ProfilePreviewType[] >([]); - const extractPhoneNumbers = async () => { - let phoneNumbers: Array = []; - await getAll().then((contacts) => { - contacts.map((contact) => { - contact.phoneNumbers.map(async (phoneNumber) => { - phoneNumbers.push(await phoneNumber.number); - }); - }); - }); - return phoneNumbers; - }; - useEffect(() => { const handleFindFriends = () => { - extractPhoneNumbers().then(async (phoneNumbers) => { + extractContacts().then(async (contacts) => { const permission = await checkPermission(); if (permission === 'authorized') { - let response = await usersFromContactsService(phoneNumbers); + let response = await usersFromContactsService(contacts); await setUsersFromContacts(response.existing_tagg_users); usersFromContacts.map((user) => console.log('user: ', user.username)); } else if (permission === 'undefined') { diff --git a/src/screens/profile/InviteFriendsScreen.tsx b/src/screens/profile/InviteFriendsScreen.tsx index 1a5de1ce..53215d8a 100644 --- a/src/screens/profile/InviteFriendsScreen.tsx +++ b/src/screens/profile/InviteFriendsScreen.tsx @@ -15,6 +15,7 @@ import { import {useDispatch, useStore} from 'react-redux'; import {ContactType, ProfilePreviewType, ScreenType} from '../../types'; import { + extractContacts, handleAddFriend, HeaderHeight, normalize, @@ -53,24 +54,6 @@ const InviteFriendsScreen: React.FC = ({ }); const [query, setQuery] = useState(''); - const extractContacts = async () => { - let retrievedContacts: Array = []; - await getAll().then((contacts) => { - contacts.map((contact) => { - let obj: ContactType = { - first_name: contact.givenName, - last_name: contact.familyName, - }; - contact.phoneNumbers.map(async (phoneNumber) => { - obj.phone_number = phoneNumber.number; - retrievedContacts.push(obj); - console.log('contact: ', obj); - }); - }); - }); - return retrievedContacts; - }; - useEffect(() => { const handleFindFriends = () => { extractContacts().then(async (retrievedContacts) => { @@ -190,7 +173,13 @@ const InviteFriendsScreen: React.FC = ({ - + Sharing is caring, invite friends, and create moments together! @@ -224,9 +213,7 @@ const InviteFriendsScreen: React.FC = ({ - - Add Friends - + Add Friends @@ -257,6 +244,7 @@ const styles = StyleSheet.create({ fontSize: normalize(12), fontWeight: '600', lineHeight: normalize(14.32), + marginBottom: '5%', }, container: { alignSelf: 'center', diff --git a/src/services/UserFriendsService.ts b/src/services/UserFriendsService.ts index 86339868..c6679bef 100644 --- a/src/services/UserFriendsService.ts +++ b/src/services/UserFriendsService.ts @@ -8,7 +8,10 @@ import { INVITE_FRIEND_ENDPOINT, USERS_FROM_CONTACTS_ENDPOINT, } from '../constants'; -import {ERROR_SOMETHING_WENT_WRONG_REFRESH} from '../constants/strings'; +import { + ERROR_SOMETHING_WENT_WRONG, + ERROR_SOMETHING_WENT_WRONG_REFRESH, +} from '../constants/strings'; export const loadFriends = async (userId: string, token: string) => { try { @@ -223,7 +226,6 @@ export const inviteFriendService = async ( phoneNumber: string, inviteeFirstName: string, inviteeLastName: string, - inviterFullName: string, ) => { const token = await AsyncStorage.getItem('token'); const response = await fetch(INVITE_FRIEND_ENDPOINT, { @@ -232,15 +234,15 @@ export const inviteFriendService = async ( Authorization: 'Token ' + token, }, body: JSON.stringify({ - phone_number: phoneNumber, + invitee_phone_number: phoneNumber, invitee_first_name: inviteeFirstName, invitee_last_name: inviteeLastName, - inviter_full_name: inviterFullName, }), }); if (response.status === 201) { const response_body = await response.json(); return response_body; } + Alert.alert(ERROR_SOMETHING_WENT_WRONG); return false; }; diff --git a/src/utils/common.ts b/src/utils/common.ts index c1049c42..5f0e26ba 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -1,8 +1,9 @@ -import {NotificationType} from './../types/types'; +import {ContactType, NotificationType} from './../types/types'; import moment from 'moment'; import {Linking} from 'react-native'; import {BROWSABLE_SOCIAL_URLS, TOGGLE_BUTTON_TYPE} from '../constants'; import AsyncStorage from '@react-native-community/async-storage'; +import {getAll} from 'react-native-contacts'; export const getToggleButtonText: ( buttonType: string, @@ -115,3 +116,21 @@ export const shuffle = (array: any[]) => { return array; }; + +export const extractContacts = async () => { + let retrievedContacts: Array = []; + await getAll().then((contacts) => { + contacts.map((contact) => { + let obj: ContactType = { + first_name: contact.givenName, + last_name: contact.familyName, + }; + contact.phoneNumbers.map(async (phoneNumber) => { + obj.phone_number = phoneNumber.number; + retrievedContacts.push(obj); + console.log('contact: ', obj); + }); + }); + }); + return retrievedContacts; +}; -- cgit v1.2.3-70-g09d2 From 8d243eef5db576c053d521d082feb87a1a834558 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Thu, 18 Mar 2021 15:23:18 -0700 Subject: cleaned lint erros --- src/components/friends/InviteFriendTile.tsx | 30 ++++++++++++--------------- src/components/profile/Friends.tsx | 5 +++-- src/screens/profile/InviteFriendsScreen.tsx | 32 ++++++++++++++++++----------- 3 files changed, 36 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/components/friends/InviteFriendTile.tsx b/src/components/friends/InviteFriendTile.tsx index f56d3514..9613b1ac 100644 --- a/src/components/friends/InviteFriendTile.tsx +++ b/src/components/friends/InviteFriendTile.tsx @@ -6,8 +6,6 @@ import { TouchableWithoutFeedback, View, } from 'react-native'; -import {useSelector} from 'react-redux'; -import {RootState} from '../../store/rootReducer'; import {TAGG_LIGHT_BLUE} from '../../constants'; import {inviteFriendService} from '../../services'; import {normalize} from '../../utils'; @@ -48,24 +46,11 @@ const InviteFriendTile: React.FC = ({item}) => { return ( - + {item.firstName + ' ' + item.lastName} - - {formatedPhoneNumber} - + {formatedPhoneNumber} = ({result, screenType, userId}) => { Add Friends navigation.navigate('InviteFriendsScreen', { screenType: ScreenType.Profile, @@ -176,6 +176,7 @@ const styles = StyleSheet.create({ fontWeight: '600', lineHeight: normalize(14.32), }, + findFriendsButton: {flexDirection: 'row'}, friendsSubheaderText: { alignSelf: 'center', width: SCREEN_WIDTH * 0.85, diff --git a/src/screens/profile/InviteFriendsScreen.tsx b/src/screens/profile/InviteFriendsScreen.tsx index 53215d8a..c98b90f8 100644 --- a/src/screens/profile/InviteFriendsScreen.tsx +++ b/src/screens/profile/InviteFriendsScreen.tsx @@ -13,7 +13,7 @@ import { TouchableWithoutFeedback, } from 'react-native'; import {useDispatch, useStore} from 'react-redux'; -import {ContactType, ProfilePreviewType, ScreenType} from '../../types'; +import {ProfilePreviewType, ScreenType} from '../../types'; import { extractContacts, handleAddFriend, @@ -22,7 +22,7 @@ import { SCREEN_HEIGHT, SCREEN_WIDTH, } from '../../utils'; -import {checkPermission, getAll} from 'react-native-contacts'; +import {checkPermission} from 'react-native-contacts'; import {usersFromContactsService} from '../../services/UserFriendsService'; import {ProfilePreview, TabsGradient} from '../../components'; import Animated from 'react-native-reanimated'; @@ -158,7 +158,7 @@ const InviteFriendsScreen: React.FC = ({ const NonUsersFromContacts = () => ( <> item.phoneNumber} @@ -168,19 +168,13 @@ const InviteFriendsScreen: React.FC = ({ ); return ( - + - - + + Sharing is caring, invite friends, and create moments together! @@ -229,11 +223,25 @@ const InviteFriendsScreen: React.FC = ({ }; const styles = StyleSheet.create({ + mainContainer: {backgroundColor: 'white', height: SCREEN_HEIGHT}, body: { paddingTop: HeaderHeight * 1.3, height: SCREEN_HEIGHT * 0.8, backgroundColor: '#fff', }, + headerContainer: { + width: 319, + height: 42, + alignSelf: 'center', + marginBottom: '2%', + }, + headerText: { + alignSelf: 'center', + width: SCREEN_WIDTH * 0.85, + marginBottom: '5%', + textAlign: 'center', + }, + nonUsersFlatListContainer: {paddingBottom: 130}, subheader: { alignSelf: 'center', width: SCREEN_WIDTH * 0.85, -- cgit v1.2.3-70-g09d2 From dba4d3fa7bb174ae2c0c5324e41144508b5dc8ed Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Thu, 18 Mar 2021 15:33:45 -0700 Subject: style --- src/screens/profile/InviteFriendsScreen.tsx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/screens/profile/InviteFriendsScreen.tsx b/src/screens/profile/InviteFriendsScreen.tsx index c98b90f8..0abac136 100644 --- a/src/screens/profile/InviteFriendsScreen.tsx +++ b/src/screens/profile/InviteFriendsScreen.tsx @@ -174,7 +174,7 @@ const InviteFriendsScreen: React.FC = ({ - + Sharing is caring, invite friends, and create moments together! @@ -230,16 +230,9 @@ const styles = StyleSheet.create({ backgroundColor: '#fff', }, headerContainer: { - width: 319, - height: 42, - alignSelf: 'center', - marginBottom: '2%', - }, - headerText: { - alignSelf: 'center', width: SCREEN_WIDTH * 0.85, - marginBottom: '5%', - textAlign: 'center', + height: 50, + alignSelf: 'center', }, nonUsersFlatListContainer: {paddingBottom: 130}, subheader: { @@ -253,6 +246,7 @@ const styles = StyleSheet.create({ fontWeight: '600', lineHeight: normalize(14.32), marginBottom: '5%', + textAlign: 'center', }, container: { alignSelf: 'center', -- cgit v1.2.3-70-g09d2 From 02f3b84cb94677079dd2a9f3aacb8c9c11e9696e Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Thu, 18 Mar 2021 15:39:57 -0700 Subject: minor --- src/screens/profile/InviteFriendsScreen.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/screens/profile/InviteFriendsScreen.tsx b/src/screens/profile/InviteFriendsScreen.tsx index 0abac136..a57b72b6 100644 --- a/src/screens/profile/InviteFriendsScreen.tsx +++ b/src/screens/profile/InviteFriendsScreen.tsx @@ -174,7 +174,7 @@ const InviteFriendsScreen: React.FC = ({ - + Sharing is caring, invite friends, and create moments together! @@ -246,7 +246,14 @@ const styles = StyleSheet.create({ fontWeight: '600', lineHeight: normalize(14.32), marginBottom: '5%', + }, + headerText: { textAlign: 'center', + color: '#828282', + fontSize: normalize(12), + fontWeight: '600', + lineHeight: normalize(14.32), + marginBottom: '5%', }, container: { alignSelf: 'center', -- cgit v1.2.3-70-g09d2 From b1c88afecd72864fe928882fc64c767dc58076fe Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Thu, 18 Mar 2021 16:00:33 -0700 Subject: open settings --- src/components/profile/Friends.tsx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/components/profile/Friends.tsx b/src/components/profile/Friends.tsx index 1c295c25..62ae2b48 100644 --- a/src/components/profile/Friends.tsx +++ b/src/components/profile/Friends.tsx @@ -1,6 +1,6 @@ import {useNavigation} from '@react-navigation/native'; import React, {useEffect, useState} from 'react'; -import {ScrollView, StyleSheet, Text, View} from 'react-native'; +import {Linking, ScrollView, StyleSheet, Text, View} from 'react-native'; import {checkPermission} from 'react-native-contacts'; import {TouchableOpacity} from 'react-native-gesture-handler'; import {useDispatch, useSelector, useStore} from 'react-redux'; @@ -43,11 +43,8 @@ const Friends: React.FC = ({result, screenType, userId}) => { if (permission === 'authorized') { let response = await usersFromContactsService(contacts); await setUsersFromContacts(response.existing_tagg_users); - usersFromContacts.map((user) => console.log('user: ', user.username)); - } else if (permission === 'undefined') { - navigation.navigate('RequestContactsAccess'); } else { - console.log('Go to settings'); + console.log('Authorize access to contacts'); } }); }; @@ -98,11 +95,16 @@ const Friends: React.FC = ({result, screenType, userId}) => { Add Friends - navigation.navigate('InviteFriendsScreen', { - screenType: ScreenType.Profile, - }) - }> + onPress={async () => { + const permission = await checkPermission(); + if (permission === 'authorized') { + navigation.navigate('InviteFriendsScreen', { + screenType: ScreenType.Profile, + }); + } else { + Linking.openSettings(); + } + }}> Find Friends -- cgit v1.2.3-70-g09d2 From 5c3543494cdc2f164563bff70dbb25398b0cab5c Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Thu, 18 Mar 2021 16:15:51 -0700 Subject: alert requesting access to contacts --- src/components/profile/Friends.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/components/profile/Friends.tsx b/src/components/profile/Friends.tsx index 62ae2b48..1c205ce6 100644 --- a/src/components/profile/Friends.tsx +++ b/src/components/profile/Friends.tsx @@ -1,6 +1,6 @@ import {useNavigation} from '@react-navigation/native'; import React, {useEffect, useState} from 'react'; -import {Linking, ScrollView, StyleSheet, Text, View} from 'react-native'; +import {Alert, Linking, ScrollView, StyleSheet, Text, View} from 'react-native'; import {checkPermission} from 'react-native-contacts'; import {TouchableOpacity} from 'react-native-gesture-handler'; import {useDispatch, useSelector, useStore} from 'react-redux'; @@ -102,7 +102,17 @@ const Friends: React.FC = ({result, screenType, userId}) => { screenType: ScreenType.Profile, }); } else { - Linking.openSettings(); + Alert.alert( + '"Tagg" Would Like to Access Your Contacts', + 'This helps you quickly get in touch with friends on the app and more', + [ + { + text: "Don't Allow", + style: 'cancel', + }, + {text: 'Allow', onPress: () => Linking.openSettings()}, + ], + ); } }}> -- cgit v1.2.3-70-g09d2 From eb382c75aef71510ede1cfabfee13b96477ae6a0 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Thu, 18 Mar 2021 16:16:48 -0700 Subject: style minor --- src/components/profile/Friends.tsx | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/components/profile/Friends.tsx b/src/components/profile/Friends.tsx index 1c205ce6..0592def8 100644 --- a/src/components/profile/Friends.tsx +++ b/src/components/profile/Friends.tsx @@ -196,6 +196,7 @@ const styles = StyleSheet.create({ marginBottom: '2%', }, findFriendsSubheaderText: { + marginLeft: '5%', color: '#08E2E2', fontSize: normalize(12), fontWeight: '600', -- cgit v1.2.3-70-g09d2 From 5bb8376cd6f3c87af8011c6d523c5a32813970fb Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Thu, 18 Mar 2021 16:33:22 -0700 Subject: fix --- src/utils/common.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/utils/common.ts b/src/utils/common.ts index 5f0e26ba..0a76ec08 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -121,14 +121,12 @@ export const extractContacts = async () => { let retrievedContacts: Array = []; await getAll().then((contacts) => { contacts.map((contact) => { - let obj: ContactType = { - first_name: contact.givenName, - last_name: contact.familyName, - }; - contact.phoneNumbers.map(async (phoneNumber) => { - obj.phone_number = phoneNumber.number; - retrievedContacts.push(obj); - console.log('contact: ', obj); + contact.phoneNumbers.map((phoneNumber) => { + retrievedContacts.push({ + first_name: contact.givenName, + last_name: contact.familyName, + phone_number: phoneNumber.number, + }); }); }); }); -- cgit v1.2.3-70-g09d2 From ccd7d12fa20591b19ac8c8df0c9146740667f90f Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Thu, 18 Mar 2021 19:35:38 -0400 Subject: scroll view fix, search for case insensitive --- src/components/friends/InviteFriendTile.tsx | 4 ++ src/screens/profile/InviteFriendsScreen.tsx | 62 +++++++++++++---------------- src/services/UserFriendsService.ts | 6 +-- 3 files changed, 34 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/components/friends/InviteFriendTile.tsx b/src/components/friends/InviteFriendTile.tsx index 9613b1ac..3fbf2e73 100644 --- a/src/components/friends/InviteFriendTile.tsx +++ b/src/components/friends/InviteFriendTile.tsx @@ -1,5 +1,6 @@ import React, {useEffect, useState} from 'react'; import { + Alert, StyleSheet, Text, TouchableOpacity, @@ -7,6 +8,7 @@ import { View, } from 'react-native'; import {TAGG_LIGHT_BLUE} from '../../constants'; +import {ERROR_SOMETHING_WENT_WRONG} from '../../constants/strings'; import {inviteFriendService} from '../../services'; import {normalize} from '../../utils'; @@ -25,6 +27,8 @@ const InviteFriendTile: React.FC = ({item}) => { ); if (response) { setInvited(response); + } else { + Alert.alert(ERROR_SOMETHING_WENT_WRONG); } }; diff --git a/src/screens/profile/InviteFriendsScreen.tsx b/src/screens/profile/InviteFriendsScreen.tsx index a57b72b6..06e98b90 100644 --- a/src/screens/profile/InviteFriendsScreen.tsx +++ b/src/screens/profile/InviteFriendsScreen.tsx @@ -11,6 +11,7 @@ import { Linking, StatusBar, TouchableWithoutFeedback, + ScrollView, } from 'react-native'; import {useDispatch, useStore} from 'react-redux'; import {ProfilePreviewType, ScreenType} from '../../types'; @@ -21,6 +22,7 @@ import { normalize, SCREEN_HEIGHT, SCREEN_WIDTH, + StatusBarHeight, } from '../../utils'; import {checkPermission} from 'react-native-contacts'; import {usersFromContactsService} from '../../services/UserFriendsService'; @@ -79,24 +81,20 @@ const InviteFriendsScreen: React.FC = ({ * Main handler for changes in query. */ useEffect(() => { + console.log('query is now ', query); const search = async () => { if (query.length > 0) { const searchResultsUsers = usersFromContacts.filter( - (item: ProfilePreviewType) => { - if ( - item.first_name.includes(query) || - item.last_name.includes(query) || - item.username.includes(query) - ) { - return item; - } - }, + (item: ProfilePreviewType) => + item.first_name.toLowerCase().includes(query) || + item.last_name.toLowerCase().includes(query) || + item.username.toLowerCase().includes(query), + ); + const searchResultsNonUsers = nonUsersFromContacts.filter( + (item) => + item.firstName.toLowerCase().includes(query) || + item.lastName.toLowerCase().includes(query), ); - const searchResultsNonUsers = nonUsersFromContacts.filter((item) => { - if (item.firstName.includes(query) || item.lastName.includes(query)) { - return item; - } - }); const sanitizedResult = { usersFromContacts: searchResultsUsers, nonUsersFromContacts: searchResultsNonUsers, @@ -138,7 +136,6 @@ const InviteFriendsScreen: React.FC = ({ const filteredUsers = users.filter( (user) => user.username !== item.username, ); - console.log('filteredUsers: ', filteredUsers); setResults({ ...results, usersFromContacts: filteredUsers, @@ -155,24 +152,14 @@ const InviteFriendsScreen: React.FC = ({ ); - const NonUsersFromContacts = () => ( - <> - item.phoneNumber} - renderItem={({item}) => } - /> - - ); - return ( - + - + Sharing is caring, invite friends, and create moments together! @@ -193,7 +180,7 @@ const InviteFriendsScreen: React.FC = ({ autoCapitalize="none" autoCorrect={false} onChangeText={(text) => { - setQuery(text); + setQuery(text.toLowerCase()); }} onBlur={() => { Keyboard.dismiss(); @@ -212,9 +199,16 @@ const InviteFriendsScreen: React.FC = ({ Invite your friends! - + item.phoneNumber} + renderItem={({item}) => } + /> - + @@ -225,8 +219,8 @@ const InviteFriendsScreen: React.FC = ({ const styles = StyleSheet.create({ mainContainer: {backgroundColor: 'white', height: SCREEN_HEIGHT}, body: { - paddingTop: HeaderHeight * 1.3, - height: SCREEN_HEIGHT * 0.8, + paddingTop: 10, + height: SCREEN_HEIGHT, backgroundColor: '#fff', }, headerContainer: { diff --git a/src/services/UserFriendsService.ts b/src/services/UserFriendsService.ts index c6679bef..cea20fbe 100644 --- a/src/services/UserFriendsService.ts +++ b/src/services/UserFriendsService.ts @@ -239,10 +239,8 @@ export const inviteFriendService = async ( invitee_last_name: inviteeLastName, }), }); - if (response.status === 201) { - const response_body = await response.json(); - return response_body; + if (response.status === 201 || response.status === 200) { + return await response.json(); } - Alert.alert(ERROR_SOMETHING_WENT_WRONG); return false; }; -- cgit v1.2.3-70-g09d2 From 9a7e34bf992e0bfa3b9ce7d83643d97fad209e6e Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Thu, 18 Mar 2021 19:41:29 -0400 Subject: disable scroll --- src/screens/profile/InviteFriendsScreen.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/screens/profile/InviteFriendsScreen.tsx b/src/screens/profile/InviteFriendsScreen.tsx index 06e98b90..d1142b7f 100644 --- a/src/screens/profile/InviteFriendsScreen.tsx +++ b/src/screens/profile/InviteFriendsScreen.tsx @@ -113,8 +113,8 @@ const InviteFriendsScreen: React.FC = ({ const UsersFromContacts = () => ( <> item.username} renderItem={({item}) => ( -- cgit v1.2.3-70-g09d2 From f4ca572ceb9448e02a6261ca50e3ee6b0acfe2b6 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Thu, 18 Mar 2021 17:43:27 -0700 Subject: fixed --- src/components/profile/Friends.tsx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/components/profile/Friends.tsx b/src/components/profile/Friends.tsx index 0592def8..d87b0fb0 100644 --- a/src/components/profile/Friends.tsx +++ b/src/components/profile/Friends.tsx @@ -63,7 +63,7 @@ const Friends: React.FC = ({result, screenType, userId}) => { /> { console.log('screentype: ', screenType); handleAddFriend(screenType, profilePreview, dispatch, state).then( @@ -79,7 +79,7 @@ const Friends: React.FC = ({result, screenType, userId}) => { }, ); }}> - Add Friend + Add Friend ))} @@ -143,11 +143,11 @@ const Friends: React.FC = ({result, screenType, userId}) => { {loggedInUser.userId !== userId && ( handleUnfriend(screenType, profilePreview, dispatch, state) }> - Unfriend + Unfriend )} @@ -236,7 +236,7 @@ const styles = StyleSheet.create({ letterSpacing: normalize(0.6), paddingHorizontal: '3.8%', }, - button: { + unfriendButton: { alignSelf: 'center', justifyContent: 'center', alignItems: 'center', @@ -246,10 +246,9 @@ const styles = StyleSheet.create({ borderWidth: 2, borderRadius: 2, padding: 0, - backgroundColor: TAGG_LIGHT_BLUE, }, - buttonTitle: { - color: 'white', + unfriendButtonTitle: { + color: TAGG_LIGHT_BLUE, padding: 0, fontSize: normalize(11), fontWeight: '700', -- cgit v1.2.3-70-g09d2 From aeb79eb45499edbd71ed799a8bdc0ca6a566ab58 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Fri, 19 Mar 2021 09:49:04 -0700 Subject: fixed --- src/components/profile/Friends.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/components/profile/Friends.tsx b/src/components/profile/Friends.tsx index d87b0fb0..0f5596d5 100644 --- a/src/components/profile/Friends.tsx +++ b/src/components/profile/Friends.tsx @@ -26,12 +26,10 @@ interface FriendsProps { } const Friends: React.FC = ({result, screenType, userId}) => { + const state: RootState = useStore().getState(); const dispatch = useDispatch(); + const {user: loggedInUser = NO_USER} = state; const navigation = useNavigation(); - const {user: loggedInUser = NO_USER} = useSelector( - (state: RootState) => state.user, - ); - const state = useStore().getState(); const [usersFromContacts, setUsersFromContacts] = useState< ProfilePreviewType[] >([]); @@ -141,7 +139,7 @@ const Friends: React.FC = ({result, screenType, userId}) => { screenType={screenType} /> - {loggedInUser.userId !== userId && ( + {loggedInUser.userId === userId && ( -- cgit v1.2.3-70-g09d2 From 65c5c5c461aa2a0551881774a16e4273c2d11023 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Fri, 19 Mar 2021 10:02:31 -0700 Subject: adjusted find friends --- src/components/profile/Friends.tsx | 67 ++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/components/profile/Friends.tsx b/src/components/profile/Friends.tsx index 0f5596d5..51ba6c64 100644 --- a/src/components/profile/Friends.tsx +++ b/src/components/profile/Friends.tsx @@ -86,42 +86,39 @@ const Friends: React.FC = ({result, screenType, userId}) => { return ( <> - {loggedInUser.userId === userId || - (userId === undefined && ( - - - Add Friends - { - const permission = await checkPermission(); - if (permission === 'authorized') { - navigation.navigate('InviteFriendsScreen', { - screenType: ScreenType.Profile, - }); - } else { - Alert.alert( - '"Tagg" Would Like to Access Your Contacts', - 'This helps you quickly get in touch with friends on the app and more', - [ - { - text: "Don't Allow", - style: 'cancel', - }, - {text: 'Allow', onPress: () => Linking.openSettings()}, - ], - ); - } - }}> - - - Find Friends - - - - + {loggedInUser.userId === userId && ( + + + Add Friends + { + const permission = await checkPermission(); + if (permission === 'authorized') { + navigation.navigate('InviteFriendsScreen', { + screenType: ScreenType.Profile, + }); + } else { + Alert.alert( + '"Tagg" Would Like to Access Your Contacts', + 'This helps you quickly get in touch with friends on the app and more', + [ + { + text: "Don't Allow", + style: 'cancel', + }, + {text: 'Allow', onPress: () => Linking.openSettings()}, + ], + ); + } + }}> + + Find Friends + - ))} + + + )} Friends -- cgit v1.2.3-70-g09d2 From e207b2bd73a18a3602ef3f2ef707f8d8fd889903 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 19 Mar 2021 13:25:44 -0400 Subject: changed alert text, login works --- src/constants/strings.ts | 2 +- src/routes/onboarding/OnboardingStackNavigator.tsx | 2 +- src/screens/onboarding/InvitationCodeVerification.tsx | 11 +++++++++-- src/screens/onboarding/Login.tsx | 1 + src/screens/onboarding/OnboardingStepThree.tsx | 4 ++-- 5 files changed, 14 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/constants/strings.ts b/src/constants/strings.ts index f289cfc1..cb442b7b 100644 --- a/src/constants/strings.ts +++ b/src/constants/strings.ts @@ -55,7 +55,7 @@ export const MOMENT_DELETED_MSG = 'Moment deleted....Some moments have to go, to export const NO_NEW_NOTIFICATIONS = 'You have no new notifications'; export const NO_RESULTS_FOUND = 'No Results Found!'; export const SUCCESS_CATEGORY_DELETE = 'Category successfully deleted, but its memory will live on'; -export const SUCCESS_INVITATION_CODE = 'Perfect! You entered a valid invitation code, you are now able to login and explore Tagg!'; +export const SUCCESS_INVITATION_CODE = 'Welcome to Tagg!'; export const SUCCESS_LINK = (str: string) => `Successfully linked ${str} 🎉`; export const SUCCESS_PIC_UPLOAD = 'Beautiful, the picture was uploaded successfully!'; export const SUCCESS_BADGES_UPDATE = 'Badges updated successfully!' diff --git a/src/routes/onboarding/OnboardingStackNavigator.tsx b/src/routes/onboarding/OnboardingStackNavigator.tsx index 0cdeecdf..a51a6c86 100644 --- a/src/routes/onboarding/OnboardingStackNavigator.tsx +++ b/src/routes/onboarding/OnboardingStackNavigator.tsx @@ -35,7 +35,7 @@ export type OnboardingStackParams = { PhoneVerification: {firstName: string; lastName: string; phone: string}; OnboardingStepTwo: {firstName: string; lastName: string; phone: string}; OnboardingStepThree: {userId: string; username: string}; - InvitationCodeVerification: {userId: string}; + InvitationCodeVerification: {userId: string; username: string}; }; export const OnboardingStack = createStackNavigator(); diff --git a/src/screens/onboarding/InvitationCodeVerification.tsx b/src/screens/onboarding/InvitationCodeVerification.tsx index 41d17f29..c8ef16df 100644 --- a/src/screens/onboarding/InvitationCodeVerification.tsx +++ b/src/screens/onboarding/InvitationCodeVerification.tsx @@ -1,3 +1,4 @@ +import AsyncStorage from '@react-native-community/async-storage'; import {RouteProp} from '@react-navigation/native'; import {StackNavigationProp} from '@react-navigation/stack'; import React from 'react'; @@ -9,6 +10,7 @@ import { useBlurOnFulfill, useClearByFocusCell, } from 'react-native-confirmation-code-field'; +import {useDispatch} from 'react-redux'; import { ArrowButton, Background, @@ -25,7 +27,7 @@ import { } from '../../constants/strings'; import {OnboardingStackParams} from '../../routes'; import {BackgroundGradientType} from '../../types'; -import {SCREEN_WIDTH} from '../../utils'; +import {SCREEN_WIDTH, userLogin} from '../../utils'; type InvitationCodeVerificationRouteProp = RouteProp< OnboardingStackParams, @@ -56,6 +58,7 @@ const InvitationCodeVerification: React.FC = ({ value, setValue, }); + const dispatch = useDispatch(); const handleInvitationCodeVerification = async () => { if (value.length === 6) { @@ -71,7 +74,11 @@ const InvitationCodeVerification: React.FC = ({ ); if (verifyInviteCodeResponse.status === 200) { - navigation.navigate('Login'); + const userId = route.params.userId; + const username = route.params.username; + await AsyncStorage.setItem('userId', userId); + await AsyncStorage.setItem('username', username); + userLogin(dispatch, {userId, username}); setTimeout(() => { Alert.alert(SUCCESS_INVITATION_CODE); }, 500); diff --git a/src/screens/onboarding/Login.tsx b/src/screens/onboarding/Login.tsx index cfa39dbd..6d9d3a97 100644 --- a/src/screens/onboarding/Login.tsx +++ b/src/screens/onboarding/Login.tsx @@ -170,6 +170,7 @@ const Login: React.FC = ({navigation}: LoginProps) => { } else if (statusCode === 200 && !data.isOnboarded) { navigation.navigate('InvitationCodeVerification', { userId: data.UserID, + username: username, }); setTimeout(() => { Alert.alert(ERROR_NOT_ONBOARDED); diff --git a/src/screens/onboarding/OnboardingStepThree.tsx b/src/screens/onboarding/OnboardingStepThree.tsx index 64a2a2f7..f22d720f 100644 --- a/src/screens/onboarding/OnboardingStepThree.tsx +++ b/src/screens/onboarding/OnboardingStepThree.tsx @@ -57,7 +57,7 @@ const OnboardingStepThree: React.FC = ({ route, navigation, }) => { - const {userId} = route.params; + const {userId, username} = route.params; let emptyDate: string | undefined; const [form, setForm] = React.useState({ smallPic: '', @@ -224,12 +224,12 @@ const OnboardingStepThree: React.FC = ({ }, body: request, }); - console.log(route.params.userId); let statusCode = response.status; let data = await response.json(); if (statusCode === 200) { navigation.navigate('InvitationCodeVerification', { userId: route.params.userId, + username: username, }); } else if (statusCode === 400) { Alert.alert( -- cgit v1.2.3-70-g09d2 From 7f32e6f239cd1458f2e81668f7c940ff103319f4 Mon Sep 17 00:00:00 2001 From: ankit-thanekar007 Date: Fri, 19 Mar 2021 10:47:10 -0700 Subject: UAT bug fixes' --- src/components/moments/CaptionScreenHeader.tsx | 7 ++----- src/components/moments/IndividualMomentTitleBar.tsx | 8 +++++++- src/components/moments/Moment.tsx | 1 + src/screens/main/NotificationsScreen.tsx | 1 + src/screens/onboarding/OnboardingStepTwo.tsx | 2 +- src/screens/onboarding/RegistrationTwo.tsx | 2 +- src/screens/profile/CaptionScreen.tsx | 6 ++---- 7 files changed, 15 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/components/moments/CaptionScreenHeader.tsx b/src/components/moments/CaptionScreenHeader.tsx index 46dfddfe..0638c128 100644 --- a/src/components/moments/CaptionScreenHeader.tsx +++ b/src/components/moments/CaptionScreenHeader.tsx @@ -21,18 +21,15 @@ const styles = StyleSheet.create({ flexDirection: 'row', justifyContent: 'center', alignItems: 'center', - height: '5%', }, headerContainer: { - position: 'absolute', - left: '50%', + width: '90%', }, header: { - position: 'relative', - right: '50%', fontSize: 20, fontWeight: 'bold', color: 'white', + textAlign: 'center', }, }); export default CaptionScreenHeader; diff --git a/src/components/moments/IndividualMomentTitleBar.tsx b/src/components/moments/IndividualMomentTitleBar.tsx index 6cdfe0e8..88e0c308 100644 --- a/src/components/moments/IndividualMomentTitleBar.tsx +++ b/src/components/moments/IndividualMomentTitleBar.tsx @@ -18,7 +18,9 @@ const IndividualMomentTitleBar: React.FC = ({ - {title} + + {title} + ); }; @@ -30,6 +32,10 @@ const styles = StyleSheet.create({ justifyContent: 'center', height: '5%', }, + headerContainer: { + flexShrink: 1, + marginLeft: '11%', + }, header: { color: 'white', fontSize: normalize(18), diff --git a/src/components/moments/Moment.tsx b/src/components/moments/Moment.tsx index 10cf6070..e972a1ca 100644 --- a/src/components/moments/Moment.tsx +++ b/src/components/moments/Moment.tsx @@ -171,6 +171,7 @@ const styles = StyleSheet.create({ alignItems: 'center', }, titleText: { + width: '80%', fontSize: normalize(16), fontWeight: 'bold', color: TAGG_LIGHT_BLUE, diff --git a/src/screens/main/NotificationsScreen.tsx b/src/screens/main/NotificationsScreen.tsx index 501c44fc..57dea6f5 100644 --- a/src/screens/main/NotificationsScreen.tsx +++ b/src/screens/main/NotificationsScreen.tsx @@ -285,6 +285,7 @@ const NotificationsScreen: React.FC = () => { index.toString()} renderItem={renderNotification} diff --git a/src/screens/onboarding/OnboardingStepTwo.tsx b/src/screens/onboarding/OnboardingStepTwo.tsx index 93342c3f..1014981d 100644 --- a/src/screens/onboarding/OnboardingStepTwo.tsx +++ b/src/screens/onboarding/OnboardingStepTwo.tsx @@ -247,7 +247,7 @@ const OnboardingStepTwo: React.FC = ({ = ({ Date: Fri, 19 Mar 2021 11:01:55 -0700 Subject: Typo fix --- src/screens/onboarding/OnboardingStepTwo.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/screens/onboarding/OnboardingStepTwo.tsx b/src/screens/onboarding/OnboardingStepTwo.tsx index 1014981d..06a4f49b 100644 --- a/src/screens/onboarding/OnboardingStepTwo.tsx +++ b/src/screens/onboarding/OnboardingStepTwo.tsx @@ -247,7 +247,7 @@ const OnboardingStepTwo: React.FC = ({ Date: Fri, 19 Mar 2021 11:03:35 -0700 Subject: Typo Typo fix --- src/screens/onboarding/OnboardingStepTwo.tsx | 2 +- src/screens/onboarding/RegistrationTwo.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/screens/onboarding/OnboardingStepTwo.tsx b/src/screens/onboarding/OnboardingStepTwo.tsx index 06a4f49b..1014981d 100644 --- a/src/screens/onboarding/OnboardingStepTwo.tsx +++ b/src/screens/onboarding/OnboardingStepTwo.tsx @@ -247,7 +247,7 @@ const OnboardingStepTwo: React.FC = ({ = ({ Date: Fri, 19 Mar 2021 15:11:12 -0400 Subject: actually using route params --- src/components/profile/Friends.tsx | 1 - src/screens/profile/InviteFriendsScreen.tsx | 16 ++++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/components/profile/Friends.tsx b/src/components/profile/Friends.tsx index d87b0fb0..8a24485f 100644 --- a/src/components/profile/Friends.tsx +++ b/src/components/profile/Friends.tsx @@ -65,7 +65,6 @@ const Friends: React.FC = ({result, screenType, userId}) => { { - console.log('screentype: ', screenType); handleAddFriend(screenType, profilePreview, dispatch, state).then( (success) => { if (success) { diff --git a/src/screens/profile/InviteFriendsScreen.tsx b/src/screens/profile/InviteFriendsScreen.tsx index d1142b7f..36aa8ada 100644 --- a/src/screens/profile/InviteFriendsScreen.tsx +++ b/src/screens/profile/InviteFriendsScreen.tsx @@ -31,15 +31,21 @@ import Animated from 'react-native-reanimated'; import Icon from 'react-native-vector-icons/Feather'; import {InviteFriendTile} from '../../components/friends'; import {TAGG_LIGHT_BLUE} from '../../constants'; +import {MainStackParams} from '../../routes'; +import {RouteProp} from '@react-navigation/native'; const AnimatedIcon = Animated.createAnimatedComponent(Icon); +type InviteFriendsScreenRouteProp = RouteProp< + MainStackParams, + 'InviteFriendsScreen' +>; + interface InviteFriendsScreenProps { - screenType: ScreenType; + route: InviteFriendsScreenRouteProp; } -const InviteFriendsScreen: React.FC = ({ - screenType, -}) => { +const InviteFriendsScreen: React.FC = ({route}) => { + const {screenType} = route.params; const dispatch = useDispatch(); const state = useStore().getState(); const [usersFromContacts, setUsersFromContacts] = useState< @@ -64,7 +70,6 @@ const InviteFriendsScreen: React.FC = ({ let response = await usersFromContactsService(retrievedContacts); await setUsersFromContacts(response.existing_tagg_users); await setNonUsersFromContacts(response.invite_from_contacts); - usersFromContacts.map((user) => console.log('user: ', user.username)); setResults({ usersFromContacts: response.existing_tagg_users, nonUsersFromContacts: response.invite_from_contacts, @@ -81,7 +86,6 @@ const InviteFriendsScreen: React.FC = ({ * Main handler for changes in query. */ useEffect(() => { - console.log('query is now ', query); const search = async () => { if (query.length > 0) { const searchResultsUsers = usersFromContacts.filter( -- cgit v1.2.3-70-g09d2 From f40ef473119116a5708c63845a9196d84794ab09 Mon Sep 17 00:00:00 2001 From: ankit-thanekar007 Date: Fri, 19 Mar 2021 13:04:15 -0700 Subject: Removed Welcome to Tagg Popup --- src/screens/onboarding/InvitationCodeVerification.tsx | 3 --- 1 file changed, 3 deletions(-) (limited to 'src') diff --git a/src/screens/onboarding/InvitationCodeVerification.tsx b/src/screens/onboarding/InvitationCodeVerification.tsx index c8ef16df..7cd4b3bf 100644 --- a/src/screens/onboarding/InvitationCodeVerification.tsx +++ b/src/screens/onboarding/InvitationCodeVerification.tsx @@ -79,9 +79,6 @@ const InvitationCodeVerification: React.FC = ({ await AsyncStorage.setItem('userId', userId); await AsyncStorage.setItem('username', username); userLogin(dispatch, {userId, username}); - setTimeout(() => { - Alert.alert(SUCCESS_INVITATION_CODE); - }, 500); } else { Alert.alert(ERROR_INVALID_INVITATION_CODE); } -- cgit v1.2.3-70-g09d2 From 28667c48d67b5a530437991cb997e9106ba5f9c0 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 19 Mar 2021 16:50:18 -0400 Subject: fixed issue not navigating --- src/routes/main/MainStackNavigator.tsx | 1 + src/routes/main/MainStackScreen.tsx | 8 + .../SuggestedPeopleOnboardingStackNavigator.tsx | 13 -- .../SuggestedPeopleOnboardingStackScreen.tsx | 46 ------ src/routes/suggestedPeopleOnboarding/index.ts | 2 - src/screens/badge/BadgeSelection.tsx | 1 + .../suggestedPeople/SuggestedPeopleScreen.tsx | 170 ++------------------- .../SuggestedPeopleUploadPictureScreen.tsx | 6 +- .../SuggestedPeopleWelcomeScreen.tsx | 13 +- 9 files changed, 39 insertions(+), 221 deletions(-) delete mode 100644 src/routes/suggestedPeopleOnboarding/SuggestedPeopleOnboardingStackNavigator.tsx delete mode 100644 src/routes/suggestedPeopleOnboarding/SuggestedPeopleOnboardingStackScreen.tsx delete mode 100644 src/routes/suggestedPeopleOnboarding/index.ts (limited to 'src') diff --git a/src/routes/main/MainStackNavigator.tsx b/src/routes/main/MainStackNavigator.tsx index f848a5ab..26d9943b 100644 --- a/src/routes/main/MainStackNavigator.tsx +++ b/src/routes/main/MainStackNavigator.tsx @@ -87,6 +87,7 @@ export type MainStackParams = { InviteFriendsScreen: { screenType: ScreenType; }; + SPWelcomeScreen: {}; }; export const MainStack = createStackNavigator(); diff --git a/src/routes/main/MainStackScreen.tsx b/src/routes/main/MainStackScreen.tsx index d2f0d460..8cefd3cc 100644 --- a/src/routes/main/MainStackScreen.tsx +++ b/src/routes/main/MainStackScreen.tsx @@ -25,6 +25,7 @@ import { SocialMediaTaggs, SuggestedPeopleScreen, SuggestedPeopleUploadPictureScreen, + SuggestedPeopleWelcomeScreen, } from '../../screens'; import MutualBadgeHolders from '../../screens/suggestedPeople/MutualBadgeHolders'; import {ScreenType} from '../../types'; @@ -262,6 +263,13 @@ const MainStackScreen: React.FC = ({route}) => { component={MutualBadgeHolders} options={{...modalStyle}} /> + ); }; diff --git a/src/routes/suggestedPeopleOnboarding/SuggestedPeopleOnboardingStackNavigator.tsx b/src/routes/suggestedPeopleOnboarding/SuggestedPeopleOnboardingStackNavigator.tsx deleted file mode 100644 index 30a83200..00000000 --- a/src/routes/suggestedPeopleOnboarding/SuggestedPeopleOnboardingStackNavigator.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import {createStackNavigator} from '@react-navigation/stack'; - -export type SuggestedPeopleOnboardingStackParams = { - WelcomeScreen: undefined; - UploadPicture: { - editing: boolean; - }; - BadgeSelection: { - editing: boolean; - }; -}; - -export const SuggestedPeopleOnboardingStack = createStackNavigator(); diff --git a/src/routes/suggestedPeopleOnboarding/SuggestedPeopleOnboardingStackScreen.tsx b/src/routes/suggestedPeopleOnboarding/SuggestedPeopleOnboardingStackScreen.tsx deleted file mode 100644 index a02e8373..00000000 --- a/src/routes/suggestedPeopleOnboarding/SuggestedPeopleOnboardingStackScreen.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import React from 'react'; -import {SuggestedPeopleOnboardingStack} from './SuggestedPeopleOnboardingStackNavigator'; -import { - SuggestedPeopleWelcomeScreen, - SuggestedPeopleUploadPictureScreen, - BadgeSelection, -} from '../../screens'; -import {SCREEN_WIDTH} from '../../utils'; -import {headerBarOptions} from '../main'; - -const SuggestedPeopleOnboardingStackScreen: React.FC = () => { - return ( - - - - - - ); -}; - -export default SuggestedPeopleOnboardingStackScreen; diff --git a/src/routes/suggestedPeopleOnboarding/index.ts b/src/routes/suggestedPeopleOnboarding/index.ts deleted file mode 100644 index df711493..00000000 --- a/src/routes/suggestedPeopleOnboarding/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './SuggestedPeopleOnboardingStackNavigator'; -export * from './SuggestedPeopleOnboardingStackScreen'; diff --git a/src/screens/badge/BadgeSelection.tsx b/src/screens/badge/BadgeSelection.tsx index cbd7dd88..3003ec8b 100644 --- a/src/screens/badge/BadgeSelection.tsx +++ b/src/screens/badge/BadgeSelection.tsx @@ -74,6 +74,7 @@ const BadgeSelection: React.FC = ({route}) => { const success = await addBadgesService(selectedBadges); if (success) { dispatch(suggestedPeopleBadgesFinished()); + navigation.navigate('SuggestedPeople'); } } else { dispatch(suggestedPeopleBadgesFinished()); diff --git a/src/screens/suggestedPeople/SuggestedPeopleScreen.tsx b/src/screens/suggestedPeople/SuggestedPeopleScreen.tsx index 4094b0a3..76889657 100644 --- a/src/screens/suggestedPeople/SuggestedPeopleScreen.tsx +++ b/src/screens/suggestedPeople/SuggestedPeopleScreen.tsx @@ -1,37 +1,31 @@ import {useFocusEffect, useNavigation} from '@react-navigation/native'; -import React, {useCallback, useEffect, useState, useRef} from 'react'; -import { - FlatList, - RefreshControl, - StatusBar, - StyleSheet, - ViewToken, -} from 'react-native'; - +import React, {useCallback, useEffect, useRef, useState} from 'react'; +import {FlatList, RefreshControl, StatusBar, ViewToken} from 'react-native'; import {useDispatch, useSelector, useStore} from 'react-redux'; -import {TabsGradient, TaggLoadingIndicator, Background} from '../../components'; +import {Background, TabsGradient, TaggLoadingIndicator} from '../../components'; import {SP_PAGE_SIZE} from '../../constants'; +import {MainStack} from '../../routes'; +import MainStackScreen from '../../routes/main/MainStackScreen'; import SuggestedPeopleOnboardingStackScreen from '../../routes/suggestedPeopleOnboarding/SuggestedPeopleOnboardingStackScreen'; import {getSuggestedPeople} from '../../services/SuggestedPeopleService'; import {cancelFriendRequest, resetScreenType} from '../../store/actions'; import {RootState} from '../../store/rootReducer'; import { + BackgroundGradientType, FriendshipStatusType, ProfilePreviewType, ScreenType, SuggestedPeopleDataType, - BackgroundGradientType, } from '../../types'; import { fetchUserX, getUserAsProfilePreviewType, handleAddFriend, - normalize, - SCREEN_HEIGHT, - SCREEN_WIDTH, } from '../../utils'; +import {SuggestedPeopleWelcomeScreen} from '../suggestedPeopleOnboarding'; import {userXInStore} from './../../utils/'; import SPBody from './SPBody'; + /** * Bare bones for suggested people consisting of: * * Image, title, name, username, add friend button [w/o functionality] @@ -209,9 +203,13 @@ const SuggestedPeopleScreen: React.FC = () => { [], ); - return suggested_people_linked === 0 ? ( - - ) : loading ? ( + useFocusEffect(() => { + if (suggested_people_linked === 0) { + navigation.navigate('SPWelcomeScreen'); + } + }); + + return loading ? ( <> @@ -245,142 +243,4 @@ const SuggestedPeopleScreen: React.FC = () => { ); }; -const styles = StyleSheet.create({ - mainContainer: { - flexDirection: 'column', - width: SCREEN_WIDTH, - height: SCREEN_HEIGHT, - paddingVertical: '15%', - paddingBottom: '20%', - justifyContent: 'space-between', - alignSelf: 'center', - }, - marginManager: {marginHorizontal: '5%'}, - image: { - position: 'absolute', - width: SCREEN_WIDTH, - height: SCREEN_HEIGHT, - zIndex: 0, - }, - title: { - zIndex: 1, - paddingTop: '3%', - alignSelf: 'center', - fontSize: normalize(22), - lineHeight: normalize(26), - fontWeight: '800', - letterSpacing: normalize(3), - color: '#FFFEFE', - textShadowColor: 'rgba(0, 0, 0, 0.4)', - textShadowOffset: {width: normalize(2), height: normalize(2)}, - textShadowRadius: normalize(2), - }, - firstName: { - color: '#fff', - fontWeight: '800', - fontSize: normalize(24), - lineHeight: normalize(29), - textShadowColor: 'rgba(0, 0, 0, 0.3)', - textShadowOffset: {width: normalize(2), height: normalize(2)}, - textShadowRadius: normalize(2), - letterSpacing: normalize(2.5), - alignSelf: 'baseline', - }, - username: { - color: '#fff', - fontWeight: '600', - fontSize: normalize(15), - lineHeight: normalize(18), - textShadowColor: 'rgba(0, 0, 0, 0.3)', - textShadowOffset: {width: normalize(2), height: normalize(2)}, - textShadowRadius: normalize(2), - letterSpacing: normalize(2), - }, - nameInfoContainer: {}, - addButton: { - justifyContent: 'center', - alignItems: 'center', - width: SCREEN_WIDTH * 0.3, - height: SCREEN_WIDTH * 0.085, - padding: 0, - borderWidth: 2, - borderColor: '#fff', - borderRadius: 1, - marginLeft: '1%', - marginTop: '4%', - shadowColor: 'rgb(0, 0, 0)', - shadowRadius: 2, - shadowOffset: {width: 2, height: 2}, - shadowOpacity: 0.5, - }, - addButtonTitle: { - color: 'white', - padding: 0, - fontSize: normalize(15), - lineHeight: normalize(18), - fontWeight: 'bold', - textAlign: 'center', - letterSpacing: normalize(1), - }, - addUserContainer: { - flexDirection: 'row', - justifyContent: 'space-between', - alignItems: 'flex-start', - marginBottom: '5%', - }, - requestedButton: { - justifyContent: 'center', - alignItems: 'center', - width: SCREEN_WIDTH * 0.3, - height: SCREEN_WIDTH * 0.085, - padding: 0, - borderWidth: 2, - borderColor: 'transparent', - borderRadius: 1, - marginLeft: '1%', - marginTop: '4%', - shadowColor: 'rgb(0, 0, 0)', - shadowRadius: 2, - shadowOffset: {width: 2, height: 2}, - shadowOpacity: 0.5, - }, - requestedButtonTitle: { - backgroundColor: 'transparent', - fontSize: normalize(15), - lineHeight: normalize(18), - fontWeight: 'bold', - textAlign: 'center', - letterSpacing: normalize(1), - }, - body: {}, - - button: { - justifyContent: 'center', - alignItems: 'center', - width: SCREEN_WIDTH * 0.4, - aspectRatio: 154 / 33, - borderWidth: 2, - borderColor: '#fff', - borderRadius: 3, - marginRight: '2%', - marginLeft: '1%', - }, - transparentBG: { - backgroundColor: 'transparent', - }, - lightBlueBG: { - backgroundColor: '#fff', - }, - label: { - fontSize: normalize(15), - fontWeight: '700', - letterSpacing: 1, - }, - blueLabel: { - color: '#fff', - }, - whiteLabel: { - color: 'white', - }, -}); export default SuggestedPeopleScreen; diff --git a/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx b/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx index 87e22d9e..0a4e5718 100644 --- a/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx +++ b/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx @@ -98,7 +98,7 @@ const SuggestedPeopleUploadPictureScreen: React.FC { Alert.alert(success ? SUCCESS_PIC_UPLOAD : ERROR_UPLOAD_SP_PHOTO); }, 500); } } - navigation.goBack(); }; return ( @@ -161,7 +161,7 @@ const SuggestedPeopleUploadPictureScreen: React.FC { - navigation.push('BadgeSelection', {editing: true}); + navigation.navigate('BadgeSelection', {editing: true}); }}> diff --git a/src/screens/suggestedPeopleOnboarding/SuggestedPeopleWelcomeScreen.tsx b/src/screens/suggestedPeopleOnboarding/SuggestedPeopleWelcomeScreen.tsx index 10f3b3a5..2f12d909 100644 --- a/src/screens/suggestedPeopleOnboarding/SuggestedPeopleWelcomeScreen.tsx +++ b/src/screens/suggestedPeopleOnboarding/SuggestedPeopleWelcomeScreen.tsx @@ -1,6 +1,6 @@ import {BlurView} from '@react-native-community/blur'; import {useNavigation} from '@react-navigation/native'; -import React from 'react'; +import React, {Fragment, useEffect} from 'react'; import {Image, StatusBar, StyleSheet, TouchableOpacity} from 'react-native'; import {Text} from 'react-native-animatable'; import {SafeAreaView} from 'react-native-safe-area-context'; @@ -9,6 +9,13 @@ import {isIPhoneX, normalize, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; const SuggestedPeopleWelcomeScreen: React.FC = () => { const navigation = useNavigation(); + + useEffect(() => { + navigation.setOptions({ + headerBackImage: () => , + }); + }, []); + return ( <> @@ -35,7 +42,9 @@ const SuggestedPeopleWelcomeScreen: React.FC = () => { navigation.push('UploadPicture')}> + onPress={() => + navigation.navigate('UpdateSPPicture', {editing: false}) + }> -- cgit v1.2.3-70-g09d2 From 97039f6ac5beb342fbc330b5bef2101a555695af Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 19 Mar 2021 17:05:35 -0400 Subject: renamed --- src/components/profile/Friends.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/components/profile/Friends.tsx b/src/components/profile/Friends.tsx index cf354e06..ac724ae0 100644 --- a/src/components/profile/Friends.tsx +++ b/src/components/profile/Friends.tsx @@ -112,7 +112,9 @@ const Friends: React.FC = ({result, screenType, userId}) => { } }}> - Find Friends + + Invite Friends + -- cgit v1.2.3-70-g09d2 From 22fbeb6a6b438f6aaee04d42e81c4e02a8e7e130 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 19 Mar 2021 17:10:28 -0400 Subject: removed log --- src/services/UserFriendsService.ts | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/services/UserFriendsService.ts b/src/services/UserFriendsService.ts index cea20fbe..c36cdaa7 100644 --- a/src/services/UserFriendsService.ts +++ b/src/services/UserFriendsService.ts @@ -193,7 +193,6 @@ export const deleteFriendshipService = async ( export const usersFromContactsService = async ( contacts: Array, ) => { - console.log('Contacts: ', contacts); try { const token = await AsyncStorage.getItem('token'); const response = await fetch(USERS_FROM_CONTACTS_ENDPOINT, { -- cgit v1.2.3-70-g09d2 From 4338e7bd5b9ea86268095c05011bfcef22c43a74 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 19 Mar 2021 17:21:06 -0400 Subject: fixed crash when trying to view own profile in sp --- src/screens/badge/BadgeSelection.tsx | 1 + src/screens/suggestedPeople/SPBody.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/screens/badge/BadgeSelection.tsx b/src/screens/badge/BadgeSelection.tsx index 3003ec8b..335d4333 100644 --- a/src/screens/badge/BadgeSelection.tsx +++ b/src/screens/badge/BadgeSelection.tsx @@ -78,6 +78,7 @@ const BadgeSelection: React.FC = ({route}) => { } } else { dispatch(suggestedPeopleBadgesFinished()); + navigation.navigate('SuggestedPeople'); } } }}> diff --git a/src/screens/suggestedPeople/SPBody.tsx b/src/screens/suggestedPeople/SPBody.tsx index 06d3efb3..8e0801c2 100644 --- a/src/screens/suggestedPeople/SPBody.tsx +++ b/src/screens/suggestedPeople/SPBody.tsx @@ -121,7 +121,7 @@ const SPBody: React.FC = ({ { navigation.push('Profile', { - userXId: user.id, + userXId: loggedInUserId === user.id ? undefined : user.id, screenType, }); }} -- cgit v1.2.3-70-g09d2 From 8013dd29f447990f95cc4ad9557238fc825bcc54 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 19 Mar 2021 18:02:52 -0400 Subject: comment out data release --- src/screens/profile/ProfileScreen.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/screens/profile/ProfileScreen.tsx b/src/screens/profile/ProfileScreen.tsx index 5edc6277..313e2f2c 100644 --- a/src/screens/profile/ProfileScreen.tsx +++ b/src/screens/profile/ProfileScreen.tsx @@ -38,11 +38,11 @@ const ProfileScreen: React.FC = ({route}) => { * This is done to reset the users stored in our store for the Search screen. * Read more about useFocusEffect here : https://reactnavigation.org/docs/function-after-focusing-screen/ */ - useFocusEffect(() => { - if (!userXId) { - dispatch(resetScreenType(screenType)); - } - }); + // useFocusEffect(() => { + // if (!userXId) { + // dispatch(resetScreenType(screenType)); + // } + // }); return ( <> -- cgit v1.2.3-70-g09d2 From 6b301e6bb7be9330f27f8df4291fbcb07381a6b3 Mon Sep 17 00:00:00 2001 From: ankit-thanekar007 Date: Fri, 19 Mar 2021 15:39:54 -0700 Subject: UAT Bug fixes --- src/components/moments/Moment.tsx | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/components/moments/Moment.tsx b/src/components/moments/Moment.tsx index e972a1ca..2ac6aebb 100644 --- a/src/components/moments/Moment.tsx +++ b/src/components/moments/Moment.tsx @@ -12,7 +12,7 @@ import PlusIcon from '../../assets/icons/plus_icon-01.svg'; import BigPlusIcon from '../../assets/icons/plus_icon-02.svg'; import UpIcon from '../../assets/icons/up_icon.svg'; import {TAGG_LIGHT_BLUE} from '../../constants'; -import {ERROR_UPLOAD_MOMENT_SHORT} from '../../constants/strings'; +import {ERROR_UPLOAD} from '../../constants/strings'; import {normalize, SCREEN_WIDTH} from '../../utils'; import MomentTile from './MomentTile'; @@ -69,7 +69,7 @@ const Moment: React.FC = ({ }) .catch((err) => { if (err.code && err.code !== 'E_PICKER_CANCELLED') { - Alert.alert(ERROR_UPLOAD_MOMENT_SHORT); + Alert.alert(ERROR_UPLOAD); } }); }; @@ -81,14 +81,14 @@ const Moment: React.FC = ({ {title} {!userXId ? ( - <> + {showUpButton && move && ( move('up', title)} color={TAGG_LIGHT_BLUE} - style={{marginLeft: 5}} + style={{marginHorizontal: 4}} /> )} {showDownButton && move && ( @@ -97,31 +97,32 @@ const Moment: React.FC = ({ height={19} onPress={() => move('down', title)} color={TAGG_LIGHT_BLUE} - style={{marginLeft: 5}} + style={{marginHorizontal: 4}} /> )} - + ) : ( )} - + {/* */} {!userXId ? ( - <> + navigateToImagePicker()} color={TAGG_LIGHT_BLUE} - style={{marginRight: 10}} + style={{marginHorizontal: 4}} /> {shouldAllowDeletion && ( handleMomentCategoryDelete(title)} width={19} height={19} + style={{marginHorizontal: 4}} /> )} - + ) : ( )} @@ -171,7 +172,7 @@ const styles = StyleSheet.create({ alignItems: 'center', }, titleText: { - width: '80%', + width: '70%', fontSize: normalize(16), fontWeight: 'bold', color: TAGG_LIGHT_BLUE, -- cgit v1.2.3-70-g09d2 From 26cc956602a359ea29a6728b6a98416e098571a0 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Fri, 19 Mar 2021 17:57:27 -0700 Subject: fixed --- src/screens/profile/InviteFriendsScreen.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/screens/profile/InviteFriendsScreen.tsx b/src/screens/profile/InviteFriendsScreen.tsx index 36aa8ada..dcf6ccfc 100644 --- a/src/screens/profile/InviteFriendsScreen.tsx +++ b/src/screens/profile/InviteFriendsScreen.tsx @@ -14,11 +14,12 @@ import { ScrollView, } from 'react-native'; import {useDispatch, useStore} from 'react-redux'; -import {ProfilePreviewType, ScreenType} from '../../types'; +import {ProfilePreviewType} from '../../types'; import { extractContacts, handleAddFriend, HeaderHeight, + isIPhoneX, normalize, SCREEN_HEIGHT, SCREEN_WIDTH, @@ -229,7 +230,7 @@ const styles = StyleSheet.create({ }, headerContainer: { width: SCREEN_WIDTH * 0.85, - height: 50, + height: isIPhoneX() ? SCREEN_HEIGHT * 0.06 : SCREEN_HEIGHT * 0.08, alignSelf: 'center', }, nonUsersFlatListContainer: {paddingBottom: 130}, -- cgit v1.2.3-70-g09d2 From c366c96281c6235cb3b37dd26cf18cc4daa9df1d Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Fri, 19 Mar 2021 18:08:57 -0700 Subject: switched --- src/screens/onboarding/OnboardingStepTwo.tsx | 34 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/screens/onboarding/OnboardingStepTwo.tsx b/src/screens/onboarding/OnboardingStepTwo.tsx index 1014981d..e79e1886 100644 --- a/src/screens/onboarding/OnboardingStepTwo.tsx +++ b/src/screens/onboarding/OnboardingStepTwo.tsx @@ -244,23 +244,6 @@ const OnboardingStepTwo: React.FC = ({ SIGN UP - = ({ attemptedSubmit={form.attemptedSubmit} width={280} /> + Date: Fri, 19 Mar 2021 20:00:29 -0700 Subject: done --- src/assets/icons/invite-friends-prompt-icon.png | Bin 0 -> 153479 bytes src/components/common/TaggPrompt.tsx | 4 +- .../notifications/NotificationPrompts.tsx | 58 +++++++++++++++++++++ src/components/notifications/index.ts | 1 + src/screens/main/NotificationsScreen.tsx | 36 ++----------- 5 files changed, 67 insertions(+), 32 deletions(-) create mode 100644 src/assets/icons/invite-friends-prompt-icon.png create mode 100644 src/components/notifications/NotificationPrompts.tsx (limited to 'src') diff --git a/src/assets/icons/invite-friends-prompt-icon.png b/src/assets/icons/invite-friends-prompt-icon.png new file mode 100644 index 00000000..b9422b9f Binary files /dev/null and b/src/assets/icons/invite-friends-prompt-icon.png differ diff --git a/src/components/common/TaggPrompt.tsx b/src/components/common/TaggPrompt.tsx index 75f3009b..d65e30c6 100644 --- a/src/components/common/TaggPrompt.tsx +++ b/src/components/common/TaggPrompt.tsx @@ -7,7 +7,7 @@ import {normalize, SCREEN_HEIGHT} from '../../utils'; type TaggPromptProps = { messageHeader: string; messageBody: string | Element; - logoType: 'plus' | 'tagg'; + logoType: 'plus' | 'tagg' | 'invite_friends'; hideCloseButton?: boolean; noPadding?: boolean; onClose: () => void; @@ -29,6 +29,8 @@ const TaggPrompt: React.FC = ({ switch (logoType) { case 'plus': return require('../../assets/icons/plus-logo.png'); + case 'invite_friends': + return require('../../assets/icons/invite-friends-prompt-icon.png'); case 'tagg': default: return require('../../assets/images/logo-purple.png'); diff --git a/src/components/notifications/NotificationPrompts.tsx b/src/components/notifications/NotificationPrompts.tsx new file mode 100644 index 00000000..35e69496 --- /dev/null +++ b/src/components/notifications/NotificationPrompts.tsx @@ -0,0 +1,58 @@ +import React, {Fragment} from 'react'; +import {Image, StyleSheet, Text} from 'react-native'; +import {TaggPrompt} from '..'; + +export const InviteFriendsPrompt: React.FC = () => { + return ( + {}} + /> + ); +}; + +interface SPPromptNotificationProps { + showSPNotifyPopUp: boolean; +} + +export const SPPromptNotification: React.FC = ({ + showSPNotifyPopUp, +}) => { + return showSPNotifyPopUp ? ( + + + A new page where you can discover new profiles. Just press the new{' '} + + + button on the tab bar to check it out! + + } + logoType={'tagg'} + hideCloseButton={true} + noPadding={true} + onClose={() => {}} + /> + ) : ( + + ); +}; + +const styles = StyleSheet.create({ + icon: { + width: 20, + height: 20, + tintColor: 'grey', + }, +}); diff --git a/src/components/notifications/index.ts b/src/components/notifications/index.ts index 0260ce24..733b56f1 100644 --- a/src/components/notifications/index.ts +++ b/src/components/notifications/index.ts @@ -1 +1,2 @@ export {default as Notification} from './Notification'; +export {InviteFriendsPrompt} from './NotificationPrompts'; diff --git a/src/screens/main/NotificationsScreen.tsx b/src/screens/main/NotificationsScreen.tsx index 57dea6f5..68437f2b 100644 --- a/src/screens/main/NotificationsScreen.tsx +++ b/src/screens/main/NotificationsScreen.tsx @@ -21,7 +21,10 @@ import {TouchableOpacity} from 'react-native-gesture-handler'; import {SafeAreaView} from 'react-native-safe-area-context'; import {useDispatch, useSelector} from 'react-redux'; import {TabsGradient, TaggPrompt} from '../../components'; -import {Notification} from '../../components/notifications'; +import { + InviteFriendsPrompt, + Notification, +} from '../../components/notifications'; import { loadUserNotifications, updateNewNotificationReceived, @@ -252,30 +255,6 @@ const NotificationsScreen: React.FC = () => { return null; }; - const SPPromptNotification: ReactElement = showSPNotifyPopUp ? ( - - - A new page where you can discover new profiles. Just press the new{' '} - - - button on the tab bar to check it out! - - } - logoType={'tagg'} - hideCloseButton={true} - noPadding={true} - onClose={() => {}} - /> - ) : ( - - ); - return ( @@ -291,7 +270,7 @@ const NotificationsScreen: React.FC = () => { renderItem={renderNotification} renderSectionHeader={renderSectionHeader} renderSectionFooter={renderSectionFooter} - ListHeaderComponent={SPPromptNotification} + ListHeaderComponent={} refreshControl={ } @@ -359,11 +338,6 @@ const styles = StyleSheet.create({ flex: 1, justifyContent: 'center', }, - icon: { - width: 20, - height: 20, - tintColor: 'grey', - }, }); export default NotificationsScreen; -- cgit v1.2.3-70-g09d2 From 92c5ca830adda915dcc87948e9d23868cef5b6c4 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Fri, 19 Mar 2021 21:24:03 -0700 Subject: done --- src/components/friends/InviteFriendTile.tsx | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/components/friends/InviteFriendTile.tsx b/src/components/friends/InviteFriendTile.tsx index 3fbf2e73..95ebf16a 100644 --- a/src/components/friends/InviteFriendTile.tsx +++ b/src/components/friends/InviteFriendTile.tsx @@ -58,10 +58,17 @@ const InviteFriendTile: React.FC = ({item}) => { - - {invited ? 'Invited' : 'Invite'} + + {invited ? 'Pending' : 'Invite'} @@ -98,14 +105,18 @@ const styles = StyleSheet.create({ alignItems: 'center', width: 82, height: 25, - borderColor: TAGG_LIGHT_BLUE, borderWidth: 2, borderRadius: 2, padding: 0, + borderColor: TAGG_LIGHT_BLUE, + }, + pendingButton: { + backgroundColor: TAGG_LIGHT_BLUE, + }, + inviteButton: { backgroundColor: 'transparent', }, buttonTitle: { - color: TAGG_LIGHT_BLUE, padding: 0, fontSize: normalize(11), fontWeight: '700', @@ -113,6 +124,12 @@ const styles = StyleSheet.create({ letterSpacing: normalize(0.6), paddingHorizontal: '3.8%', }, + pendingButtonTitle: { + color: 'white', + }, + inviteButtonTitle: { + color: TAGG_LIGHT_BLUE, + }, }); export default InviteFriendTile; -- cgit v1.2.3-70-g09d2 From c9f2df66c0473bb5edb290dc1bf6b2a39ec55870 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Fri, 19 Mar 2021 23:08:55 -0700 Subject: improved filtering --- src/screens/profile/InviteFriendsScreen.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/screens/profile/InviteFriendsScreen.tsx b/src/screens/profile/InviteFriendsScreen.tsx index 36aa8ada..b68da127 100644 --- a/src/screens/profile/InviteFriendsScreen.tsx +++ b/src/screens/profile/InviteFriendsScreen.tsx @@ -90,14 +90,18 @@ const InviteFriendsScreen: React.FC = ({route}) => { if (query.length > 0) { const searchResultsUsers = usersFromContacts.filter( (item: ProfilePreviewType) => - item.first_name.toLowerCase().includes(query) || - item.last_name.toLowerCase().includes(query) || - item.username.toLowerCase().includes(query), + item.last_name.toLowerCase().startsWith(query) || + (item.first_name + ' ' + item.last_name) + .toLowerCase() + .startsWith(query) || + item.username.toLowerCase().startsWith(query), ); const searchResultsNonUsers = nonUsersFromContacts.filter( (item) => - item.firstName.toLowerCase().includes(query) || - item.lastName.toLowerCase().includes(query), + item.lastName.toLowerCase().includes(query) || + (item.firstName + ' ' + item.lastName) + .toLowerCase() + .includes(query), ); const sanitizedResult = { usersFromContacts: searchResultsUsers, -- cgit v1.2.3-70-g09d2 From f76e7c52fa9fe1365c234535f095efe4d815a16a Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Fri, 19 Mar 2021 23:11:46 -0700 Subject: missed --- src/screens/profile/InviteFriendsScreen.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/screens/profile/InviteFriendsScreen.tsx b/src/screens/profile/InviteFriendsScreen.tsx index b68da127..cc783b25 100644 --- a/src/screens/profile/InviteFriendsScreen.tsx +++ b/src/screens/profile/InviteFriendsScreen.tsx @@ -98,10 +98,10 @@ const InviteFriendsScreen: React.FC = ({route}) => { ); const searchResultsNonUsers = nonUsersFromContacts.filter( (item) => - item.lastName.toLowerCase().includes(query) || + item.lastName.toLowerCase().startsWith(query) || (item.firstName + ' ' + item.lastName) .toLowerCase() - .includes(query), + .startsWith(query), ); const sanitizedResult = { usersFromContacts: searchResultsUsers, -- cgit v1.2.3-70-g09d2 From dfe076654f06c9a38c4ffcc5aa48ff2626c5e9ff Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Fri, 19 Mar 2021 23:13:54 -0700 Subject: slight ocd.. --- src/screens/profile/InviteFriendsScreen.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/screens/profile/InviteFriendsScreen.tsx b/src/screens/profile/InviteFriendsScreen.tsx index cc783b25..53e6b221 100644 --- a/src/screens/profile/InviteFriendsScreen.tsx +++ b/src/screens/profile/InviteFriendsScreen.tsx @@ -90,18 +90,18 @@ const InviteFriendsScreen: React.FC = ({route}) => { if (query.length > 0) { const searchResultsUsers = usersFromContacts.filter( (item: ProfilePreviewType) => - item.last_name.toLowerCase().startsWith(query) || (item.first_name + ' ' + item.last_name) .toLowerCase() .startsWith(query) || - item.username.toLowerCase().startsWith(query), + item.username.toLowerCase().startsWith(query) || + item.last_name.toLowerCase().startsWith(query), ); const searchResultsNonUsers = nonUsersFromContacts.filter( (item) => - item.lastName.toLowerCase().startsWith(query) || (item.firstName + ' ' + item.lastName) .toLowerCase() - .startsWith(query), + .startsWith(query) || + item.lastName.toLowerCase().startsWith(query), ); const sanitizedResult = { usersFromContacts: searchResultsUsers, -- cgit v1.2.3-70-g09d2 From a4a7b8a80207c0a921464f7c64bc53821e47ce13 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Sat, 20 Mar 2021 13:33:18 -0400 Subject: resolve import --- src/components/notifications/NotificationPrompts.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/components/notifications/NotificationPrompts.tsx b/src/components/notifications/NotificationPrompts.tsx index 35e69496..03502b27 100644 --- a/src/components/notifications/NotificationPrompts.tsx +++ b/src/components/notifications/NotificationPrompts.tsx @@ -1,6 +1,6 @@ import React, {Fragment} from 'react'; import {Image, StyleSheet, Text} from 'react-native'; -import {TaggPrompt} from '..'; +import {TaggPrompt} from '../common'; export const InviteFriendsPrompt: React.FC = () => { return ( -- cgit v1.2.3-70-g09d2 From 57529ed6e4f797e5e5a80983e498cf3f7309d052 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Sat, 20 Mar 2021 14:30:55 -0400 Subject: done --- src/components/notifications/NotificationPrompts.tsx | 2 +- src/screens/profile/FriendsListScreen.tsx | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/components/notifications/NotificationPrompts.tsx b/src/components/notifications/NotificationPrompts.tsx index 03502b27..dc27925b 100644 --- a/src/components/notifications/NotificationPrompts.tsx +++ b/src/components/notifications/NotificationPrompts.tsx @@ -7,7 +7,7 @@ export const InviteFriendsPrompt: React.FC = () => { = ({route}) => { <> - + - + @@ -46,7 +52,7 @@ const styles = StyleSheet.create({ body: { marginTop: HeaderHeight, width: SCREEN_WIDTH, - height: SCREEN_HEIGHT * 0.8, + height: SCREEN_HEIGHT - HeaderHeight, }, }); -- cgit v1.2.3-70-g09d2