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

@@ -23,8 +23,10 @@ export default function App({ navigation, route }) {
<SafeAreaView style={styles.container}> <SafeAreaView style={styles.container}>
<LoginForm /> <LoginForm />
<StatusBar style="auto" /> <StatusBar style="auto" />
<View style={{ position: "absolute", top: 30, left: 10, opacity: 0.5 }}> <View style={{ position: "absolute", top: 60, left: 10, opacity: 0.5 }} >
<Text>{"<- Not an EMI family memeber?"}</Text> <Text onPress={()=>{
alert("Register your church on fellowshipapps.com");
}}>{"<- Not an EMI family member?"}</Text>
</View> </View>
</SafeAreaView> </SafeAreaView>
); );

View File

@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { View, TextInput, Image } from "react-native"; import { View, TextInput, Image, ScrollView } from "react-native";
import { Text, Button, Divider } from "react-native-paper"; import { Text, Button, Divider } from "react-native-paper";
import { SafeAreaView } from "react-native-safe-area-context"; import { SafeAreaView } from "react-native-safe-area-context";
import API from './../API.js'; import API from './../API.js';
@@ -96,13 +96,14 @@ let NewPostView = (props) => {
API.newPost(postContent + " " + extraContent.join(" "), props.route.params?.toProfile).then((newPost) => { API.newPost(postContent + " " + extraContent.join(" "), props.route.params?.toProfile).then((newPost) => {
setPostContent(''); setPostContent('');
setExtraContent([]); setExtraContent([]);
navigation.navigate('Feed', {reRender: Math.random()}); navigation.navigate('Feed', { reRender: Math.random() });
//if (newPostCB) newPostCB(newPost); //if (newPostCB) newPostCB(newPost);
}); });
} }
return ( return (
<View style={{ padding: 10, paddingTop: 20, flex:1, justifyContent:"center"}}> <ScrollView>
<View style={{ padding: 10, paddingTop: 20, flex: 1, justifyContent: "center" }}>
<View style={{ flexDirection: "row", marginBottom: 10, justifyContent: "space-around" }}> <View style={{ flexDirection: "row", marginBottom: 10, justifyContent: "space-around" }}>
<Text style={{ fontSize: 25 }}>{i18n.t("message.statusUpdate")}:</Text> <Text style={{ fontSize: 25 }}>{i18n.t("message.statusUpdate")}:</Text>
<Button icon="send" mode="outlined" onPress={handleNewPostButton}> <Button icon="send" mode="outlined" onPress={handleNewPostButton}>
@@ -151,6 +152,7 @@ let NewPostView = (props) => {
) )
} }
</View> </View>
</ScrollView>
) )
} }

View File

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

View File

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

View File

@@ -33,8 +33,10 @@ const messages = {
loading: "Loading", loading: "Loading",
login: 'Login', login: 'Login',
email: "Email", email: "Email",
cancel: "Cancel",
password: "Password", password: "Password",
rpassword: "Repeat Password", rpassword: "Repeat Password",
resetPassword: "Reset password",
register: "Register", register: "Register",
name: "Nombre", name: "Nombre",
lastName: "Last Name", lastName: "Last Name",
@@ -65,7 +67,7 @@ const messages = {
IKnowThisPerson: "I know this person", IKnowThisPerson: "I know this person",
update: "Update", update: "Update",
invalidEmail: "Email address is invalid!", invalidEmail: "Email address is invalid!",
reviewPassword: "Please review your passwrod.", reviewPassword: "Please review your password.",
updatePhoto: "Update Photo", updatePhoto: "Update Photo",
optional: "Optional", optional: "Optional",
birthday: "Birthday", birthday: "Birthday",
@@ -103,8 +105,10 @@ const messages = {
loading: "Cargando", loading: "Cargando",
login: 'Inicia Sesión', login: 'Inicia Sesión',
email: "Correo Electronico", email: "Correo Electronico",
cancel: "Cancelar",
password: "Contraseña", password: "Contraseña",
rpassword: "Confirma tu Contraseña", rpassword: "Confirma tu Contraseña",
resetPassword: "Recuperar Contraseña",
register: "Registrate", register: "Registrate",
name: 'Nombre', name: 'Nombre',
lastName: "Apeido", lastName: "Apeido",