Files
inji-wallet/components/ui/Modal.tsx
adityankannan-tw 339e08c462 [INJIMOB-1433,528] - Add passive liveness detection with blink detection (#1474)
* [INJIMOB-528] add liveness support for face verification

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-528] add and comment blink detection

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-528] update locales and remove blink detection

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-1433] add blinking and increase threshold if blinking is detected

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-1433] sync package lock json

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-1433] update node version to 18 for android build

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-1433] refactor

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-1433] refactor components

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-1433] use the default version of package resolved file

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-1433] refactor and add new env for liveness in workflow

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-1433] remove new env and unused code

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-1433] add new env for liveness and combine build descriptiona and build name

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-528] update package lock & pbxproj files

Signed-off-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com>

* [INJIMOB-1433] add test id for elements

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

---------

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>
Signed-off-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com>
Co-authored-by: adityankannan-tw <adityan410pm@gmail.com>
Co-authored-by: KiruthikaJeyashankar <81218987+KiruthikaJeyashankar@users.noreply.github.com>
2024-06-04 13:59:02 +05:30

110 lines
3.5 KiB
TypeScript

import React from 'react';
import {I18nManager, Modal as RNModal, View} from 'react-native';
import {Icon} from 'react-native-elements';
import {Column, Row, Text} from '.';
import {useSendVcScreen} from '../../screens/Scan/SendVcScreenController';
import {DeviceInfoList} from '../DeviceInfoList';
import {ElevationLevel, Theme} from './styleUtils';
import testIDProps from '../../shared/commonUtil';
import {BackButton} from './backButton/BackButton';
export const Modal: React.FC<ModalProps> = props => {
const controller = useSendVcScreen();
return (
<RNModal
{...testIDProps(props.testID)}
animationType="slide"
style={props.modalStyle}
visible={props.isVisible}
onShow={props.onShow}
onRequestClose={props.onDismiss}>
<Column {...(props.showHeader ? { fill: true, safe: true } : { fill: true })}>
{ props.showHeader ? (
<Row elevation={props.headerElevation}>
<View style={props.modalStyle}>
{props.headerRight && !props.arrowLeft ? (
<Icon
{...testIDProps('closeModal')}
name={I18nManager.isRTL ? 'chevron-right' : 'chevron-left'}
onPress={props.onDismiss}
color={Theme.Colors.Icon}
/>
) : null}
{props.arrowLeft && props.onDismiss ? (
<BackButton onPress={props.onDismiss} />
) : null}
<Row
fill
align={props.headerLeft ? 'flex-start' : 'center'}
margin={props.arrowLeft ? '16 0 0 -15' : '16 0 0 10'}>
<Column>
<Text testID={props.testID} style={Theme.TextStyles.header}>
{props.headerTitle || props.headerLeft}
</Text>
{!props.requester ? (
<Text
weight="semibold"
style={Theme.TextStyles.small}
color={
props.headerLabelColor
? props.headerLabelColor
: Theme.Colors.textLabel
}>
{props.headerLabel}
</Text>
) : (
<Text
weight="semibold"
style={Theme.TextStyles.small}
color={Theme.Colors.IconBg}>
<DeviceInfoList deviceInfo={controller.receiverInfo} />
</Text>
)}
</Column>
</Row>
{props.headerRight != null ||
props.arrowLeft ||
(props.showClose && (
<Icon
{...testIDProps('close')}
name="close"
onPress={props.onDismiss}
color={Theme.Colors.Details}
size={27}
/>
))}
{props.headerRight && props.headerRight}
</View>
</Row> ) : null}
{props.children}
</Column>
</RNModal>
);
};
Modal.defaultProps = {
modalStyle: Theme.ModalStyles.defaultModal,
showClose: true,
showHeader: true,
};
export interface ModalProps {
testID?: string;
isVisible: boolean;
requester?: boolean;
showClose?: boolean;
showHeader?: boolean;
modalStyle?: Object;
onDismiss?: () => void;
headerTitle?: string;
headerElevation?: ElevationLevel;
headerLabel?: string;
headerLabelColor?: string;
headerRight?: React.ReactElement;
headerLeft?: React.ReactElement;
arrowLeft?: boolean;
onShow?: () => void;
children?: React.ReactNode;
}