-
Notifications
You must be signed in to change notification settings - Fork 221
Show badge for inactive documents #1487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
80fa30b
c96e06b
b8d74f7
0c618a5
0e9d145
fea235b
eb6dbe5
cc5ff20
97fbb15
f2b600a
d9f142d
8b7189b
3b2751a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,10 +3,11 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // NOTE: Converts to Apache-2.0 on 2029-06-11 per LICENSE. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { FC } from 'react'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import React from 'react'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Image, StyleSheet } from 'react-native'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import React, { useCallback } from 'react'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Dimensions, Image, Pressable, StyleSheet } from 'react-native'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import LinearGradient from 'react-native-linear-gradient'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Text, XStack, YStack } from 'tamagui'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Separator, Text, XStack, YStack } from 'tamagui'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useNavigation } from '@react-navigation/native'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { AadhaarData } from '@selfxyz/common'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { PassportData } from '@selfxyz/common/types/passport'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -16,8 +17,18 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isKycDocument, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isMRZDocument, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } from '@selfxyz/common/utils/types'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { WarningTriangleIcon } from '@selfxyz/euclid/dist/components/icons/WarningTriangleIcon'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { RoundFlag } from '@selfxyz/mobile-sdk-alpha/components'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { white } from '@selfxyz/mobile-sdk-alpha/constants/colors'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| black, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| red600, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slate100, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slate300, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slate400, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slate500, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| white, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| yellow500, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } from '@selfxyz/mobile-sdk-alpha/constants/colors'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { dinot, plexMono } from '@selfxyz/mobile-sdk-alpha/constants/fonts'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import CardBackgroundId1 from '@/assets/images/card_background_id1.png'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -28,14 +39,21 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import CardBackgroundId6 from '@/assets/images/card_background_id6.png'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import DevCardLogo from '@/assets/images/dev_card_logo.svg'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import DevCardWave from '@/assets/images/dev_card_wave.svg'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import LogoGray from '@/assets/images/logo_gray.svg'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import SelfLogoPending from '@/assets/images/self_logo_pending.svg'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import WaveOverlay from '@/assets/images/wave_overlay.png'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { getSecurityLevel } from '@/components/homescreen/cardSecurityBadge'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { cardStyles } from '@/components/homescreen/cardStyles'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import KycIdCard from '@/components/homescreen/KycIdCard'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { SvgXml } from '@/components/homescreen/SvgXmlWrapper'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useCardDimensions } from '@/hooks/useCardDimensions'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { getBackgroundIndex } from '@/utils/cardBackgroundSelector'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { getDocumentAttributes } from '@/utils/documentAttributes'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| formatDateFromYYMMDD, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getDocumentAttributes, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getNameAndSurname, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } from '@/utils/documentAttributes'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { registerModalCallbacks } from '@/utils/modalCallbackRegistry'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const CARD_BACKGROUNDS = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CardBackgroundId1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -279,6 +297,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| idDocument: PassportData | AadhaarData | KycData | null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| selected: boolean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| hidden: boolean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isInactive?: boolean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -293,7 +312,38 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| idDocument, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| selected, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| hidden, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isInactive = false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const navigation = useNavigation(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const navigateToDocumentOnboarding = useCallback(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| switch (idDocument?.documentCategory) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| case 'passport': | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| case 'id_card': | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| navigation.navigate('DocumentOnboarding'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| case 'aadhaar': | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| navigation.navigate('AadhaarUpload', { countryCode: 'IND' }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, [idDocument?.documentCategory, navigation]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+317
to
+328
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, find the IdCard.tsx file and check its content around lines 317-328
fd "IdCard.tsx" -t f -x wc -l {}Repository: selfxyz/self Length of output: 371 🏁 Script executed: # Get the content around lines 317-328 of IdCard.tsx
fd "IdCard.tsx" -t f -x head -n 330 {} | tail -n 20Repository: selfxyz/self Length of output: 497 🏁 Script executed: # Find the navigation configuration files
fd "navigation" -t d | head -20Repository: selfxyz/self Length of output: 142 🏁 Script executed: # Search for RootStackParamList definition
rg -n "RootStackParamList" --type=ts --type=tsxRepository: selfxyz/self Length of output: 83 🏁 Script executed: # Search for route definitions including DocumentOnboarding and AadhaarUpload
rg -n "DocumentOnboarding|AadhaarUpload" --type=ts --type=tsx -C 2Repository: selfxyz/self Length of output: 83 🏁 Script executed: # Get content of IdCard.tsx around lines 317-328
sed -n '310,335p' ./app/src/components/homescreen/IdCard.tsxRepository: selfxyz/self Length of output: 783 🏁 Script executed: # Search for RootStackParamList with correct syntax
rg -n "RootStackParamList" -t tsRepository: selfxyz/self Length of output: 13747 🏁 Script executed: # Search for route definitions with correct syntax
rg -n "DocumentOnboarding|AadhaarUpload" -t ts -C 2Repository: selfxyz/self Length of output: 18902 🏁 Script executed: # Check navigation folder structure
ls -la ./app/src/navigation/Repository: selfxyz/self Length of output: 986 🏁 Script executed: # Check the imports and first 30 lines of IdCard.tsx
head -n 30 ./app/src/components/homescreen/IdCard.tsxRepository: selfxyz/self Length of output: 1080 🏁 Script executed: # Check if RootStackParamList and NativeStackNavigationProp are already imported in IdCard.tsx
grep -n "import\|RootStackParamList\|NativeStackNavigationProp" ./app/src/components/homescreen/IdCard.tsx | head -20Repository: selfxyz/self Length of output: 1312 🏁 Script executed: # View the navigation index.tsx to confirm the type-safe navigation setup with createStaticNavigation
sed -n '1,80p' ./app/src/navigation/index.tsxRepository: selfxyz/self Length of output: 3087 Add type parameter to
Proposed fix+import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
+import type { RootStackParamList } from '@/navigation';
+
- const navigation = useNavigation();
+ const navigation = useNavigation<NativeStackNavigationProp<RootStackParamList>>();📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const handleInactivePress = useCallback(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const callbackId = registerModalCallbacks({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onButtonPress: navigateToDocumentOnboarding, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onModalDismiss: () => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| navigation.navigate('Modal', { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| titleText: 'Your ID needs to be reactivated to continue', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bodyText: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'Make sure that you have your document and recovery method ready.', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| buttonText: 'Continue', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| secondaryButtonText: 'Not now', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| callbackId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, [navigateToDocumentOnboarding, navigation]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Early return if document is null | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Call hooks at the top, before any conditional returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cardWidth, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -399,7 +449,47 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const truncatedId = getTruncatedId(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <YStack width="100%" alignItems="center" justifyContent="center"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Container wrapper to handle shadow space properly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <YStack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| width="100%" // Add space for horizontal margins | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| alignItems="center" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| justifyContent="center" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {isInactive && ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Pressable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| style={styles.inactiveWarningContainer} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onPress={handleInactivePress} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <XStack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backgroundColor={red600} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| borderRadius={8} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| padding={16} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gap={16} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <YStack padding={8} backgroundColor={white} borderRadius={8}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <WarningTriangleIcon color={yellow500} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </YStack> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <YStack gap={4}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color={white} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontFamily={dinot} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontSize={16} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontWeight="500" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Your document is inactive | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Text> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color={white} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontFamily={dinot} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontSize={14} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontWeight="400" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Tap here to recover your ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Text> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </YStack> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </XStack> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Pressable> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <YStack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| width={cardWidth} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| height={cardHeight} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -566,23 +656,45 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Text> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </YStack> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {/* Security Badge */} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <YStack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backgroundColor="rgba(0, 0, 0, 0.5)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| borderRadius={30} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| paddingHorizontal={padding * 0.6} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| paddingVertical={padding * 0.3} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontFamily={dinot} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontSize={fontSize.badge} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontWeight="500" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color={white} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| textTransform="uppercase" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| letterSpacing={0.6} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {/* Bottom Right: Badges */} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <YStack alignItems="flex-end" gap={4}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {isInactive && ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <YStack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backgroundColor={red600} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| borderRadius={30} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| paddingHorizontal={padding * 0.6} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| paddingVertical={padding * 0.3} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontFamily={dinot} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontSize={fontSize.badge} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontWeight="500" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color={white} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| textTransform="uppercase" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| letterSpacing={0.6} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| INACTIVE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Text> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </YStack> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {/* Security Badge */} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <YStack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backgroundColor="rgba(0, 0, 0, 0.5)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| borderRadius={30} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| paddingHorizontal={padding * 0.6} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| paddingVertical={padding * 0.3} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {securityLevel} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Text> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontFamily={dinot} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontSize={fontSize.badge} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fontWeight="500" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color={white} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| textTransform="uppercase" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| letterSpacing={0.6} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {securityLevel} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Text> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </YStack> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </YStack> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </XStack> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </YStack> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -605,6 +717,10 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| height: '90%', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| opacity: 0.6, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inactiveWarningContainer: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| width: '100%', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| marginBottom: 16, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export default IdCardLayout; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,7 @@ import type { | |
| import { | ||
| brutforceSignatureAlgorithmDsc, | ||
| calculateContentHash, | ||
| inferDocumentCategory, | ||
| } from '@selfxyz/common/utils'; | ||
| import { parseCertificateSimple } from '@selfxyz/common/utils/certificate_parsing/parseCertificateSimple'; | ||
| import type { | ||
|
|
@@ -869,6 +870,12 @@ export async function storeDocumentWithDeduplication( | |
| // Store new document using contentHash as service name | ||
| await storeDocumentDirectlyToKeychain(contentHash, passportData); | ||
|
|
||
| const documentCategory = | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Re-onboarding inactive documents does not update metadata flagHigh Severity When a user re-onboards an existing document (same content hash), Additional Locations (1) |
||
| passportData.documentCategory || | ||
| inferDocumentCategory( | ||
| (passportData as PassportData | AadhaarData).documentType, | ||
| ); | ||
|
|
||
| // Add to catalog | ||
| let dataField: string; | ||
| if (isMRZDocument(passportData)) { | ||
|
|
@@ -886,6 +893,8 @@ export async function storeDocumentWithDeduplication( | |
| data: dataField, | ||
| mock: passportData.mock || false, | ||
| isRegistered: false, | ||
| hasExpirationDate: | ||
| documentCategory === 'id_card' || documentCategory === 'passport', | ||
| ...(isKycDocument(passportData) | ||
| ? (() => { | ||
| try { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // NOTE: Converts to Apache-2.0 on 2029-06-11 per LICENSE. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import React from 'react'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { ScrollView } from 'react-native'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Alert, ScrollView } from 'react-native'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { YStack } from 'tamagui'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useNavigation } from '@react-navigation/native'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { NativeStackScreenProps } from '@react-navigation/native-stack'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -13,6 +13,10 @@ import { useSafeBottomPadding } from '@selfxyz/mobile-sdk-alpha/hooks'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import BugIcon from '@/assets/icons/bug_icon.svg'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import ErrorBoundary from '@/components/ErrorBoundary'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { RootStackParamList } from '@/navigation'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| loadDocumentCatalogDirectlyFromKeychain, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| saveDocumentCatalogDirectlyToKeychain, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } from '@/providers/passportDataProvider'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { ErrorInjectionSelector } from '@/screens/dev/components/ErrorInjectionSelector'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { LogLevelSelector } from '@/screens/dev/components/LogLevelSelector'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { ParameterSection } from '@/screens/dev/components/ParameterSection'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -52,6 +56,32 @@ const DevSettingsScreen: React.FC = () => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| handleClearPendingVerificationsPress, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } = useDangerZoneActions(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const handleRemoveExpirationDateFlagPress = () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Alert.alert( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'Remove Expiration Date Flag', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'Are you sure you want to remove the expiration date flag for the current (selected) document?.', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { text: 'Cancel', style: 'cancel' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| text: 'Remove', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| style: 'destructive', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onPress: async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const catalog = await loadDocumentCatalogDirectlyFromKeychain(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const selectedDocumentId = catalog.selectedDocumentId; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const selectedDocument = catalog.documents.find( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| document => document.id === selectedDocumentId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (selectedDocument) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| delete selectedDocument.hasExpirationDate; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await saveDocumentCatalogDirectlyToKeychain(catalog); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+59
to
+84
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add error handling and success feedback for consistency. This handler lacks try/catch error handling and success feedback that other danger zone handlers provide (e.g., Apply this diff: onPress: async () => {
+ try {
const catalog = await loadDocumentCatalogDirectlyFromKeychain();
const selectedDocumentId = catalog.selectedDocumentId;
const selectedDocument = catalog.documents.find(
document => document.id === selectedDocumentId,
);
if (selectedDocument) {
delete selectedDocument.hasExpirationDate;
-
await saveDocumentCatalogDirectlyToKeychain(catalog);
+ Alert.alert('Success', 'Expiration date flag removed.', [
+ { text: 'OK' },
+ ]);
+ } else {
+ Alert.alert('Error', 'No selected document found.', [
+ { text: 'OK' },
+ ]);
}
+ } catch (error) {
+ Alert.alert(
+ 'Error',
+ error instanceof Error ? error.message : 'Failed to remove flag',
+ [{ text: 'OK' }],
+ );
+ }
},📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as this is just a dev screen there's no need for it
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @shazarre, understood! That makes sense for dev tooling. I'll skip the error handling for this dev-only feature. 👍 🧠 Learnings used
Comment on lines
+59
to
+84
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor typo in alert message. Line 62: Fix- 'Are you sure you want to remove the expiration date flag for the current (selected) document?.',
+ 'Are you sure you want to remove the expiration date flag for the current (selected) document?',🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <ErrorBoundary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <ScrollView showsVerticalScrollIndicator={false}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -109,6 +139,7 @@ const DevSettingsScreen: React.FC = () => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onResetBackupState={handleResetBackupStatePress} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClearBackupEvents={handleClearBackupEventsPress} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClearPendingKyc={handleClearPendingVerificationsPress} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onRemoveExpirationDateFlag={handleRemoveExpirationDateFlagPress} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </YStack> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </ScrollView> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bundle threshold bump needs explicit tracking (owner + link + revert-by date).
A +1MB CI allowance is fine as a temporary unblock, but the current
// TODO: fix temporary bundle bumpis too vague and risks making the increase permanent. Please add a tracking reference (issue/PR), an owner, and a concrete “revert to 45MB by ” note (or a clearly justified new baseline). Based on learnings, keep bundle size impact acceptable and prefer tree-shaking/size optimization over moving thresholds.Proposed tweak
const BUNDLE_THRESHOLDS_MB = { - // TODO: fix temporary bundle bump + // TODO(<issue-or-pr-link>, <owner>, revert-by YYYY-MM-DD): revert to 45MB once bundle size is reduced ios: 46, android: 46, };📝 Committable suggestion