aboutsummaryrefslogtreecommitdiff
path: root/src/components/profile/Friends.tsx
diff options
context:
space:
mode:
authorShravya Ramesh <shravs1208@gmail.com>2021-03-18 16:00:33 -0700
committerShravya Ramesh <shravs1208@gmail.com>2021-03-18 16:00:33 -0700
commitb1c88afecd72864fe928882fc64c767dc58076fe (patch)
treeb5e01ee9a9f7218365f456332680b49f1ff9395a /src/components/profile/Friends.tsx
parent02f3b84cb94677079dd2a9f3aacb8c9c11e9696e (diff)
open settings
Diffstat (limited to 'src/components/profile/Friends.tsx')
-rw-r--r--src/components/profile/Friends.tsx22
1 files changed, 12 insertions, 10 deletions
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<FriendsProps> = ({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<FriendsProps> = ({result, screenType, userId}) => {
<Text style={[styles.subheaderText]}>Add Friends</Text>
<TouchableOpacity
style={styles.findFriendsButton}
- onPress={() =>
- navigation.navigate('InviteFriendsScreen', {
- screenType: ScreenType.Profile,
- })
- }>
+ onPress={async () => {
+ const permission = await checkPermission();
+ if (permission === 'authorized') {
+ navigation.navigate('InviteFriendsScreen', {
+ screenType: ScreenType.Profile,
+ });
+ } else {
+ Linking.openSettings();
+ }
+ }}>
<FindFriendsBlueIcon width={20} height={20} />
<Text style={styles.findFriendsSubheaderText}>
Find Friends