Skip to content
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

feat: [EUDIW-205] Implement Wallet Home #56

Merged
merged 96 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
76b91e5
refactor: scaffold app with few dependencies
LazyAfternoons Nov 14, 2024
f255fa7
feat: add bootsplash
LazyAfternoons Nov 14, 2024
9f19332
feat: add husky
LazyAfternoons Nov 14, 2024
ca332ad
feat: add husky
LazyAfternoons Nov 14, 2024
ae59ca6
feat: add husky
LazyAfternoons Nov 14, 2024
9901a31
chore: fix husky
LazyAfternoons Nov 14, 2024
07c2fe6
chore: fix husky
LazyAfternoons Nov 14, 2024
1fcf283
Merge branch 'main' into EUDIW-161-EUDIW-166-refactor-app
LazyAfternoons Nov 14, 2024
82a4766
ci: add static checks action
LazyAfternoons Nov 15, 2024
3df533c
ci: rename action
LazyAfternoons Nov 15, 2024
d20165e
ci: update workflows
LazyAfternoons Nov 15, 2024
2438af6
ci: set static wf name
LazyAfternoons Nov 15, 2024
108313e
ci: update workflows
LazyAfternoons Nov 15, 2024
0d151d8
ci: update workflows
LazyAfternoons Nov 15, 2024
bbda346
ci: update workflows
LazyAfternoons Nov 15, 2024
6c09efb
chore: add prettier script
LazyAfternoons Nov 15, 2024
952cae8
chore: update test script
LazyAfternoons Nov 15, 2024
8e94fbf
ci: use comma to split
LazyAfternoons Nov 15, 2024
b5c4bc7
ci: use comma to split
LazyAfternoons Nov 15, 2024
d29541f
deps: add io-app-design-system
LazyAfternoons Nov 15, 2024
372fa4e
feat: add store and basic navigation
LazyAfternoons Nov 15, 2024
270b684
fix: locales generation
LazyAfternoons Nov 15, 2024
5dd1359
Merge branch 'EUDIW-161-EUDIW-166-refactor-app' into EUDIW-163-EUDIW-…
LazyAfternoons Nov 15, 2024
25fe169
docs: update documentation
LazyAfternoons Nov 15, 2024
b096d09
chore: add props to screen to test typing
LazyAfternoons Nov 15, 2024
94c65ae
fix: wrong typing
LazyAfternoons Nov 15, 2024
0925410
Merge branch 'main' into EUDIW-163-EUDIW-167-navigation-store
LazyAfternoons Nov 18, 2024
974746b
deps: add react-redux
LazyAfternoons Nov 18, 2024
57a7f90
chore:fix align with main
LazyAfternoons Nov 18, 2024
ef6729c
feat: add onboarding flows
LazyAfternoons Nov 20, 2024
78b4acd
chore: add pr template
LazyAfternoons Nov 20, 2024
127571e
Merge branch 'main' into EUDIW-164-onboarding-flow
LazyAfternoons Nov 20, 2024
aff6d79
deps: fix wrong dependencies versions
LazyAfternoons Nov 20, 2024
6420560
chore: align to main
LazyAfternoons Nov 20, 2024
fcfd504
chore: rename param in preferences reducer
LazyAfternoons Nov 20, 2024
3788505
deps: update yarn lock
LazyAfternoons Nov 20, 2024
5253602
fix: minor fixes for Android
LazyAfternoons Nov 21, 2024
03d89ee
refactor: use function to conditionally render screens
LazyAfternoons Nov 21, 2024
bca00a4
docs: update documentation
LazyAfternoons Nov 21, 2024
0c08d94
chore: add missing padding for skip button
LazyAfternoons Nov 21, 2024
d60e556
refactor: minor navigation refactor
LazyAfternoons Nov 22, 2024
ad87b71
chore: remove unused locales
LazyAfternoons Nov 22, 2024
cf36b09
feat: add wallet instance registration and attestation flow
LazyAfternoons Nov 22, 2024
667118b
fix: crash on iOSwhen using face id
LazyAfternoons Nov 26, 2024
157f880
amend me
LazyAfternoons Nov 26, 2024
794cc68
refactor: use markdown to render pin policy
LazyAfternoons Nov 26, 2024
3ceb578
chore: remove unwanted change
LazyAfternoons Nov 26, 2024
eefe83a
chore: remove unwanted change
LazyAfternoons Nov 27, 2024
11aee86
Merge branch 'EUDIW-164-onboarding-flow' into EUDIW-174-wallet-attest…
LazyAfternoons Nov 27, 2024
d38d74b
chore: remove unused fetch param
LazyAfternoons Nov 28, 2024
70c1207
docs: add documentation
LazyAfternoons Dec 1, 2024
a781918
Merge branch 'main' into EUDIW-174-wallet-attestation-flow
LazyAfternoons Dec 1, 2024
d402ece
chore: print attestation
LazyAfternoons Dec 1, 2024
4d85f36
docs: update documentation
LazyAfternoons Dec 1, 2024
5766acb
deps: downgrade to RN075
LazyAfternoons Dec 4, 2024
aef54a9
feat: first attemp
LazyAfternoons Dec 4, 2024
458a836
deps: downgrade to RN075
LazyAfternoons Dec 4, 2024
927c92c
Merge branch 'EUDIW-201-downgrade-rn-075' into EUDIW-175-pid-issuance…
LazyAfternoons Dec 4, 2024
3164091
deps: downgrade package.json dependencies
LazyAfternoons Dec 4, 2024
55c1a88
feat: first attempt at pid issuance flow
LazyAfternoons Dec 4, 2024
c0de60e
deps: downgrade to RN075
LazyAfternoons Dec 4, 2024
3e7af14
deps: downgrade package.json dependencies
LazyAfternoons Dec 4, 2024
8328bb4
deps: align lock files
LazyAfternoons Dec 4, 2024
47b6f25
feat: add pid issuance flow
LazyAfternoons Dec 5, 2024
fcb2558
Merge branch 'EUDIW-201-downgrade-rn-075' into EUDIW-174-wallet-attes…
LazyAfternoons Dec 6, 2024
7166f5e
deps: update lock files
LazyAfternoons Dec 6, 2024
87a9949
fix: minor fixes
LazyAfternoons Dec 7, 2024
bdf0fe4
fix: config checks and configuration on Android
LazyAfternoons Dec 7, 2024
cbd03d6
fix: Android build and config not working
LazyAfternoons Dec 7, 2024
873892e
Merge branch 'EUDIW-174-wallet-attestation-flow' into EUDIW-175-pid-i…
LazyAfternoons Dec 7, 2024
1bf0dc7
fix: android config for custom tabs
LazyAfternoons Dec 7, 2024
867f037
fix: redirect uri
LazyAfternoons Dec 7, 2024
680e57b
refactor: wallet creation screen without fixed footer
LazyAfternoons Dec 7, 2024
8e1e9d8
chore: linter
LazyAfternoons Dec 7, 2024
a42c9b9
Merge branch 'EUDIW-174-wallet-attestation-flow' into EUDIW-175-pid-i…
LazyAfternoons Dec 7, 2024
646321f
docs: update docs and remove unnecessary code
LazyAfternoons Dec 7, 2024
008d506
docs: update documentation
LazyAfternoons Dec 7, 2024
4ea5609
Merge branch 'EUDIW-174-wallet-attestation-flow' into EUDIW-175-pid-i…
LazyAfternoons Dec 7, 2024
fc939c2
Merge branch 'main' into EUDIW-175-pid-issuance-flow
LazyAfternoons Dec 9, 2024
ea615ef
refactor: use an array to store every credential
LazyAfternoons Dec 16, 2024
a2c36da
deps: update io-react-native-wallet and remove unused dependencies
LazyAfternoons Dec 16, 2024
a17d0a8
refactor: use find to get a credential
LazyAfternoons Dec 16, 2024
3076b6f
feat: implements wallet-home
eudiwtech Dec 18, 2024
250f246
fix: linting problem
eudiwtech Dec 19, 2024
939a6ac
Merge main into EUDIW-205-wallet-home
eudiwtech Jan 9, 2025
7f2c5c7
fix: fix linting problems
eudiwtech Jan 9, 2025
da28c22
fix: revert resources.d.ts
eudiwtech Jan 9, 2025
9805f14
fix: remove unwanted changes
eudiwtech Jan 13, 2025
56cae72
Merge branch 'main' into EUDIW-205-wallet-home
LazyAfternoons Jan 14, 2025
884294f
chore: move credentialsImage in the appropriate path
eudiwtech Jan 14, 2025
7416489
fix: fix resource.d.ts
eudiwtech Jan 14, 2025
b946738
fix: change border color and font of the credential
eudiwtech Jan 14, 2025
ad6fc38
Merge main into EUDIW-205-wallet-home
eudiwtech Jan 14, 2025
bb49d82
fix: fix resources.d.ts
eudiwtech Jan 14, 2025
2c6b973
fix: prettier
eudiwtech Jan 14, 2025
2dd5f32
fix: remove credentialsReducer from root
eudiwtech Jan 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/credentials/pid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions locales/en/wallet.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{
"credentials": {
"names": {
"mdl": "Driving License",
"pid": "Digital Identity",
"unknown": "Unknown"
}
},
LazyAfternoons marked this conversation as resolved.
Show resolved Hide resolved
"activationBanner": {
"title": "Your digital documents always with you!",
"description": "Activate the Wallet to keep your digital identity and personal documents on your device.",
Expand Down
3 changes: 3 additions & 0 deletions ts/features/wallet/store/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ export const credentialsReducer = persistReducer(
credentialsSlice.reducer
);

export const credentialsSelector = (state: RootState) =>
state.wallet.credentials;

/**
* Exports the actions for the credentials slice.
*/
Expand Down
19 changes: 19 additions & 0 deletions ts/features/wallet/utils/credentials.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import i18next from 'i18next';

type CredentialsKeys = 'DRIVING_LICENSE' | 'PID';

export const wellKnownCredential: Record<CredentialsKeys, string> = {
DRIVING_LICENSE: 'MDL',
PID: 'PersonIdentificationData'
};

export const getCredentialNameByType = (type: string): string => {
switch (type) {
case wellKnownCredential.DRIVING_LICENSE:
return i18next.t(['wallet:credentials.names.mdl', 'Credential']);
case wellKnownCredential.PID:
return i18next.t(['wallet:credentials.names.pid', 'Credential']);
default:
return i18next.t(['wallet:credentials.names.unknown', 'Credential']);
}
};
15 changes: 15 additions & 0 deletions ts/features/wallet/utils/credentialsImage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {ImageSourcePropType} from 'react-native/types';

type CredentialAsset = {
asset: ImageSourcePropType;
textColor: string;
};

const credentialsImage: Record<string, CredentialAsset> = {
PersonIdentificationData: {
asset: require('../../../../assets/credentials/pid.png'),
textColor: '#000'
}
};

export default credentialsImage;
7 changes: 7 additions & 0 deletions ts/i18n/types/resources.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ interface Resources {
};
};
wallet: {
credentials: {
names: {
mdl: 'Driving License';
pid: 'Digital Identity';
unknown: 'Unknown';
};
};
activationBanner: {
title: 'Your digital documents always with you!';
description: 'Activate the Wallet to keep your digital identity and personal documents on your device.';
Expand Down
106 changes: 103 additions & 3 deletions ts/screens/WalletHome.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import React from 'react';
import {View} from 'react-native';
import {IOStyles, HeaderFirstLevel} from '@pagopa/io-app-design-system';
import {FlatList, ImageBackground, StyleSheet, Text, View} from 'react-native';
import {
IOStyles,
HeaderFirstLevel,
IOColors,
makeFontStyleObject
} from '@pagopa/io-app-design-system';
import {useTranslation} from 'react-i18next';
import {useNavigation} from '@react-navigation/native';
import {useAppSelector} from '../store';
import {lifecycleIsOperationalSelector} from '../features/wallet/store/lifecycle';
import {ActivationBanner} from '../features/wallet/components/ActivationBanner';
import {credentialsSelector} from '../features/wallet/store/credentials';
import {getCredentialNameByType} from '../features/wallet/utils/credentials';
import credentialsImage from '../features/wallet/utils/credentialsImage';

/**
* Wallet home to be rendered as the first page in the tab navigator.
Expand All @@ -16,6 +24,7 @@ const WalletHome = () => {
const {t} = useTranslation(['wallet', 'global']);
const navigation = useNavigation();
const isWalletOperational = useAppSelector(lifecycleIsOperationalSelector);
const credentials = useAppSelector(credentialsSelector);

return (
<>
Expand All @@ -39,11 +48,102 @@ const WalletHome = () => {
/>
</View>
) : (
<></> // Needs to
<>
<FlatList
data={credentials.credentials}
renderItem={({item, index}) => {
if (index !== credentials.credentials.length - 1) {
return (
<View style={styles.previewContainer}>
<View style={styles.cardContainer}>
<View style={styles.card}>
<View style={styles.border} />
<View style={styles.header}>
<Text style={styles.label}>
{`${getCredentialNameByType(
item.credentialType
)}`}
</Text>
</View>
</View>
</View>
</View>
);
} else {
return (
<View style={styles.cardContainer}>
<ImageBackground
source={credentialsImage[item.credentialType].asset}
style={styles.card}>
<View style={styles.border} />
<View style={styles.header}>
<Text
style={[
styles.label,
{
color:
credentialsImage[item.credentialType]
.textColor
}
]}>
{`${getCredentialNameByType(
item.credentialType
).toUpperCase()}`}
</Text>
</View>
</ImageBackground>
</View>
);
}
}}
/>
</>
)}
</View>
</>
);
};

const styles = StyleSheet.create({
previewContainer: {
aspectRatio: 9 / 2,
overflow: 'hidden'
},
cardContainer: {
aspectRatio: 16 / 10,
borderRadius: 8,
overflow: 'hidden'
},
card: {
position: 'absolute',
left: 0,
right: 0,
top: 0,
bottom: 0,
backgroundColor: IOColors['grey-100']
},
border: {
position: 'absolute',
left: 0,
right: 0,
top: 0,
bottom: 0,
borderRadius: 8,
borderWidth: 2,
borderColor: IOColors['grey-50']
},
label: {
flex: 1,
...makeFontStyleObject(16, 'TitilliumSansPro', 20, 'Bold')
},
header: {
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
paddingHorizontal: 16,
paddingTop: 14
}
});

export default WalletHome;
Loading