Typos, iOS player and reset password

This commit is contained in:
Adolfo Reyna
2023-02-06 14:43:05 -05:00
parent 6b8f9a56c5
commit f52b77f250
5 changed files with 66 additions and 25 deletions

View File

@@ -10,16 +10,33 @@ let LoginForm = () => {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [error, setError] = useState('');
const [tries, setTries] = useState(0);
const navigation = useNavigation();
const resetPasswordBol = tries > 2;
const loginCall = async ()=>{
const resetPassword = async () => {
await API.resetPassword(email);
alert("We sent you instructions to your email!")
}
const loginCall = async () => {
let r = await API.logIn(email.trim(), password);
if (r.status === "ok") return navigation.reset({
index: 0,
routes: [{ name: 'MainNavigation' }],
});
index: 0,
routes: [{ name: 'MainNavigation' }],
});
//console.log(r)
setError(r.status);
if (r.status === 'incorrect password') {
if (resetPasswordBol) {
await resetPassword();
setTries(0);
} else {
setTries(tries + 1);
}
} else {
setTries(0);
}
//alert(i18n.t('message.wrongInformation'))
};
@@ -29,7 +46,7 @@ let LoginForm = () => {
style={styles.logo}
source={require('./../assets/icon.png')}
/>
<Text style={styles.header}>EMI Social</Text>
<Text style={styles.header}>EMI Fellowship</Text>
<Text >{i18n.t("message.login")}</Text>
<TextInput
style={styles.input}
@@ -41,6 +58,7 @@ let LoginForm = () => {
autoComplete='email'
autoCorrect={false}
mode="outlined"
keyboardType='email-address'
/>
{error !== '' && error !== 'incorrect password' ? <HelperText type="error" visible={true}>
{i18n.t("message.invalidEmail")}
@@ -61,12 +79,26 @@ let LoginForm = () => {
{error === 'incorrect password' ? <HelperText type="error" visible={true}>
{i18n.t("message.reviewPassword")}
</HelperText> : <></>}
<Button
style={styles.button}
onPress={async () => {
await loginCall();
}}
>{i18n.t("message.submit")}</Button>
<View style={{ flexDirection: "row" }}>
<Button
style={styles.button}
onPress={async () => {
await loginCall();
}}
>
{resetPasswordBol ? i18n.t("message.resetPassword") : i18n.t("message.submit")}
</Button>
{
resetPasswordBol ? <Button
style={styles.button}
onPress={async () => {
setTries(0);
}}
>
{i18n.t("message.cancel")}
</Button> : <></>
}
</View>
</View>
);
}
@@ -92,17 +124,17 @@ const styles = StyleSheet.create({
color: '#777',
alignContent: 'center'
},
logo:{
width: 250,
logo: {
width: 250,
height: 250,
justifyContent: 'center',
alignItems: 'center',
},
input:{
input: {
backgroundColor: 'white',
width: "80%"
},
button:{
button: {
marginTop: 10,
}

View File

@@ -24,11 +24,12 @@ const VideoPlayer = ({ videosFiles, postId, profileId, poster, videoUrl, videoSt
setChosenVideo(chosenVideo);
}, [videoUrl, postId]);
const onLoad = ()=>{
const onLoad = async ()=>{
if(!viewer.data[postId]) return 0;
console.log(postId + " loaded")
video.current.setPositionAsync(viewer.data[postId].time*1000);
video.current.presentFullscreenPlayer();
await video.current.setPositionAsync(viewer.data[postId].time*1000);
//video.current.isPlaying = true;
//video.current.presentFullscreenPlayer();
};
//console.log("status", status)
@@ -56,7 +57,7 @@ const VideoPlayer = ({ videosFiles, postId, profileId, poster, videoUrl, videoSt
source={{
uri: chosenVideo.length ? chosenVideo[chosenVideo.length-1].link : '',
}}
useNativeControls={false}
useNativeControls={true}
shouldPlay={true}
resizeMode="contain"
onPlaybackStatusUpdate={status => setStatus(() => status)}