diff options
| author | Ashm Walia <40498934+ashmgarv@users.noreply.github.com> | 2021-02-25 17:53:07 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-25 17:53:07 -0800 |
| commit | 962f257d21b09b38937df89091e856550271f9b4 (patch) | |
| tree | 53cab0cd8a7fb8366bc9933de325279fff082173 /src/screens | |
| parent | 5c5e53799dde337ca9baa298c218f5cf02764226 (diff) | |
| parent | eed77b91d4d10dece7c53a81eb92b8ac94cc1f77 (diff) | |
Merge pull request #265 from shravyaramesh/request-contacts-bug
[bugfix] Allow contacts does not close
Diffstat (limited to 'src/screens')
| -rw-r--r-- | src/screens/profile/CaptionScreen.tsx | 2 | ||||
| -rw-r--r-- | src/screens/search/RequestContactsAccess.tsx | 28 |
2 files changed, 19 insertions, 11 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..08548c69 100644 --- a/src/screens/search/RequestContactsAccess.tsx +++ b/src/screens/search/RequestContactsAccess.tsx @@ -21,21 +21,29 @@ const RequestContactsAccess: React.FC = () => { const navigation = useNavigation(); const handleAllowAccess = async () => { - checkPermission().then((permission) => { + try { + let permission = await checkPermission(); if (permission === 'undefined') { - requestPermission().then((response) => { - if (response === 'authorized' || response === 'denied') { - navigation.navigate('Search'); - } - }); + await requestPermission(); } - }); - await AsyncStorage.setItem('respondedToAccessContacts', 'true'); + await AsyncStorage.setItem('respondedToAccessContacts', 'true'); + 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 ( |
