Files
inji-wallet/components/Passcode.tsx
Alka Prasad 9b07e63383 [Inji 434 & INJI 441]: Add events in receiver VC sharing flow and cancel button handle (#990)
* refactor(INJI-434): rename some variables and functions to meaning names

Signed-off-by: Alka <prasadalka1998@gmail.com>

* feat(INJI-434): add telemetry events in the VC share flow on verifier end

Signed-off-by: Alka <prasadalka1998@gmail.com>

* fix(INJI-434): handle cancel button press during vc share

Signed-off-by: Alka <prasadalka1998@gmail.com>

* fix(INJI-441): handle cancel button press during vc share

Signed-off-by: Alka <prasadalka1998@gmail.com>

* refactor(INJI-434): extracts telemetry constants to a seperate file

Signed-off-by: Alka <prasadalka1998@gmail.com>

* refactor(INJI-434): remove unused imports

Signed-off-by: Alka <prasadalka1998@gmail.com>

* fix(INJI-441): update the CANCEL event on press of cancel button

Signed-off-by: Alka <prasadalka1998@gmail.com>

* refactor(INJI-434): update the method name

Signed-off-by: Alka <prasadalka1998@gmail.com>

---------

Signed-off-by: Alka <prasadalka1998@gmail.com>
Signed-off-by: Alka Prasad <Alka1703@users.noreply.github.com>
2023-11-07 10:43:39 +05:30

62 lines
1.7 KiB
TypeScript

import React, {useEffect} from 'react';
import {Modal as RNModal} from 'react-native';
import {Icon} from 'react-native-elements';
import {PasscodeVerify} from '../components/PasscodeVerify';
import {Column, Text} from '../components/ui';
import {Theme} from '../components/ui/styleUtils';
import {
getImpressionEventData,
sendImpressionEvent,
} from '../shared/telemetry/TelemetryUtils';
import {TelemetryConstants} from '../shared/telemetry/TelemetryConstants';
export const Passcode: React.FC<PasscodeProps> = props => {
useEffect(() => {
sendImpressionEvent(
getImpressionEventData(
TelemetryConstants.FlowType.appLogin,
TelemetryConstants.Screens.passcode,
),
);
}, []);
return (
<RNModal
animationType="slide"
style={Theme.PasscodeStyles.modal}
visible={true}
onRequestClose={props.onDismiss}>
<Column
fill
padding="32"
backgroundColor={Theme.Colors.whiteBackgroundColor}>
<Icon name="lock" color={Theme.Colors.Icon} size={60} />
<Column fill align="space-between" width="100%">
<Text align="center">{props.message || 'Enter your passcode'}</Text>
<PasscodeVerify
onSuccess={props.onSuccess}
onError={props.onError}
passcode={props.storedPasscode}
salt={props.salt}
/>
</Column>
<Column fill>
<Text align="center" color={Theme.Colors.errorMessage}>
{props.error}
</Text>
</Column>
</Column>
</RNModal>
);
};
interface PasscodeProps {
message?: string;
error: string;
storedPasscode: string;
salt: string;
onSuccess: () => void;
onError: (value: string) => void;
onDismiss: () => void;
}