From f81a4e1a05ca3fa66c2798b047d4bfd6995f462d Mon Sep 17 00:00:00 2001
From: Shravya Ramesh <shravs1208@gmail.com>
Date: Thu, 18 Mar 2021 13:44:19 -0700
Subject: Support modified endpoints + refactoring

---
 src/screens/profile/InviteFriendsScreen.tsx | 32 +++++++++--------------------
 1 file changed, 10 insertions(+), 22 deletions(-)

(limited to 'src/screens/profile/InviteFriendsScreen.tsx')

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<InviteFriendsScreenProps> = ({
   });
   const [query, setQuery] = useState('');
 
-  const extractContacts = async () => {
-    let retrievedContacts: Array<ContactType> = [];
-    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<InviteFriendsScreenProps> = ({
         <SafeAreaView>
           <StatusBar barStyle="dark-content" />
           <View style={styles.body}>
-            <View style={{width: 319, height: 42, alignSelf: 'center', marginBottom: '2%',}}>
+            <View
+              style={{
+                width: 319,
+                height: 42,
+                alignSelf: 'center',
+                marginBottom: '2%',
+              }}>
               <Text style={[styles.subheaderText, {textAlign: 'center'}]}>
                 Sharing is caring, invite friends, and create moments together!
               </Text>
@@ -224,9 +213,7 @@ const InviteFriendsScreen: React.FC<InviteFriendsScreenProps> = ({
               </Animated.View>
             </View>
             <View style={styles.subheader}>
-              <Text style={[styles.subheaderText, {marginBottom: '5%'}]}>
-                Add Friends
-              </Text>
+              <Text style={styles.subheaderText}>Add Friends</Text>
               <UsersFromContacts />
             </View>
             <View style={styles.subheader}>
@@ -257,6 +244,7 @@ const styles = StyleSheet.create({
     fontSize: normalize(12),
     fontWeight: '600',
     lineHeight: normalize(14.32),
+    marginBottom: '5%',
   },
   container: {
     alignSelf: 'center',
-- 
cgit v1.2.3-70-g09d2

