From f662d1cd85447de0f6be945a350d1f2d1be5033e Mon Sep 17 00:00:00 2001
From: ankit-thanekar007 <ankit.thanekar007@gmail.com>
Date: Wed, 17 Mar 2021 11:07:45 -0700
Subject: Separated Private and Public Profiles

---
 src/components/profile/PrivateProfile.tsx | 33 +++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 src/components/profile/PrivateProfile.tsx

(limited to 'src/components/profile/PrivateProfile.tsx')

diff --git a/src/components/profile/PrivateProfile.tsx b/src/components/profile/PrivateProfile.tsx
new file mode 100644
index 00000000..efa7ff39
--- /dev/null
+++ b/src/components/profile/PrivateProfile.tsx
@@ -0,0 +1,33 @@
+import React from 'react';
+import {Image, StyleSheet, Text, View} from 'react-native';
+import {PRIVATE_ACCOUNT} from '../../constants/strings';
+import {normalize, SCREEN_HEIGHT} from '../../utils';
+
+const PrivateProfile: React.FC = () => {
+  return (
+    <View style={styles.container}>
+      <Image source={require('../../assets/images/private-profile.png')} />
+      <View style={styles.privateAccountTextContainer}>
+        <Text style={styles.privateAccountTextStyle}>{PRIVATE_ACCOUNT}</Text>
+      </View>
+    </View>
+  );
+};
+
+const styles = StyleSheet.create({
+  container: {
+    backgroundColor: '#F9F9F9',
+    alignItems: 'center',
+    justifyContent: 'center',
+    height: SCREEN_HEIGHT * 0.3,
+  },
+  privateAccountTextContainer: {marginTop: '8%'},
+  privateAccountTextStyle: {
+    fontWeight: '600',
+    fontSize: normalize(18),
+    lineHeight: normalize(25),
+    color: '#828282',
+  },
+});
+
+export default PrivateProfile;
-- 
cgit v1.2.3-70-g09d2


From 82acd049763452decdab0c40e6cf7286dd2ed57d Mon Sep 17 00:00:00 2001
From: ankit-thanekar007 <ankit.thanekar007@gmail.com>
Date: Thu, 25 Mar 2021 17:09:45 -0700
Subject: Private account toggle changes

---
 src/components/profile/Content.tsx        | 29 ++++++++++++++++++++++-------
 src/components/profile/PrivateProfile.tsx |  4 ++--
 src/components/profile/ProfileBody.tsx    |  1 +
 src/components/profile/PublicProfile.tsx  |  2 +-
 4 files changed, 26 insertions(+), 10 deletions(-)

(limited to 'src/components/profile/PrivateProfile.tsx')

diff --git a/src/components/profile/Content.tsx b/src/components/profile/Content.tsx
index 860e16c5..8d77d798 100644
--- a/src/components/profile/Content.tsx
+++ b/src/components/profile/Content.tsx
@@ -41,7 +41,6 @@ const Content: React.FC<ContentProps> = ({y, userXId, screenType}) => {
   const {user = NO_USER, profile = NO_PROFILE} = userXId
     ? useSelector((state: RootState) => state.userX[screenType][userXId])
     : useSelector((state: RootState) => state.user);
-
   const {blockedUsers = EMPTY_PROFILE_PREVIEW_LIST} = useSelector(
     (state: RootState) => state.blocked,
   );
@@ -55,20 +54,19 @@ const Content: React.FC<ContentProps> = ({y, userXId, screenType}) => {
    */
   const [isFriend, setIsFriend] = useState<boolean>(false);
   const [isBlocked, setIsBlocked] = useState<boolean>(false);
-  const [isPrivate, setIsPrivate] = useState<boolean>(true);
   const [profileBodyHeight, setProfileBodyHeight] = useState(0);
   const [shouldBounce, setShouldBounce] = useState<boolean>(true);
   const [refreshing, setRefreshing] = useState<boolean>(false);
 
   const onRefresh = useCallback(() => {
     const refrestState = async () => {
+      setRefreshing(true);
       if (!userXId) {
         await userLogin(dispatch, loggedInUser);
       } else {
         await fetchUserX(dispatch, user, screenType);
       }
     };
-    setRefreshing(true);
     refrestState().then(() => {
       setRefreshing(false);
     });
@@ -88,6 +86,10 @@ const Content: React.FC<ContentProps> = ({y, userXId, screenType}) => {
     }
   }, [blockedUsers, user]);
 
+  useEffect(() => {
+    setIsFriend(profile.friendship_status === 'friends');
+  }, [profile.friendship_status]);
+
   /**
    * Handles a click on the block / unblock button.
    * loadFriends updates friends list for the logged in user
@@ -108,6 +110,16 @@ const Content: React.FC<ContentProps> = ({y, userXId, screenType}) => {
     }
   };
 
+  const canViewProfile = () => {
+    if (loggedInUser.userId === user.userId) {
+      return true;
+    } else if (profile.is_private && !isFriend) {
+      return false;
+    } else {
+      return true;
+    }
+  };
+
   const handleScroll = (e: NativeSyntheticEvent<NativeScrollEvent>) => {
     /**
      * Set the new y position
@@ -153,13 +165,16 @@ const Content: React.FC<ContentProps> = ({y, userXId, screenType}) => {
           isBlocked,
         }}
       />
-      {isPrivate ? (
-        <PrivateProfile />
-      ) : (
+      {canViewProfile() ? (
         <>
-          <TaggsBar {...{y, profileBodyHeight, userXId, screenType}} />
+          <TaggsBar
+            {...{y, profileBodyHeight, userXId, screenType}}
+            whiteRing={undefined}
+          />
           <PublicProfile {...{y, userXId, screenType}} />
         </>
+      ) : (
+        <PrivateProfile />
       )}
     </Animated.ScrollView>
   );
diff --git a/src/components/profile/PrivateProfile.tsx b/src/components/profile/PrivateProfile.tsx
index efa7ff39..07a0dccc 100644
--- a/src/components/profile/PrivateProfile.tsx
+++ b/src/components/profile/PrivateProfile.tsx
@@ -16,10 +16,10 @@ const PrivateProfile: React.FC = () => {
 
 const styles = StyleSheet.create({
   container: {
-    backgroundColor: '#F9F9F9',
     alignItems: 'center',
     justifyContent: 'center',
-    height: SCREEN_HEIGHT * 0.3,
+    backgroundColor: '#F9F9F9',
+    height: SCREEN_HEIGHT * 0.35,
   },
   privateAccountTextContainer: {marginTop: '8%'},
   privateAccountTextStyle: {
diff --git a/src/components/profile/ProfileBody.tsx b/src/components/profile/ProfileBody.tsx
index 646be3e0..3aef5990 100644
--- a/src/components/profile/ProfileBody.tsx
+++ b/src/components/profile/ProfileBody.tsx
@@ -119,6 +119,7 @@ const styles = StyleSheet.create({
     flex: 1,
     paddingTop: '3.5%',
     paddingBottom: '2%',
+    width: '50%',
   },
   container: {
     paddingVertical: '1%',
diff --git a/src/components/profile/PublicProfile.tsx b/src/components/profile/PublicProfile.tsx
index f453d05b..4b5166f0 100644
--- a/src/components/profile/PublicProfile.tsx
+++ b/src/components/profile/PublicProfile.tsx
@@ -227,7 +227,7 @@ const PublicProfile: React.FC<ContentProps> = ({y, userXId, screenType}) => {
       {!userXId && (
         <TouchableOpacity
           onPress={() =>
-            navigation.push('CategorySelection', {
+            navigation.navigate('CategorySelection', {
               screenType: CategorySelectionScreenType.Profile,
               user: loggedInUser,
             })
-- 
cgit v1.2.3-70-g09d2


From ee80ddfb8a486fea31d845aba4e0b4847fe637e9 Mon Sep 17 00:00:00 2001
From: Ivan Chen <ivan@tagg.id>
Date: Mon, 29 Mar 2021 14:43:35 -0400
Subject: updated padding

---
 src/components/profile/Content.tsx        | 1 -
 src/components/profile/PrivateProfile.tsx | 3 ++-
 src/components/profile/PublicProfile.tsx  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

(limited to 'src/components/profile/PrivateProfile.tsx')

diff --git a/src/components/profile/Content.tsx b/src/components/profile/Content.tsx
index c9a87ad1..a22b9728 100644
--- a/src/components/profile/Content.tsx
+++ b/src/components/profile/Content.tsx
@@ -172,7 +172,6 @@ const styles = StyleSheet.create({
   },
   contentContainer: {
     flexGrow: 1,
-    paddingBottom: SCREEN_HEIGHT * 0.1,
   },
 });
 
diff --git a/src/components/profile/PrivateProfile.tsx b/src/components/profile/PrivateProfile.tsx
index 07a0dccc..bc75a18a 100644
--- a/src/components/profile/PrivateProfile.tsx
+++ b/src/components/profile/PrivateProfile.tsx
@@ -19,7 +19,8 @@ const styles = StyleSheet.create({
     alignItems: 'center',
     justifyContent: 'center',
     backgroundColor: '#F9F9F9',
-    height: SCREEN_HEIGHT * 0.35,
+    height: SCREEN_HEIGHT * 0.4,
+    paddingBottom: SCREEN_HEIGHT * 0.1,
   },
   privateAccountTextContainer: {marginTop: '8%'},
   privateAccountTextStyle: {
diff --git a/src/components/profile/PublicProfile.tsx b/src/components/profile/PublicProfile.tsx
index 3272bca1..9683d8f2 100644
--- a/src/components/profile/PublicProfile.tsx
+++ b/src/components/profile/PublicProfile.tsx
@@ -245,7 +245,7 @@ const styles = StyleSheet.create({
   },
   momentsContainer: {
     backgroundColor: '#f2f2f2',
-    paddingBottom: SCREEN_HEIGHT / 10,
+    paddingBottom: SCREEN_HEIGHT * 0.15,
     flex: 1,
     flexDirection: 'column',
   },
-- 
cgit v1.2.3-70-g09d2

