Skip to content

Commit 364cfc4

Browse files
authored
Merge pull request #261 from idpass/feature/mosip-55-face-matching
Finish face-matching implementation and fix issues
2 parents 90b9083 + d68f577 commit 364cfc4

39 files changed

+192
-423
lines changed

components/FaceScanner.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useCallback, useContext, useEffect, useRef } from 'react';
22
import Icon from 'react-native-vector-icons/MaterialIcons';
33
import { Camera } from 'expo-camera';
4-
import { StyleSheet } from 'react-native';
4+
import { Platform, StyleSheet } from 'react-native';
55
import { Button, Centered, Column, Row, Text } from './ui';
66
import { useInterpret, useSelector } from '@xstate/react';
77
import { useTranslation } from 'react-i18next';
@@ -110,6 +110,12 @@ export const FaceScanner: React.FC<FaceScannerProps> = (props) => {
110110
/>
111111
</Row>
112112
)}
113+
{/* TODO: remove warning when iOS SDK is ready */}
114+
{Platform.OS === 'ios' && (
115+
<Text size="smaller" color={Theme.Colors.textLabel} align="center">
116+
(face-matching in iOS is mocked)
117+
</Text>
118+
)}
113119
</Centered>
114120
</Column>
115121
);

components/Passcode.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { Dimensions, Modal as RNModal } from 'react-native';
2+
import { Modal as RNModal } from 'react-native';
33
import { Icon } from 'react-native-elements';
44
import { PasscodeVerify } from '../components/PasscodeVerify';
55
import { Column, Text } from '../components/ui';

components/SingleVcItem.tsx

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
createVcItemMachine,
88
selectVerifiableCredential,
99
selectGeneratedOn,
10-
selectTag,
1110
selectId,
1211
vcItemMachine,
1312
selectContext,
@@ -73,27 +72,26 @@ const getDetails = (arg1, arg2, verifiableCredential) => {
7372
</Row>
7473
</Column>
7574
);
76-
} else {
77-
return (
78-
<Column>
79-
<Text color={Theme.Colors.DetailsLabel} size="smaller">
80-
{arg1}
81-
</Text>
82-
<Text
83-
numLines={1}
84-
color={Theme.Colors.Details}
85-
weight="bold"
86-
size="smaller"
87-
style={
88-
!verifiableCredential
89-
? Theme.Styles.loadingTitle
90-
: Theme.Styles.subtitle
91-
}>
92-
{!verifiableCredential ? '' : arg2}
93-
</Text>
94-
</Column>
95-
);
9675
}
76+
return (
77+
<Column>
78+
<Text color={Theme.Colors.DetailsLabel} size="smaller">
79+
{arg1}
80+
</Text>
81+
<Text
82+
numLines={1}
83+
color={Theme.Colors.Details}
84+
weight="bold"
85+
size="smaller"
86+
style={
87+
!verifiableCredential
88+
? Theme.Styles.loadingTitle
89+
: Theme.Styles.subtitle
90+
}>
91+
{!verifiableCredential ? '' : arg2}
92+
</Text>
93+
</Column>
94+
);
9795
};
9896

9997
export const SingleVcItem: React.FC<VcItemProps> = (props) => {
@@ -111,7 +109,6 @@ export const SingleVcItem: React.FC<VcItemProps> = (props) => {
111109
const context = useSelector(service, selectContext);
112110
const verifiableCredential = useSelector(service, selectVerifiableCredential);
113111
const uin = useSelector(service, selectId);
114-
const tag = useSelector(service, selectTag);
115112
const generatedOn = useSelector(service, selectGeneratedOn);
116113
const fullName = !verifiableCredential
117114
? ''
@@ -127,7 +124,7 @@ export const SingleVcItem: React.FC<VcItemProps> = (props) => {
127124
) : null;
128125

129126
return (
130-
<Column onShow={props.onShow(service)}>
127+
<Column>
131128
<ImageBackground
132129
source={!verifiableCredential ? null : Theme.CloseCard}
133130
resizeMode="stretch"
@@ -164,7 +161,7 @@ export const SingleVcItem: React.FC<VcItemProps> = (props) => {
164161

165162
<Column margin="0 0 0 10">
166163
{getDetails(t('fullName'), fullName, verifiableCredential)}
167-
{getDetails(t('uin'), tag || uin, verifiableCredential)}
164+
{getDetails(t('uin'), uin, verifiableCredential)}
168165
{getDetails(t('generatedOn'), generatedOn, verifiableCredential)}
169166
{getDetails(t('status'), t('valid'), verifiableCredential)}
170167
</Column>

components/VcItem.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
createVcItemMachine,
88
selectVerifiableCredential,
99
selectGeneratedOn,
10-
selectTag,
1110
vcItemMachine,
1211
selectContext,
1312
} from '../machines/vcItem';
@@ -102,7 +101,6 @@ export const VcItem: React.FC<VcItemProps> = (props) => {
102101
const uin = verifiableCredential?.credentialSubject.UIN;
103102
const vid = verifiableCredential?.credentialSubject.VID;
104103

105-
const tag = useSelector(service, selectTag);
106104
const generatedOn = useSelector(service, selectGeneratedOn);
107105
const fullName = !verifiableCredential
108106
? ''
@@ -180,15 +178,9 @@ export const VcItem: React.FC<VcItemProps> = (props) => {
180178
<Column margin="0 0 0 25" style={{ alignItems: 'flex-start' }}>
181179
{getDetails(t('fullName'), fullName, verifiableCredential)}
182180
{!verifiableCredential
183-
? getDetails(
184-
t('idtype'),
185-
tag || uin || vid,
186-
verifiableCredential
187-
)
188-
: null}
189-
{uin
190-
? getDetails(t('uin'), tag || uin, verifiableCredential)
181+
? getDetails(t('idtype'), uin || vid, verifiableCredential)
191182
: null}
183+
{uin ? getDetails(t('uin'), uin, verifiableCredential) : null}
192184
{vid ? getDetails(t('vid'), vid, verifiableCredential) : null}
193185
{getDetails(t('generatedOn'), generatedOn, verifiableCredential)}
194186
{getDetails(t('status'), t('valid'), verifiableCredential)}

components/VidItem.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import {
88
createVcItemMachine,
99
selectVerifiableCredential,
1010
selectGeneratedOn,
11-
selectTag,
1211
selectId,
1312
vcItemMachine,
1413
} from '../machines/vcItem';
1514
import { Column, Row, Text } from './ui';
1615
import { Theme } from './ui/styleUtils';
1716
import { RotatingIcon } from './RotatingIcon';
1817
import { GlobalContext } from '../shared/GlobalContext';
18+
import { LocalizedField } from '../types/vc';
1919

2020
export const VidItem: React.FC<VcItemProps> = (props) => {
2121
const { appService } = useContext(GlobalContext);
@@ -27,7 +27,6 @@ export const VidItem: React.FC<VcItemProps> = (props) => {
2727
);
2828
const service = useInterpret(machine.current);
2929
const uin = useSelector(service, selectId);
30-
const tag = useSelector(service, selectTag);
3130
const verifiableCredential = useSelector(service, selectVerifiableCredential);
3231
const generatedOn = useSelector(service, selectGeneratedOn);
3332

@@ -70,7 +69,7 @@ export const VidItem: React.FC<VcItemProps> = (props) => {
7069
: Theme.VidItemStyles.title
7170
}
7271
margin="0 0 6 0">
73-
{!verifiableCredential ? '' : tag || uin}
72+
{!verifiableCredential ? '' : uin}
7473
</Text>
7574
<Text
7675
size="smaller"

components/ui/.Modal.tsx.swp

-12 KB
Binary file not shown.
-12 KB
Binary file not shown.
-12 KB
Binary file not shown.
-12 KB
Binary file not shown.

components/ui/Modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { Dimensions, Modal as RNModal, View } from 'react-native';
2+
import { Modal as RNModal, View } from 'react-native';
33
import { Icon } from 'react-native-elements';
44
import { Column, Row, Text } from '.';
55
import { ElevationLevel, Theme } from './styleUtils';

0 commit comments

Comments
 (0)