aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/suggestedPeople/SPTaggsBar.tsx4
-rw-r--r--src/components/taggs/Tagg.tsx42
-rw-r--r--src/components/taggs/TaggsBar.tsx12
3 files changed, 29 insertions, 29 deletions
diff --git a/src/components/suggestedPeople/SPTaggsBar.tsx b/src/components/suggestedPeople/SPTaggsBar.tsx
index adac6dcf..29c58cce 100644
--- a/src/components/suggestedPeople/SPTaggsBar.tsx
+++ b/src/components/suggestedPeople/SPTaggsBar.tsx
@@ -70,7 +70,7 @@ const TaggsBar: React.FC<TaggsBarProps> = ({
setTaggsNeedUpdate={setTaggsNeedUpdate}
setSocialDataNeedUpdate={handleSocialUpdate}
whiteRing={true}
- allowNavigation={allowTaggsNavigation}
+ screenType={screenType}
/>,
);
i++;
@@ -88,7 +88,7 @@ const TaggsBar: React.FC<TaggsBarProps> = ({
userXId={userXId}
user={user}
whiteRing={true}
- allowNavigation={allowTaggsNavigation}
+ screenType={screenType}
/>,
);
i++;
diff --git a/src/components/taggs/Tagg.tsx b/src/components/taggs/Tagg.tsx
index 4e4987fb..5d26539b 100644
--- a/src/components/taggs/Tagg.tsx
+++ b/src/components/taggs/Tagg.tsx
@@ -17,13 +17,15 @@ import {
registerNonIntegratedSocialLink,
} from '../../services';
import {SmallSocialIcon, SocialIcon, SocialLinkModal} from '../common';
-import {UserType} from '../../types';
+import {ScreenType, UserType} from '../../types';
import {
ERROR_LINK,
ERROR_UNABLE_TO_FIND_PROFILE,
SUCCESS_LINK,
} from '../../constants/strings';
-import {normalize} from '../../utils';
+import {canViewProfile, normalize} from '../../utils';
+import {RootState} from '../../store/rootReducer';
+import {useStore} from 'react-redux';
interface TaggProps {
social: string;
@@ -34,7 +36,7 @@ interface TaggProps {
userXId: string | undefined;
user: UserType;
whiteRing: boolean | undefined;
- allowNavigation?: boolean;
+ screenType: ScreenType;
}
const Tagg: React.FC<TaggProps> = ({
@@ -44,11 +46,12 @@ const Tagg: React.FC<TaggProps> = ({
setTaggsNeedUpdate,
setSocialDataNeedUpdate,
userXId,
+ screenType,
user,
whiteRing,
- allowNavigation = true,
}) => {
const navigation = useNavigation();
+ const state: RootState = useStore().getState();
const [modalVisible, setModalVisible] = useState(false);
const youMayPass = isLinked || userXId;
@@ -72,19 +75,21 @@ const Tagg: React.FC<TaggProps> = ({
const modalOrAuthBrowserOrPass = async () => {
if (youMayPass) {
- if (INTEGRATED_SOCIAL_LIST.indexOf(social) !== -1) {
- navigation.push('SocialMediaTaggs', {
- socialMediaType: social,
- userXId,
- });
- } else {
- getNonIntegratedURL(social, user.userId).then((socialURL) => {
- if (socialURL) {
- Linking.openURL(socialURL);
- } else {
- Alert.alert(ERROR_UNABLE_TO_FIND_PROFILE);
- }
- });
+ if (canViewProfile(state, userXId, screenType)) {
+ if (INTEGRATED_SOCIAL_LIST.indexOf(social) !== -1) {
+ navigation.navigate('SocialMediaTaggs', {
+ socialMediaType: social,
+ userXId,
+ });
+ } else {
+ getNonIntegratedURL(social, user.userId).then((socialURL) => {
+ if (socialURL) {
+ Linking.openURL(socialURL);
+ } else {
+ Alert.alert(ERROR_UNABLE_TO_FIND_PROFILE);
+ }
+ });
+ }
}
} else {
if (isIntegrated) {
@@ -147,8 +152,7 @@ const Tagg: React.FC<TaggProps> = ({
<View style={whiteRing ? styles.spcontainer : styles.container}>
<TouchableOpacity
style={styles.iconTap}
- onPress={modalOrAuthBrowserOrPass}
- disabled={!allowNavigation}>
+ onPress={modalOrAuthBrowserOrPass}>
<SocialIcon style={styles.icon} social={social} whiteRing />
{pickTheRightRingHere()}
</TouchableOpacity>
diff --git a/src/components/taggs/TaggsBar.tsx b/src/components/taggs/TaggsBar.tsx
index a5003fbb..4d567b25 100644
--- a/src/components/taggs/TaggsBar.tsx
+++ b/src/components/taggs/TaggsBar.tsx
@@ -7,7 +7,7 @@ import Animated, {
useDerivedValue,
} from 'react-native-reanimated';
import {useSafeAreaInsets} from 'react-native-safe-area-context';
-import {useDispatch, useSelector, useStore} from 'react-redux';
+import {useDispatch, useSelector} from 'react-redux';
import {
INTEGRATED_SOCIAL_LIST,
PROFILE_CUTOUT_BOTTOM_Y,
@@ -17,7 +17,6 @@ import {getLinkedSocials} from '../../services';
import {loadIndividualSocial, updateSocial} from '../../store/actions';
import {RootState} from '../../store/rootReducer';
import {ScreenType} from '../../types';
-import {canViewProfile} from '../../utils';
import Tagg from './Tagg';
const {View, ScrollView} = Animated;
@@ -37,15 +36,12 @@ const TaggsBar: React.FC<TaggsBarProps> = ({
linkedSocials,
onLayout,
}) => {
+ const dispatch = useDispatch();
let [taggs, setTaggs] = useState<Object[]>([]);
let [taggsNeedUpdate, setTaggsNeedUpdate] = useState(true);
const {user} = useSelector((state: RootState) =>
userXId ? state.userX[screenType][userXId] : state.user,
);
- const state: RootState = useStore().getState();
- const allowTaggsNavigation = canViewProfile(state, userXId, screenType);
-
- const dispatch = useDispatch();
const insetTop = useSafeAreaInsets().top;
/**
* Updates the individual social that needs update
@@ -80,13 +76,13 @@ const TaggsBar: React.FC<TaggsBarProps> = ({
key={i}
social={social}
userXId={userXId}
+ screenType={screenType}
user={user}
isLinked={true}
isIntegrated={INTEGRATED_SOCIAL_LIST.indexOf(social) !== -1}
setTaggsNeedUpdate={setTaggsNeedUpdate}
setSocialDataNeedUpdate={handleSocialUpdate}
whiteRing={false}
- allowNavigation={allowTaggsNavigation}
/>,
);
i++;
@@ -102,9 +98,9 @@ const TaggsBar: React.FC<TaggsBarProps> = ({
setTaggsNeedUpdate={setTaggsNeedUpdate}
setSocialDataNeedUpdate={handleSocialUpdate}
userXId={userXId}
+ screenType={screenType}
user={user}
whiteRing={false}
- allowNavigation={allowTaggsNavigation}
/>,
);
i++;