diff options
Diffstat (limited to 'src/screens')
-rw-r--r-- | src/screens/profile/CaptionScreen.tsx | 2 | ||||
-rw-r--r-- | src/screens/search/RequestContactsAccess.tsx | 42 |
2 files changed, 31 insertions, 13 deletions
diff --git a/src/screens/profile/CaptionScreen.tsx b/src/screens/profile/CaptionScreen.tsx index 91aaa617..01e859ba 100644 --- a/src/screens/profile/CaptionScreen.tsx +++ b/src/screens/profile/CaptionScreen.tsx @@ -13,7 +13,7 @@ import { } from 'react-native'; import {Button} from 'react-native-elements'; import {useDispatch, useSelector} from 'react-redux'; -import {MainStackParams} from 'src/routes'; +import {MainStackParams} from '../../routes'; import {SearchBackground, TaggBigInput} from '../../components'; import {CaptionScreenHeader} from '../../components/'; import TaggLoadingIndicator from '../../components/common/TaggLoadingIndicator'; diff --git a/src/screens/search/RequestContactsAccess.tsx b/src/screens/search/RequestContactsAccess.tsx index de023464..69de1ddf 100644 --- a/src/screens/search/RequestContactsAccess.tsx +++ b/src/screens/search/RequestContactsAccess.tsx @@ -21,21 +21,39 @@ const RequestContactsAccess: React.FC = () => { const navigation = useNavigation(); const handleAllowAccess = async () => { - checkPermission().then((permission) => { - if (permission === 'undefined') { - requestPermission().then((response) => { - if (response === 'authorized' || response === 'denied') { - navigation.navigate('Search'); - } - }); - } - }); - await AsyncStorage.setItem('respondedToAccessContacts', 'true'); + try { + checkPermission().then((permission) => { + if (permission === 'undefined') { + requestPermission().then((response) => { + if (response === 'authorized' || response === 'denied') { + AsyncStorage.setItem( + 'respondedToAccessContacts', + 'true', + ).then(() => navigation.navigate('Search')); + } + }); + } else { + AsyncStorage.setItem('respondedToAccessContacts', 'true').then(() => + navigation.navigate('Search'), + ); + } + }); + } catch (err) { + console.log( + 'Unable to check and request permission to get access to user contacts', + ); + } }; const handleDontAllowAccess = async () => { - await AsyncStorage.setItem('respondedToAccessContacts', 'true'); - navigation.navigate('Search'); + try { + await AsyncStorage.setItem('respondedToAccessContacts', 'true'); + navigation.navigate('Search'); + } catch (err) { + console.log( + 'Unable to check and request permission to get access to user contacts', + ); + } }; return ( |