mirror of
https://github.com/selfxyz/self.git
synced 2026-04-05 03:00:53 -04:00
Fix playground (#230)
Co-authored-by: turnoffthiscomputer <colin.remi07@gmail.com>
This commit is contained in:
@@ -85,8 +85,8 @@ android {
|
||||
applicationId "com.proofofpassportapp"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 35
|
||||
versionName "2.4.4"
|
||||
versionCode 37
|
||||
versionName "2.4.6"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags += "-fexceptions -frtti -std=c++11"
|
||||
|
||||
@@ -481,7 +481,7 @@
|
||||
CODE_SIGN_ENTITLEMENTS = OpenPassport/OpenPassportDebug.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 97;
|
||||
CURRENT_PROJECT_VERSION = 98;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEVELOPMENT_TEAM = 5B29R5LYHQ;
|
||||
ENABLE_BITCODE = NO;
|
||||
@@ -596,7 +596,7 @@
|
||||
"$(PROJECT_DIR)",
|
||||
"$(PROJECT_DIR)/MoproKit/Libs",
|
||||
);
|
||||
MARKETING_VERSION = 2.4.5;
|
||||
MARKETING_VERSION = 2.4.6;
|
||||
OTHER_LDFLAGS = (
|
||||
"$(inherited)",
|
||||
"-ObjC",
|
||||
@@ -619,7 +619,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = OpenPassport/OpenPassport.entitlements;
|
||||
CURRENT_PROJECT_VERSION = 97;
|
||||
CURRENT_PROJECT_VERSION = 98;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEVELOPMENT_TEAM = 5B29R5LYHQ;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
@@ -733,7 +733,7 @@
|
||||
"$(PROJECT_DIR)",
|
||||
"$(PROJECT_DIR)/MoproKit/Libs",
|
||||
);
|
||||
MARKETING_VERSION = 2.4.5;
|
||||
MARKETING_VERSION = 2.4.6;
|
||||
OTHER_LDFLAGS = (
|
||||
"$(inherited)",
|
||||
"-ObjC",
|
||||
|
||||
@@ -43,7 +43,10 @@ export default function Disclosures({ disclosures }: DisclosureProps) {
|
||||
<YStack>
|
||||
{ORDERED_KEYS.map(key => {
|
||||
const isEnabled = disclosures[key];
|
||||
if (!isEnabled) {
|
||||
if (
|
||||
!isEnabled ||
|
||||
(Array.isArray(isEnabled) && isEnabled.length === 0)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ const AccountRecoveryChoiceScreen: React.FC<
|
||||
<Title>Restore your Self account</Title>
|
||||
<Description>
|
||||
By continuing, you certify that this passport belongs to you and is
|
||||
not stolen or forged.
|
||||
not stolen or forged.{' '}
|
||||
{biometricsAvailable && (
|
||||
<>
|
||||
Your device doesn't support biometrics or is disabled for apps
|
||||
|
||||
@@ -10,6 +10,7 @@ import { SecondaryButton } from '../../components/buttons/SecondaryButton';
|
||||
import Description from '../../components/typography/Description';
|
||||
import Paste from '../../images/icons/paste.svg';
|
||||
import { useAuth } from '../../stores/authProvider';
|
||||
import { loadPassportDataAndSecret } from '../../stores/passportDataProvider';
|
||||
import {
|
||||
black,
|
||||
slate300,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
slate700,
|
||||
white,
|
||||
} from '../../utils/colors';
|
||||
import { isUserRegistered } from '../../utils/proving/payload';
|
||||
|
||||
interface RecoverWithPhraseScreenProps {}
|
||||
|
||||
@@ -48,10 +50,24 @@ const RecoverWithPhraseScreen: React.FC<
|
||||
|
||||
if (!result) {
|
||||
console.warn('Failed to restore account');
|
||||
// TODO SOMETHING ELSE?
|
||||
navigation.navigate('Launch');
|
||||
setRestoring(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const passportDataAndSecret = (await loadPassportDataAndSecret()) as string;
|
||||
const { passportData, secret } = JSON.parse(passportDataAndSecret);
|
||||
const isRegistered = await isUserRegistered(passportData, secret);
|
||||
console.log('User is registered:', isRegistered);
|
||||
if (!isRegistered) {
|
||||
console.log(
|
||||
'Secret provided did not match a registered passport. Please try again.',
|
||||
);
|
||||
navigation.navigate('Launch');
|
||||
setRestoring(false);
|
||||
return;
|
||||
}
|
||||
|
||||
setRestoring(false);
|
||||
navigation.navigate('AccountVerifiedSuccess');
|
||||
}, [mnemonic, restoreAccountFromMnemonic]);
|
||||
|
||||
@@ -24,7 +24,7 @@ type LoadingScreenProps = StaticScreenProps<{}>;
|
||||
|
||||
const LoadingScreen: React.FC<LoadingScreenProps> = ({}) => {
|
||||
const goToSuccessScreen = useHapticNavigation('AccountVerifiedSuccess');
|
||||
const goToErrorScreen = useHapticNavigation('ConfirmBelongingScreen');
|
||||
const goToErrorScreen = useHapticNavigation('Launch');
|
||||
const goToUnsupportedScreen = useHapticNavigation('UnsupportedPassport');
|
||||
const navigation = useNavigation();
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import React, { useEffect } from 'react';
|
||||
import { StatusBar, StyleSheet, View } from 'react-native';
|
||||
|
||||
import LottieView from 'lottie-react-native';
|
||||
import { Spinner } from 'tamagui';
|
||||
|
||||
import loadingAnimation from '../../assets/animations/loading/misc.json';
|
||||
import failAnimation from '../../assets/animations/proof_failed.json';
|
||||
@@ -64,13 +65,16 @@ const SuccessScreen: React.FC = () => {
|
||||
>
|
||||
<View style={styles.content}>
|
||||
<Title size="large">{getTitle(disclosureStatus)}</Title>
|
||||
<Info status={disclosureStatus} appName={appName} />
|
||||
<Info
|
||||
status={disclosureStatus}
|
||||
appName={appName === '' ? 'The app' : appName}
|
||||
/>
|
||||
</View>
|
||||
<PrimaryButton
|
||||
disabled={disclosureStatus === 'pending'}
|
||||
onPress={onOkPress}
|
||||
>
|
||||
OK
|
||||
{disclosureStatus === 'pending' ? <Spinner /> : 'OK'}
|
||||
</PrimaryButton>
|
||||
</ExpandableBottomLayout.BottomSection>
|
||||
</ExpandableBottomLayout.Layout>
|
||||
|
||||
@@ -44,6 +44,7 @@ const ProveScreen: React.FC = () => {
|
||||
const { selectedApp, resetProof, cleanSelfApp } = useProofInfo();
|
||||
const { handleProofVerified } = useApp();
|
||||
const selectedAppRef = useRef(selectedApp);
|
||||
const isProcessing = useRef(false);
|
||||
|
||||
const [hasScrolledToBottom, setHasScrolledToBottom] = useState(false);
|
||||
const [scrollViewContentHeight, setScrollViewContentHeight] = useState(0);
|
||||
@@ -106,11 +107,18 @@ const ProveScreen: React.FC = () => {
|
||||
|
||||
const onVerify = useCallback(
|
||||
async function () {
|
||||
if (isProcessing.current) {
|
||||
return;
|
||||
}
|
||||
isProcessing.current = true;
|
||||
|
||||
resetProof();
|
||||
buttonTap();
|
||||
const currentApp = selectedAppRef.current;
|
||||
|
||||
try {
|
||||
let timeToNavigateToStatusScreen: NodeJS.Timeout;
|
||||
|
||||
const passportDataAndSecret = await getPassportDataAndSecret().catch(
|
||||
(e: Error) => {
|
||||
console.error('Error getPassportDataAndSecret', e);
|
||||
@@ -133,6 +141,7 @@ const ProveScreen: React.FC = () => {
|
||||
const { passportData, secret } = passportDataAndSecret.data;
|
||||
const isRegistered = await isUserRegistered(passportData, secret);
|
||||
console.log('isRegistered', isRegistered);
|
||||
|
||||
if (!isRegistered) {
|
||||
clearTimeout(timeToNavigateToStatusScreen);
|
||||
console.log(
|
||||
@@ -157,6 +166,8 @@ const ProveScreen: React.FC = () => {
|
||||
} catch (e) {
|
||||
console.log('Error sending VC and disclose payload', e);
|
||||
globalSetDisclosureStatus?.(ProofStatusEnum.ERROR);
|
||||
} finally {
|
||||
isProcessing.current = false;
|
||||
}
|
||||
},
|
||||
[navigate, getPassportDataAndSecret, handleProofVerified, resetProof],
|
||||
|
||||
@@ -47,6 +47,7 @@ const initSocket = (sessionId: string) => {
|
||||
const socket = io(socketUrl, {
|
||||
path: '/',
|
||||
transports: ['websocket'],
|
||||
forceNew: true,
|
||||
query: {
|
||||
sessionId,
|
||||
clientType: 'mobile',
|
||||
|
||||
@@ -161,6 +161,9 @@ export async function sendPayload(
|
||||
console.log('Truncated submit body:', truncatedBody);
|
||||
ws.send(JSON.stringify(submitBody));
|
||||
} else {
|
||||
if (result.error) {
|
||||
finalize(ProofStatusEnum.ERROR);
|
||||
}
|
||||
const receivedUuid = result.result;
|
||||
console.log('Received UUID:', receivedUuid);
|
||||
console.log(result);
|
||||
@@ -177,7 +180,14 @@ export async function sendPayload(
|
||||
const data =
|
||||
typeof message === 'string' ? JSON.parse(message) : message;
|
||||
console.log('SocketIO message:', data);
|
||||
if (data.status === 4) {
|
||||
if (data.status === 3) {
|
||||
console.log('Failed to generate proof');
|
||||
socket?.disconnect();
|
||||
if (ws.readyState === WebSocket.OPEN) {
|
||||
ws.close();
|
||||
}
|
||||
finalize(ProofStatusEnum.FAILURE);
|
||||
} else if (data.status === 4) {
|
||||
console.log('Proof verified');
|
||||
socket?.disconnect();
|
||||
if (ws.readyState === WebSocket.OPEN) {
|
||||
|
||||
Reference in New Issue
Block a user