From 79edd43bd998e5f9f425b1c8150cd8f3592e47d6 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Thu, 25 Feb 2021 14:42:31 -0800 Subject: try blocks, else --- src/routes/main/MainStackScreen.tsx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/routes/main') diff --git a/src/routes/main/MainStackScreen.tsx b/src/routes/main/MainStackScreen.tsx index aec860f2..5b3f1178 100644 --- a/src/routes/main/MainStackScreen.tsx +++ b/src/routes/main/MainStackScreen.tsx @@ -50,15 +50,23 @@ const MainStackScreen: React.FC = ({route}) => { const isSearchTab = screenType === ScreenType.Search; const isNotificationsTab = screenType === ScreenType.Notifications; const isSuggestedPeopleTab = screenType === ScreenType.SuggestedPeople; - - AsyncStorage.getItem('respondedToAccessContacts').then((value) => - setRespondedToAccessContacts(value ? value : 'false'), - ); - const [respondedToAccessContacts, setRespondedToAccessContacts] = useState( 'false', ); + const loadResponseToAccessContacts = () => { + try { + AsyncStorage.getItem('respondedToAccessContacts').then((value) => { + setRespondedToAccessContacts(value ? value : 'false'); + }); + } catch (err) { + console.log( + 'Unable to check and request permission to get access to user contacts', + ); + } + }; + loadResponseToAccessContacts(); + const initialRouteName = (() => { switch (screenType) { case ScreenType.Profile: -- cgit v1.2.3-70-g09d2 From eed77b91d4d10dece7c53a81eb92b8ac94cc1f77 Mon Sep 17 00:00:00 2001 From: ankit-thanekar007 Date: Thu, 25 Feb 2021 17:43:13 -0800 Subject: Request-Contacts updated permission request code --- src/constants/strings.ts | 2 +- src/routes/main/MainStackScreen.tsx | 18 +++++++++--------- src/screens/search/RequestContactsAccess.tsx | 22 ++++++---------------- 3 files changed, 16 insertions(+), 26 deletions(-) (limited to 'src/routes/main') diff --git a/src/constants/strings.ts b/src/constants/strings.ts index 5ae19e9c..353e0d02 100644 --- a/src/constants/strings.ts +++ b/src/constants/strings.ts @@ -25,7 +25,7 @@ export const ERROR_INVALID_VERIFICATION_CODE_FORMAT = 'Please enter the 6 digit export const ERROR_INVLAID_CODE = 'The code entered is not valid!'; export const ERROR_LINK = (str: string) => `Unable to link with ${str}, Please check your login and try again`; export const ERROR_LOGIN = 'There was a problem logging you in, please refresh and try again'; -export const ERROR_LOGIN_FAILED = 'Login failed. Check your username and passoword, and try again'; +export const ERROR_LOGIN_FAILED = 'Login failed. Check your username and password, and try again'; export const ERROR_NEXT_PAGE = 'There was a problem while loading the next page 😓, try again in a couple minutes'; export const ERROR_PROFILE_CREATION_SHORT = 'Profile creation failed 😓'; export const ERROR_PWD_ACCOUNT = (str: string) => `Please make sure that the email / username entered is registered with us. You may contact our customer support at ${str}`; diff --git a/src/routes/main/MainStackScreen.tsx b/src/routes/main/MainStackScreen.tsx index 5b3f1178..acf0cd28 100644 --- a/src/routes/main/MainStackScreen.tsx +++ b/src/routes/main/MainStackScreen.tsx @@ -1,7 +1,7 @@ import AsyncStorage from '@react-native-community/async-storage'; import {RouteProp} from '@react-navigation/native'; import {StackNavigationOptions} from '@react-navigation/stack'; -import React, {useState} from 'react'; +import React, {useEffect, useState} from 'react'; import {StyleSheet, Text} from 'react-native'; import {normalize} from 'react-native-elements'; import BackIcon from '../../assets/icons/back-arrow.svg'; @@ -51,20 +51,20 @@ const MainStackScreen: React.FC = ({route}) => { const isNotificationsTab = screenType === ScreenType.Notifications; const isSuggestedPeopleTab = screenType === ScreenType.SuggestedPeople; const [respondedToAccessContacts, setRespondedToAccessContacts] = useState( - 'false', + 'true', ); const loadResponseToAccessContacts = () => { - try { - AsyncStorage.getItem('respondedToAccessContacts').then((value) => { + AsyncStorage.getItem('respondedToAccessContacts') + .then((value) => { setRespondedToAccessContacts(value ? value : 'false'); + }) + .catch((error) => { + console.log('Something went wrong', error); + setRespondedToAccessContacts('true'); }); - } catch (err) { - console.log( - 'Unable to check and request permission to get access to user contacts', - ); - } }; + loadResponseToAccessContacts(); const initialRouteName = (() => { diff --git a/src/screens/search/RequestContactsAccess.tsx b/src/screens/search/RequestContactsAccess.tsx index 69de1ddf..08548c69 100644 --- a/src/screens/search/RequestContactsAccess.tsx +++ b/src/screens/search/RequestContactsAccess.tsx @@ -22,22 +22,12 @@ const RequestContactsAccess: React.FC = () => { const handleAllowAccess = async () => { 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'), - ); - } - }); + let permission = await checkPermission(); + if (permission === 'undefined') { + await requestPermission(); + } + await AsyncStorage.setItem('respondedToAccessContacts', 'true'); + navigation.navigate('Search'); } catch (err) { console.log( 'Unable to check and request permission to get access to user contacts', -- cgit v1.2.3-70-g09d2 From aa93723fcd80a2d1e013f3c408edf83b75be63c9 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 26 Feb 2021 20:49:42 -0500 Subject: updated wizard and exported modal style --- src/components/onboarding/RegistrationWizard.tsx | 22 +--------------------- src/routes/main/MainStackScreen.tsx | 16 +--------------- 2 files changed, 2 insertions(+), 36 deletions(-) (limited to 'src/routes/main') diff --git a/src/components/onboarding/RegistrationWizard.tsx b/src/components/onboarding/RegistrationWizard.tsx index 437e7cfb..3c6ca80e 100644 --- a/src/components/onboarding/RegistrationWizard.tsx +++ b/src/components/onboarding/RegistrationWizard.tsx @@ -37,16 +37,6 @@ const RegistrationWizard = (props: RegistrationWizardProps) => { - - - - - - - - )} @@ -60,16 +50,6 @@ const RegistrationWizard = (props: RegistrationWizardProps) => { - - - - - - - - )} @@ -94,7 +74,7 @@ const styles = StyleSheet.create({ backgroundColor: '#e1f0ff', }, progress: { - width: '10%', + width: '35%', height: 2, backgroundColor: '#e1f0ff', }, diff --git a/src/routes/main/MainStackScreen.tsx b/src/routes/main/MainStackScreen.tsx index acf0cd28..04f73985 100644 --- a/src/routes/main/MainStackScreen.tsx +++ b/src/routes/main/MainStackScreen.tsx @@ -80,20 +80,6 @@ const MainStackScreen: React.FC = ({route}) => { } })(); - const modalStyle: StackNavigationOptions = { - cardStyle: {backgroundColor: 'rgba(80,80,80,0.9)'}, - gestureDirection: 'vertical', - cardOverlayEnabled: true, - cardStyleInterpolator: ({current: {progress}}) => ({ - cardStyle: { - opacity: progress.interpolate({ - inputRange: [0, 0.5, 0.9, 1], - outputRange: [0, 0.25, 0.7, 1], - }), - }, - }), - }; - const tutorialModalStyle: StackNavigationOptions = { cardStyle: {backgroundColor: 'rgba(0, 0, 0, 0.5)'}, gestureDirection: 'vertical', @@ -263,7 +249,7 @@ export const headerBarOptions: ( ), }); -const modalStyle: StackNavigationOptions = { +export const modalStyle: StackNavigationOptions = { cardStyle: {backgroundColor: 'rgba(80,80,80,0.6)'}, gestureDirection: 'vertical', cardOverlayEnabled: true, -- cgit v1.2.3-70-g09d2