From e462253fbe8019b1fcb1e9c3928f722cfd6bbb54 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Mon, 29 Mar 2021 19:16:41 -0700 Subject: moved invite friends icon to notifications --- src/components/profile/Friends.tsx | 32 +--------------- src/screens/main/NotificationsScreen.tsx | 64 +++++++++++++++++++++++++++----- 2 files changed, 56 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/components/profile/Friends.tsx b/src/components/profile/Friends.tsx index ac724ae0..72ce28d4 100644 --- a/src/components/profile/Friends.tsx +++ b/src/components/profile/Friends.tsx @@ -1,9 +1,9 @@ import {useNavigation} from '@react-navigation/native'; import React, {useEffect, useState} from 'react'; -import {Alert, Linking, ScrollView, StyleSheet, Text, View} from 'react-native'; +import {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'; +import {useDispatch, useStore} from 'react-redux'; import {TAGG_LIGHT_BLUE} from '../../constants'; import {usersFromContactsService} from '../../services'; import {NO_USER} from '../../store/initialStates'; @@ -17,7 +17,6 @@ import { } 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; @@ -89,33 +88,6 @@ const Friends: React.FC = ({result, screenType, 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()}, - ], - ); - } - }}> - - - Invite Friends - - diff --git a/src/screens/main/NotificationsScreen.tsx b/src/screens/main/NotificationsScreen.tsx index 68437f2b..6fca679f 100644 --- a/src/screens/main/NotificationsScreen.tsx +++ b/src/screens/main/NotificationsScreen.tsx @@ -1,15 +1,12 @@ import AsyncStorage from '@react-native-community/async-storage'; -import {useFocusEffect} from '@react-navigation/native'; +import {useFocusEffect, useNavigation} from '@react-navigation/native'; +import FindFriendsBlueIcon from '../../assets/icons/findFriends/find-friends-blue-icon.svg'; import moment from 'moment'; -import React, { - Fragment, - ReactElement, - useCallback, - useEffect, - useState, -} from 'react'; +import React, {useCallback, useEffect, useState} from 'react'; import { + Alert, Image, + Linking, RefreshControl, SectionList, StatusBar, @@ -17,10 +14,11 @@ import { Text, View, } from 'react-native'; +import {checkPermission} from 'react-native-contacts'; 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 {TabsGradient} from '../../components'; import { InviteFriendsPrompt, Notification, @@ -255,12 +253,43 @@ const NotificationsScreen: React.FC = () => { return null; }; + const navigation = useNavigation(); + + const InviteFriends = () => ( + { + 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()}, + ], + ); + } + }}> + + Invite Friends + + ); + return ( Notifications + Date: Tue, 30 Mar 2021 12:26:05 -0700 Subject: Added notification --- src/components/notifications/Notification.tsx | 1 + src/types/types.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/components/notifications/Notification.tsx b/src/components/notifications/Notification.tsx index 8143e396..8e008cf9 100644 --- a/src/components/notifications/Notification.tsx +++ b/src/components/notifications/Notification.tsx @@ -91,6 +91,7 @@ const Notification: React.FC = (props) => { const onNotificationTap = async () => { switch (notification_type) { + case 'INVT_ONBRD': case 'FRD_ACPT': case 'FRD_REQ': if (!userXInStore(state, screenType, id)) { diff --git a/src/types/types.ts b/src/types/types.ts index 86f16f05..766bf798 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -246,7 +246,9 @@ export type TypeOfNotification = // notification_object is MomentType | 'MOM_3+' // notification_object is MomentType - | 'MOM_FRIEND'; + | 'MOM_FRIEND' + // notification_object is undefined + | 'INVT_ONBRD'; export type UniversityBadge = { id: number; -- cgit v1.2.3-70-g09d2 From 6aaeed352035aa827d590d479f979f7488f01c2d Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Tue, 30 Mar 2021 13:04:10 -0700 Subject: changed section name --- src/components/profile/Friends.tsx | 2 +- src/screens/profile/InviteFriendsScreen.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/components/profile/Friends.tsx b/src/components/profile/Friends.tsx index 72ce28d4..44f6bb48 100644 --- a/src/components/profile/Friends.tsx +++ b/src/components/profile/Friends.tsx @@ -87,7 +87,7 @@ const Friends: React.FC = ({result, screenType, userId}) => { {loggedInUser.userId === userId && ( - Add Friends + Contacts on tagg diff --git a/src/screens/profile/InviteFriendsScreen.tsx b/src/screens/profile/InviteFriendsScreen.tsx index 4af52349..a9fa1404 100644 --- a/src/screens/profile/InviteFriendsScreen.tsx +++ b/src/screens/profile/InviteFriendsScreen.tsx @@ -203,7 +203,7 @@ const InviteFriendsScreen: React.FC = ({route}) => { - Add Friends + Contacts on tagg -- cgit v1.2.3-70-g09d2