mirror of
https://github.com/selfxyz/self.git
synced 2026-04-05 03:00:53 -04:00
chore update mobile app types (#1087)
* clean up types * clean up additional types * format * fix types
This commit is contained in:
@@ -2,47 +2,44 @@
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
// NOTE: Converts to Apache-2.0 on 2029-06-11 per LICENSE.
|
||||
|
||||
import React from 'react';
|
||||
import React, { createElement, forwardRef } from 'react';
|
||||
|
||||
export const Circle = React.forwardRef<
|
||||
export const Circle = forwardRef<
|
||||
SVGCircleElement,
|
||||
React.SVGProps<SVGCircleElement>
|
||||
>((props, ref) => {
|
||||
return React.createElement('circle', { ref, ...props });
|
||||
return createElement('circle', { ref, ...props });
|
||||
});
|
||||
|
||||
Circle.displayName = 'Circle';
|
||||
|
||||
export const Path = React.forwardRef<
|
||||
SVGPathElement,
|
||||
React.SVGProps<SVGPathElement>
|
||||
>((props, ref) => {
|
||||
return React.createElement('path', { ref, ...props });
|
||||
});
|
||||
export const Path = forwardRef<SVGPathElement, React.SVGProps<SVGPathElement>>(
|
||||
(props, ref) => {
|
||||
return createElement('path', { ref, ...props });
|
||||
},
|
||||
);
|
||||
|
||||
Path.displayName = 'Path';
|
||||
|
||||
export const Rect = React.forwardRef<
|
||||
SVGRectElement,
|
||||
React.SVGProps<SVGRectElement>
|
||||
>((props, ref) => {
|
||||
return React.createElement('rect', { ref, ...props });
|
||||
});
|
||||
export const Rect = forwardRef<SVGRectElement, React.SVGProps<SVGRectElement>>(
|
||||
(props, ref) => {
|
||||
return createElement('rect', { ref, ...props });
|
||||
},
|
||||
);
|
||||
|
||||
Rect.displayName = 'Rect';
|
||||
|
||||
// Re-export other common SVG components that might be used
|
||||
export const Svg = React.forwardRef<
|
||||
SVGSVGElement,
|
||||
React.SVGProps<SVGSVGElement>
|
||||
>((props, ref) => {
|
||||
return React.createElement('svg', { ref, ...props });
|
||||
});
|
||||
export const Svg = forwardRef<SVGSVGElement, React.SVGProps<SVGSVGElement>>(
|
||||
(props, ref) => {
|
||||
return createElement('svg', { ref, ...props });
|
||||
},
|
||||
);
|
||||
|
||||
Svg.displayName = 'Svg';
|
||||
|
||||
// Mock SvgXml component for web builds
|
||||
export const SvgXml = React.forwardRef<
|
||||
export const SvgXml = forwardRef<
|
||||
HTMLDivElement,
|
||||
{
|
||||
xml: string;
|
||||
@@ -51,7 +48,7 @@ export const SvgXml = React.forwardRef<
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
>(({ xml, width, height, style, ...props }, ref) => {
|
||||
return React.createElement('div', {
|
||||
return createElement('div', {
|
||||
ref,
|
||||
style: {
|
||||
width: width || 'auto',
|
||||
|
||||
@@ -22,7 +22,6 @@ import proveScreens from '@/navigation/prove';
|
||||
import recoveryScreens from '@/navigation/recovery';
|
||||
import settingsScreens from '@/navigation/settings';
|
||||
import systemScreens from '@/navigation/system';
|
||||
import type { ProofHistory } from '@/stores/proof-types';
|
||||
import analytics from '@/utils/analytics';
|
||||
import { setupUniversalLinkListenerInNavigation } from '@/utils/deeplinks';
|
||||
|
||||
|
||||
@@ -3,7 +3,13 @@
|
||||
// NOTE: Converts to Apache-2.0 on 2029-06-11 per LICENSE.
|
||||
|
||||
import LottieView from 'lottie-react-native';
|
||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import React, {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
import {
|
||||
Linking,
|
||||
NativeEventEmitter,
|
||||
@@ -109,11 +115,14 @@ const DocumentNFCScanScreen: React.FC = () => {
|
||||
const scanCancelledRef = useRef(false);
|
||||
const sessionIdRef = useRef(uuidv4());
|
||||
|
||||
const baseContext = {
|
||||
sessionId: sessionIdRef.current,
|
||||
platform: Platform.OS as 'ios' | 'android',
|
||||
scanType: route.params?.useCan ? 'can' : 'mrz',
|
||||
} as const;
|
||||
const baseContext = useMemo(
|
||||
() => ({
|
||||
sessionId: sessionIdRef.current,
|
||||
platform: Platform.OS as 'ios' | 'android',
|
||||
scanType: (route.params?.useCan ? 'can' : 'mrz') as 'mrz' | 'can',
|
||||
}),
|
||||
[route.params?.useCan],
|
||||
);
|
||||
|
||||
const animationRef = useRef<LottieView>(null);
|
||||
|
||||
@@ -129,7 +138,7 @@ const DocumentNFCScanScreen: React.FC = () => {
|
||||
stage: 'unmount',
|
||||
});
|
||||
};
|
||||
}, []);
|
||||
}, [baseContext]);
|
||||
|
||||
// Cleanup timeout on component unmount
|
||||
useEffect(() => {
|
||||
@@ -188,7 +197,7 @@ const DocumentNFCScanScreen: React.FC = () => {
|
||||
onModalDismiss: () => {},
|
||||
});
|
||||
},
|
||||
[showModal, goToNFCTrouble],
|
||||
[baseContext, showModal, goToNFCTrouble],
|
||||
);
|
||||
|
||||
const checkNfcSupport = useCallback(async () => {
|
||||
@@ -233,7 +242,7 @@ const DocumentNFCScanScreen: React.FC = () => {
|
||||
},
|
||||
);
|
||||
}
|
||||
}, []);
|
||||
}, [baseContext]);
|
||||
|
||||
const usePacePolling = (): boolean => {
|
||||
const { usePacePolling: usePacePollingParam } = route.params ?? {};
|
||||
@@ -483,6 +492,7 @@ const DocumentNFCScanScreen: React.FC = () => {
|
||||
}
|
||||
}
|
||||
}, [
|
||||
baseContext,
|
||||
isNfcEnabled,
|
||||
isNfcSupported,
|
||||
route.params,
|
||||
@@ -576,7 +586,7 @@ const DocumentNFCScanScreen: React.FC = () => {
|
||||
scanTimeoutRef.current = null;
|
||||
}
|
||||
};
|
||||
}, [checkNfcSupport]),
|
||||
}, [baseContext, checkNfcSupport]),
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
@@ -3,18 +3,17 @@
|
||||
// NOTE: Converts to Apache-2.0 on 2029-06-11 per LICENSE.
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { ScrollView } from 'react-native';
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
import { Button, Text, XStack, YStack, ZStack } from 'tamagui';
|
||||
import { BlurView } from '@react-native-community/blur';
|
||||
import { useNavigation, useRoute } from '@react-navigation/native';
|
||||
import { useNavigation } from '@react-navigation/native';
|
||||
|
||||
import { PassportData } from '@selfxyz/common/types';
|
||||
import { DocumentCatalog } from '@selfxyz/common/utils/types';
|
||||
|
||||
import IdCardLayout from '@/components/homeScreen/idCard';
|
||||
import { usePassport } from '@/providers/passportDataProvider';
|
||||
import ProofHistoryList from '@/screens/home/ProofHistoryList';
|
||||
import { ProofHistoryList } from '@/screens/home/ProofHistoryList';
|
||||
import useUserStore from '@/stores/userStore';
|
||||
import {
|
||||
black,
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
SectionList,
|
||||
StyleSheet,
|
||||
} from 'react-native';
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
import { Card, Image, Text, View, XStack, YStack } from 'tamagui';
|
||||
import { useNavigation } from '@react-navigation/native';
|
||||
import { CheckSquare2, Wallet, XCircle } from '@tamagui/lucide-icons';
|
||||
@@ -64,7 +63,6 @@ export const ProofHistoryList: React.FC<ProofHistoryListProps> = ({
|
||||
} = useProofHistoryStore();
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
const navigation = useNavigation();
|
||||
const { bottom } = useSafeAreaInsets();
|
||||
|
||||
useEffect(() => {
|
||||
initDatabase();
|
||||
|
||||
@@ -153,15 +153,15 @@ const handleResponseIOS = (response: unknown) => {
|
||||
const signedAttributes = parsed?.signedAttributes;
|
||||
const mrz = parsed?.passportMRZ;
|
||||
const signatureBase64 = parsed?.signatureBase64;
|
||||
const _dataGroupsPresent = parsed?.dataGroupsPresent;
|
||||
const _placeOfBirth = parsed?.placeOfBirth;
|
||||
const _activeAuthenticationPassed = parsed?.activeAuthenticationPassed;
|
||||
const _isPACESupported = parsed?.isPACESupported;
|
||||
const _isChipAuthenticationSupported = parsed?.isChipAuthenticationSupported;
|
||||
const _residenceAddress = parsed?.residenceAddress;
|
||||
const passportPhoto = parsed?.passportPhoto;
|
||||
const _encapsulatedContentDigestAlgorithm =
|
||||
parsed?.encapsulatedContentDigestAlgorithm;
|
||||
// const _dataGroupsPresent = parsed?.dataGroupsPresent;
|
||||
// const _placeOfBirth = parsed?.placeOfBirth;
|
||||
// const _activeAuthenticationPassed = parsed?.activeAuthenticationPassed;
|
||||
// const _isPACESupported = parsed?.isPACESupported;
|
||||
// const _isChipAuthenticationSupported = parsed?.isChipAuthenticationSupported;
|
||||
// const _residenceAddress = parsed?.residenceAddress;
|
||||
// const passportPhoto = parsed?.passportPhoto;
|
||||
// const _encapsulatedContentDigestAlgorithm =
|
||||
// parsed?.encapsulatedContentDigestAlgorithm;
|
||||
const documentSigningCertificate = parsed?.documentSigningCertificate;
|
||||
const pem = JSON.parse(documentSigningCertificate).PEM.replace(/\n/g, '');
|
||||
const eContentArray = Array.from(Buffer.from(signedAttributes, 'base64'));
|
||||
@@ -203,12 +203,12 @@ const handleResponseAndroid = (response: AndroidScanResponse): PassportData => {
|
||||
mrz,
|
||||
eContent,
|
||||
encryptedDigest,
|
||||
_photo,
|
||||
_digestAlgorithm,
|
||||
_signerInfoDigestAlgorithm,
|
||||
_digestEncryptionAlgorithm,
|
||||
_LDSVersion,
|
||||
_unicodeVersion,
|
||||
// _photo,
|
||||
// _digestAlgorithm,
|
||||
// _signerInfoDigestAlgorithm,
|
||||
// _digestEncryptionAlgorithm,
|
||||
// _LDSVersion,
|
||||
// _unicodeVersion,
|
||||
encapContent,
|
||||
documentSigningCertificate,
|
||||
dataGroupHashes,
|
||||
|
||||
Reference in New Issue
Block a user