mirror of
https://github.com/selfxyz/self.git
synced 2026-02-19 02:24:25 -05:00
bring back next screen and update camera screen ui
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { YStack, Button, Image, Text, ScrollView, XStack, Separator } from 'tamagui';
|
||||
import { Camera, ShieldCheck, SquarePen, VenetianMask, X } from '@tamagui/lucide-icons';
|
||||
import { bgColor, bgGreen, borderColor, componentBgColor, componentBgColor2, separatorColor, textBlack, textColor1, textColor2 } from '../utils/colors';
|
||||
import { bgColor, bgGreen, blueColor, borderColor, componentBgColor, componentBgColor2, separatorColor, textBlack, textColor1, textColor2 } from '../utils/colors';
|
||||
import SCANHelp from '../images/scan_help.png'
|
||||
import { startCameraScan } from '../utils/cameraScanner';
|
||||
import CustomButton from '../components/CustomButton';
|
||||
@@ -49,9 +49,7 @@ const CameraScreen: React.FC<CameraScreenProps> = ({ sheetIsOpen, setSheetIsOpen
|
||||
update({
|
||||
passportData: mockPassportData_sha256_rsa_65537
|
||||
})
|
||||
setStep(Steps.REGISTERED);
|
||||
setRegistered(true);
|
||||
setSelectedTab("app");
|
||||
setSelectedTab("next");
|
||||
deleteMrzFields();
|
||||
toast.show("Using mock passport data!", { type: "info" })
|
||||
}
|
||||
@@ -73,12 +71,14 @@ const CameraScreen: React.FC<CameraScreenProps> = ({ sheetIsOpen, setSheetIsOpen
|
||||
h="$13"
|
||||
source={{ uri: SCANHelp }}
|
||||
/> */}
|
||||
|
||||
<YStack gap="$2.5" mt="$5" >
|
||||
<CustomButton text="Use mock Passport Data" onPress={handleSkip} Icon={<VenetianMask color={textBlack} size={24} />} />
|
||||
<Text mt="$5" fontSize="$3" alignSelf='center' w="80%" ai="center" textAlign="center" color={textBlack}>
|
||||
You can also <Text onPress={handleSkip} color={blueColor} style={{ textDecorationLine: 'underline', textDecorationColor: blueColor }}>use mock passport data</Text> and skip this step.
|
||||
</Text>
|
||||
<YStack gap="$2.5" mt="$3" >
|
||||
<CustomButton text="Open Camera" onPress={startCameraScan} Icon={<Camera color={textBlack} size={24} />} />
|
||||
<CustomButton bgColor='#ffff' text="Manual Input" onPress={() => setSheetIsOpen(true)} Icon={<SquarePen color={textBlack} size={24} />} />
|
||||
</YStack>
|
||||
|
||||
</YStack>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -116,47 +116,6 @@ const MainScreen: React.FC = () => {
|
||||
})
|
||||
}
|
||||
|
||||
const handleSkip = () => {
|
||||
update({
|
||||
passportData: mockPassportData_sha256_rsa_65537
|
||||
})
|
||||
setStep(Steps.REGISTERED);
|
||||
deleteMrzFields();
|
||||
|
||||
// const n_dsc = 121;
|
||||
// const k_dsc = 17;
|
||||
// const n_csca = 121;
|
||||
// const k_csca = 34;
|
||||
// const max_cert_bytes = 1664;
|
||||
// const dsc = mock_dsc_sha256_rsa_4096;
|
||||
// const csca = mock_csca_sha256_rsa_4096;
|
||||
// const dscCert = forge.pki.certificateFromPem(dsc);
|
||||
// const cscaCert = forge.pki.certificateFromPem(csca);
|
||||
|
||||
// let secret = useUserStore.getState().dscSecret;
|
||||
// if (secret === null) {
|
||||
// // Finally, generate CSCA Inputs and request modal server
|
||||
// // Generate a cryptographically secure random secret of (31 bytes)
|
||||
// const secretBytes = forge.random.getBytesSync(31);
|
||||
// secret = BigInt(`0x${forge.util.bytesToHex(secretBytes)}`).toString();
|
||||
// console.log('Generated secret:', secret.toString());
|
||||
// useUserStore.getState().setDscSecret(secret);
|
||||
// }
|
||||
|
||||
// const inputs_csca = getCSCAInputs(
|
||||
// secret,
|
||||
// dscCert,
|
||||
// cscaCert,
|
||||
// n_dsc,
|
||||
// k_dsc,
|
||||
// n_csca,
|
||||
// k_csca,
|
||||
// max_cert_bytes,
|
||||
// true
|
||||
// );
|
||||
// sendCSCARequest(inputs_csca, setModalProofStep);
|
||||
toast.show("Using mock passport data!", { type: "info" })
|
||||
}
|
||||
|
||||
const castDate = (date: Date) => {
|
||||
return (date.toISOString().slice(2, 4) + date.toISOString().slice(5, 7) + date.toISOString().slice(8, 10)).toString();
|
||||
@@ -462,15 +421,6 @@ const MainScreen: React.FC = () => {
|
||||
</Button>
|
||||
</Fieldset>
|
||||
|
||||
<Fieldset gap="$4" mt="$1" horizontal>
|
||||
<Label color={textBlack} width={200} justifyContent="flex-end" htmlFor="skip" >
|
||||
Use mock passport data
|
||||
</Label>
|
||||
<Button bg="white" jc="center" borderColor={borderColor} borderWidth={1.2} size="$3.5" ml="$2" onPress={handleSkip}>
|
||||
<VenetianMask color={textBlack} />
|
||||
</Button>
|
||||
</Fieldset>
|
||||
|
||||
<Fieldset gap="$4" mt="$1" horizontal>
|
||||
<Label color={textBlack} width={200} justifyContent="flex-end" htmlFor="skip" >
|
||||
Delete passport data
|
||||
|
||||
@@ -32,6 +32,11 @@ const NextScreen: React.FC = () => {
|
||||
};
|
||||
|
||||
const { height } = useWindowDimensions();
|
||||
const handleNext = () => {
|
||||
useNavigationStore.getState().setStep(Steps.REGISTERED);
|
||||
useUserStore.getState().setRegistered(true);
|
||||
useNavigationStore.getState().setSelectedTab("app");
|
||||
}
|
||||
|
||||
return (
|
||||
<YStack p="$3" f={1} mb={Platform.OS === 'ios' ? "$5" : "$0"}>
|
||||
@@ -104,7 +109,7 @@ const NextScreen: React.FC = () => {
|
||||
|
||||
<YStack f={1} />
|
||||
|
||||
<CustomButton onPress={() => setSelectedTab("register")} text="Next" Icon={<ArrowRight color={textBlack} />} />
|
||||
<CustomButton onPress={handleNext} text="Next" Icon={<ArrowRight color={textBlack} />} />
|
||||
|
||||
</YStack >
|
||||
</YStack >
|
||||
|
||||
@@ -197,9 +197,7 @@ const handleResponseIOS = async (
|
||||
);
|
||||
|
||||
//sendCSCARequest(inputs_csca, setModalProofStep);
|
||||
useNavigationStore.getState().setStep(Steps.REGISTERED);
|
||||
useUserStore.getState().setRegistered(true);
|
||||
useNavigationStore.getState().setSelectedTab("app");
|
||||
useNavigationStore.getState().setSelectedTab("next");
|
||||
} catch (e: any) {
|
||||
console.log('error during parsing:', e);
|
||||
useNavigationStore.getState().setStep(Steps.MRZ_SCAN_COMPLETED);
|
||||
@@ -307,7 +305,5 @@ const handleResponseAndroid = async (
|
||||
false
|
||||
);
|
||||
//sendCSCARequest(inputs_csca, setModalProofStep);
|
||||
useUserStore.getState().setRegistered(true);
|
||||
useNavigationStore.getState().setStep(Steps.REGISTERED);
|
||||
useNavigationStore.getState().setSelectedTab("app");
|
||||
useNavigationStore.getState().setSelectedTab("next");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user