Skip to content

Commit

Permalink
final
Browse files Browse the repository at this point in the history
  • Loading branch information
isuyashpatel committed Jan 22, 2024
1 parent d1a04c7 commit c1d7aec
Show file tree
Hide file tree
Showing 60 changed files with 265 additions and 63 deletions.
88 changes: 76 additions & 12 deletions android/app/src/main/assets/index.android.bundle

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@react-navigation/native": "^6.1.9",
"@react-navigation/native-stack": "^6.9.17",
"@twotalltotems/react-native-otp-input": "^1.3.7",
"axios": "^1.6.5",
"immer": "^10.0.3",
"lottie-react-native": "^6.4.1",
"react": "18.2.0",
Expand Down
120 changes: 70 additions & 50 deletions src/screens/AuthScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import Ionicons from 'react-native-vector-icons/Ionicons'
import { Dimensions } from 'react-native'
import OTPInputView from '@twotalltotems/react-native-otp-input'
import emailSchema from '../validation/zod'
import axios from 'axios'
import AuthService from '../services'

const windowHeight = Dimensions.get('window').height

Expand All @@ -29,27 +31,38 @@ const AuthScreen = () => {
(state: any): any => state.userAuthentication,
)
const [mail, setMail] = useState('')
const [validationMail, setValidationMail] = useState(false);
const [code,setCode]=useState('')
const [validationMail, setValidationMail] = useState(false)
const [code, setCode] = useState('')
const handleMailChange = (text: string) => {
setMail(text)
}

const handleValidateEmail = () => {

const handleValidateEmail = async () => {
try {
emailSchema.parse(mail);
setValidationMail(true)
const response = await AuthService.sendLoginOTP(mail);

if (response.status === 200) {
setValidationMail(true);
} else {
Alert.alert('Something Unwanted happened');
}
} catch (error:any) {
Alert.alert('Error', error.message || 'Something went wrong');
}
};
const VerifyOtp = async () => {
try {
const response = await AuthService.verifyLoginOTP(mail, code);
if (response.status === 200) {
userAuthentication();
} else {
Alert.alert('Wrong Otp');
}
} catch (error) {
Alert.alert('Error', 'Invalid email format');
Alert.alert('Something Went wrong');
}
};

const VerifyOtp = () => {
console.log(code);

userAuthentication();
}
return (
<View style={styles.ScreenContainer}>
<StatusBar backgroundColor={COLORS.primaryBlackHex} />
Expand All @@ -60,20 +73,21 @@ const AuthScreen = () => {
/>
<Text style={styles.Quote}>Keep calm and drink tea.</Text>
<View style={styles.MailContainer}>
{!validationMail ? <View style={styles.InputContainer}>
<Ionicons
name="mail"
size={FONTSIZE.size_24}
color={COLORS.secondaryLightGreyHex}
/>
<TextInput
style={styles.mail}
placeholder="[email protected]"
onChangeText={handleMailChange}
value={mail}
/>
</View>
:
{!validationMail ? (
<View style={styles.InputContainer}>
<Ionicons
name="mail"
size={FONTSIZE.size_24}
color={COLORS.secondaryLightGreyHex}
/>
<TextInput
style={styles.mail}
placeholder="[email protected]"
onChangeText={handleMailChange}
value={mail}
/>
</View>
) : (
<>
<Text style={styles.OtpText}>OTP sent to email.</Text>
<OTPInputView
Expand All @@ -82,28 +96,34 @@ const AuthScreen = () => {
autoFocusOnLoad
codeInputFieldStyle={styles.underlineStyleBase}
codeInputHighlightStyle={styles.underlineStyleHighLighted}
onCodeFilled={(code => {
onCodeFilled={(code) => {
setCode(code)
})}
}}
/>
</>
}
{validationMail ? <TouchableOpacity
onPress={VerifyOtp}
>
<View style={styles.AuthButton}>
<Text style={styles.Authenticate}>Verify</Text>
</View>
</TouchableOpacity> : <TouchableOpacity
onPress={handleValidateEmail}
>
<View style={styles.AuthButton}>
<Text style={styles.Authenticate}>Continue</Text>
</View>
</TouchableOpacity>}
{validationMail ? <TouchableOpacity onPress={() => { setValidationMail(false) }}>
<Text style={styles.Back}>Back</Text>
</TouchableOpacity> : null}
)}
{validationMail ? (
<TouchableOpacity onPress={VerifyOtp}>
<View style={styles.AuthButton}>
<Text style={styles.Authenticate}>Verify</Text>
</View>
</TouchableOpacity>
) : (
<TouchableOpacity onPress={handleValidateEmail}>
<View style={styles.AuthButton}>
<Text style={styles.Authenticate}>Continue</Text>
</View>
</TouchableOpacity>
)}
{validationMail ? (
<TouchableOpacity
onPress={() => {
setValidationMail(false)
}}
>
<Text style={styles.Back}>Back</Text>
</TouchableOpacity>
) : null}
</View>
</View>
</View>
Expand Down Expand Up @@ -183,10 +203,10 @@ const styles = StyleSheet.create({
color: COLORS.primaryWhiteHex,
fontSize: FONTSIZE.size_12,
fontFamily: FONTFAMILY.poppins_extrabold,
textAlign: 'center'
textAlign: 'center',
},
borderStyleHighLighted: {
borderColor: "#03DAC6",
borderColor: '#03DAC6',
},
underlineStyleBase: {
width: 36,
Expand All @@ -201,16 +221,16 @@ const styles = StyleSheet.create({
shadowRadius: 4,
backgroundColor: COLORS.primaryWhiteHex,
borderRadius: BORDERRADIUS.radius_8,
color: COLORS.primaryBlackHex
color: COLORS.primaryBlackHex,
},
underlineStyleHighLighted: {
borderColor: "#03DAC6",
borderColor: '#03DAC6',
},
Back: {
color: COLORS.primaryWhiteHex,
fontSize: FONTSIZE.size_12,
fontFamily: FONTFAMILY.poppins_extrabold,
textAlign: 'center',
textDecorationLine: 'underline'
textDecorationLine: 'underline',
},
})
Loading

0 comments on commit c1d7aec

Please sign in to comment.