bug fixes + authentication screen
This commit is contained in:
parent
b99803f639
commit
660960db1a
|
@ -8,6 +8,7 @@ import Keycard from "react-native-status-keycard";
|
|||
import InitializationScreen from './components/steps/InitializationScreen';
|
||||
import NFCModal from './NFCModal';
|
||||
import MnemonicScreen from './components/steps/MnemonicScreen';
|
||||
import AuthenticationScreen from './components/steps/AuthenticationScreen';
|
||||
|
||||
enum Step {
|
||||
Discovery,
|
||||
|
@ -115,6 +116,7 @@ const Main = () => {
|
|||
{step == Step.Discovery && <DiscoveryScreen onPressFunc={connectCard}></DiscoveryScreen>}
|
||||
{step == Step.Initialization && <InitializationScreen onPressFunc={initPin} ></InitializationScreen>}
|
||||
{step == Step.Loading && <MnemonicScreen onPressFunc={loadMnemonic} pinRequired={pinRef.current ? false : true}></MnemonicScreen>}
|
||||
{step == Step.Authentication && <AuthenticationScreen onPressFunc={() => {}}></AuthenticationScreen>}
|
||||
<NFCModal isVisible={isModalVisible} onChangeFunc={setIsModalVisible}></NFCModal>
|
||||
</SafeAreaView>
|
||||
);
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
import {FC } from "react";
|
||||
import { StyleSheet, Text, View } from "react-native";
|
||||
|
||||
type AuthenticationScreenProps = {
|
||||
onPressFunc: () => void;
|
||||
};
|
||||
|
||||
const AuthenticationScreen: FC<AuthenticationScreenProps> = props => {
|
||||
const {onPressFunc} = props;
|
||||
|
||||
return (
|
||||
<View>
|
||||
<View>
|
||||
<Text style={styles.heading}> Success</Text>
|
||||
</View>
|
||||
</View>
|
||||
)};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
heading: {
|
||||
textAlign: 'center',
|
||||
fontSize: 16
|
||||
}
|
||||
});
|
||||
|
||||
export default AuthenticationScreen;
|
|
@ -18,16 +18,12 @@ const MnemonicScreen: FC<MnemonicScreenProps> = props => {
|
|||
const [mnemonic, setMnemonic] = useState('');
|
||||
const [pin, setPin] = useState('');
|
||||
const [errMessage, setErrMessage] = useState('');
|
||||
const [btnDisabled, setBtnDisabled] = useState(true);
|
||||
const [step, setStep] = useState(LoadMnemonicSteps.InsertMnemonic);
|
||||
|
||||
const updateMnemonic = (str: string) => {
|
||||
const mn = str.split(' ').filter((el: string) => el != "").map((word: string) => word.trim().toLowerCase());
|
||||
const isInMnemonicList = (val: any) => MNEMONIC.includes(val);
|
||||
|
||||
console.log(mn)
|
||||
|
||||
if (!mn.every(isInMnemonicList)) {
|
||||
if (!mn.every((val: string | any) => MNEMONIC.includes(val))) {
|
||||
setErrMessage("Wrong mnemonic. Please try again.");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue