@ha_tecno/live-id-sdk 2.12.3 → 2.14.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/commonjs/@types/declarations.d.js +2 -0
- package/lib/commonjs/@types/declarations.d.js.map +1 -0
- package/lib/commonjs/assets/svg/exampleCalibration1.svg +9 -0
- package/lib/commonjs/assets/svg/exampleCalibration2.svg +9 -0
- package/lib/commonjs/assets/svg/fingerPrint.svg +30 -0
- package/lib/commonjs/assets/svg/fingerPrintWithMask.svg +34 -0
- package/lib/commonjs/assets/svg/selfieStick.svg +167 -0
- package/lib/commonjs/components/HACaptureInstructions/HACaptureInstructions.js +52 -0
- package/lib/commonjs/components/HACaptureInstructions/HACaptureInstructions.js.map +1 -0
- package/lib/commonjs/components/HACaptureInstructions/HACard/HACard.js +49 -0
- package/lib/commonjs/components/HACaptureInstructions/HACard/HACard.js.map +1 -0
- package/lib/commonjs/components/HACaptureInstructions/HACard/styles.js +37 -0
- package/lib/commonjs/components/HACaptureInstructions/HACard/styles.js.map +1 -0
- package/lib/commonjs/components/HACaptureInstructions/data.js +25 -0
- package/lib/commonjs/components/HACaptureInstructions/data.js.map +1 -0
- package/lib/commonjs/components/HACaptureInstructions/style.js +32 -0
- package/lib/commonjs/components/HACaptureInstructions/style.js.map +1 -0
- package/lib/commonjs/components/HACarouselCalibration/HACarouselCalibration.js +81 -0
- package/lib/commonjs/components/HACarouselCalibration/HACarouselCalibration.js.map +1 -0
- package/lib/commonjs/components/HACarouselCalibration/HACarouselItem/HACarouselItem.js +81 -0
- package/lib/commonjs/components/HACarouselCalibration/HACarouselItem/HACarouselItem.js.map +1 -0
- package/lib/commonjs/components/HACarouselCalibration/HACarouselItem/styles.js +49 -0
- package/lib/commonjs/components/HACarouselCalibration/HACarouselItem/styles.js.map +1 -0
- package/lib/commonjs/components/HACarouselCalibration/HAPagination/HAPagination.js +46 -0
- package/lib/commonjs/components/HACarouselCalibration/HAPagination/HAPagination.js.map +1 -0
- package/lib/commonjs/components/HACarouselCalibration/HAPagination/styles.js +22 -0
- package/lib/commonjs/components/HACarouselCalibration/HAPagination/styles.js.map +1 -0
- package/lib/commonjs/components/HACarouselCalibration/data.js +28 -0
- package/lib/commonjs/components/HACarouselCalibration/data.js.map +1 -0
- package/lib/commonjs/components/Typograph/typograph.js +28 -0
- package/lib/commonjs/components/Typograph/typograph.js.map +1 -0
- package/lib/commonjs/components/index.js +28 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/index.js +25 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/screens/RegisterOperations/registerOperationPointsBiometrics.js +185 -0
- package/lib/commonjs/screens/RegisterOperations/registerOperationPointsBiometrics.js.map +1 -0
- package/lib/commonjs/screens/RegisterOperations/registerOperationPointsLifeCertificate.js +165 -0
- package/lib/commonjs/screens/RegisterOperations/registerOperationPointsLifeCertificate.js.map +1 -0
- package/lib/commonjs/screens/RegisterOperations/styles.js +47 -0
- package/lib/commonjs/screens/RegisterOperations/styles.js.map +1 -0
- package/lib/commonjs/screens/index.js +14 -0
- package/lib/commonjs/screens/index.js.map +1 -1
- package/lib/commonjs/services/index.js +18 -0
- package/lib/commonjs/services/index.js.map +1 -1
- package/lib/commonjs/services/services.js +106 -1
- package/lib/commonjs/services/services.js.map +1 -1
- package/lib/commonjs/store/modules/operationPoints/index.js +19 -0
- package/lib/commonjs/store/modules/operationPoints/index.js.map +1 -0
- package/lib/commonjs/store/modules/operationPoints/selectors.js +13 -0
- package/lib/commonjs/store/modules/operationPoints/selectors.js.map +1 -0
- package/lib/commonjs/store/modules/operationPoints/slice.js +233 -0
- package/lib/commonjs/store/modules/operationPoints/slice.js.map +1 -0
- package/lib/commonjs/store/modules/operationPoints/types.js +2 -0
- package/lib/commonjs/store/modules/operationPoints/types.js.map +1 -0
- package/lib/commonjs/theme/colors.js +19 -0
- package/lib/commonjs/theme/colors.js.map +1 -0
- package/lib/commonjs/theme/theme.js +25 -0
- package/lib/commonjs/theme/theme.js.map +1 -0
- package/lib/commonjs/utils/index.js +12 -0
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/utils.js +9 -1
- package/lib/commonjs/utils/utils.js.map +1 -1
- package/lib/module/@types/declarations.d.js +2 -0
- package/lib/module/@types/declarations.d.js.map +1 -0
- package/lib/module/assets/svg/exampleCalibration1.svg +9 -0
- package/lib/module/assets/svg/exampleCalibration2.svg +9 -0
- package/lib/module/assets/svg/fingerPrint.svg +30 -0
- package/lib/module/assets/svg/fingerPrintWithMask.svg +34 -0
- package/lib/module/assets/svg/selfieStick.svg +167 -0
- package/lib/module/components/HACaptureInstructions/HACaptureInstructions.js +45 -0
- package/lib/module/components/HACaptureInstructions/HACaptureInstructions.js.map +1 -0
- package/lib/module/components/HACaptureInstructions/HACard/HACard.js +41 -0
- package/lib/module/components/HACaptureInstructions/HACard/HACard.js.map +1 -0
- package/lib/module/components/HACaptureInstructions/HACard/styles.js +31 -0
- package/lib/module/components/HACaptureInstructions/HACard/styles.js.map +1 -0
- package/lib/module/components/HACaptureInstructions/data.js +18 -0
- package/lib/module/components/HACaptureInstructions/data.js.map +1 -0
- package/lib/module/components/HACaptureInstructions/style.js +26 -0
- package/lib/module/components/HACaptureInstructions/style.js.map +1 -0
- package/lib/module/components/HACarouselCalibration/HACarouselCalibration.js +72 -0
- package/lib/module/components/HACarouselCalibration/HACarouselCalibration.js.map +1 -0
- package/lib/module/components/HACarouselCalibration/HACarouselItem/HACarouselItem.js +73 -0
- package/lib/module/components/HACarouselCalibration/HACarouselItem/HACarouselItem.js.map +1 -0
- package/lib/module/components/HACarouselCalibration/HACarouselItem/styles.js +44 -0
- package/lib/module/components/HACarouselCalibration/HACarouselItem/styles.js.map +1 -0
- package/lib/module/components/HACarouselCalibration/HAPagination/HAPagination.js +36 -0
- package/lib/module/components/HACarouselCalibration/HAPagination/HAPagination.js.map +1 -0
- package/lib/module/components/HACarouselCalibration/HAPagination/styles.js +16 -0
- package/lib/module/components/HACarouselCalibration/HAPagination/styles.js.map +1 -0
- package/lib/module/components/HACarouselCalibration/data.js +21 -0
- package/lib/module/components/HACarouselCalibration/data.js.map +1 -0
- package/lib/module/components/Typograph/typograph.js +21 -0
- package/lib/module/components/Typograph/typograph.js.map +1 -0
- package/lib/module/components/index.js +5 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/index.js +3 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/screens/RegisterOperations/registerOperationPointsBiometrics.js +176 -0
- package/lib/module/screens/RegisterOperations/registerOperationPointsBiometrics.js.map +1 -0
- package/lib/module/screens/RegisterOperations/registerOperationPointsLifeCertificate.js +157 -0
- package/lib/module/screens/RegisterOperations/registerOperationPointsLifeCertificate.js.map +1 -0
- package/lib/module/screens/RegisterOperations/styles.js +41 -0
- package/lib/module/screens/RegisterOperations/styles.js.map +1 -0
- package/lib/module/screens/index.js +3 -1
- package/lib/module/screens/index.js.map +1 -1
- package/lib/module/services/index.js +2 -2
- package/lib/module/services/index.js.map +1 -1
- package/lib/module/services/services.js +102 -0
- package/lib/module/services/services.js.map +1 -1
- package/lib/module/store/modules/operationPoints/index.js +3 -0
- package/lib/module/store/modules/operationPoints/index.js.map +1 -0
- package/lib/module/store/modules/operationPoints/selectors.js +6 -0
- package/lib/module/store/modules/operationPoints/selectors.js.map +1 -0
- package/lib/module/store/modules/operationPoints/slice.js +227 -0
- package/lib/module/store/modules/operationPoints/slice.js.map +1 -0
- package/lib/module/store/modules/operationPoints/types.js +2 -0
- package/lib/module/store/modules/operationPoints/types.js.map +1 -0
- package/lib/module/theme/colors.js +14 -0
- package/lib/module/theme/colors.js.map +1 -0
- package/lib/module/theme/theme.js +18 -0
- package/lib/module/theme/theme.js.map +1 -0
- package/lib/module/utils/index.js +2 -2
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/utils.js +7 -1
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/typescript/src/components/HACaptureInstructions/HACaptureInstructions.d.ts +8 -0
- package/lib/typescript/src/components/HACaptureInstructions/HACaptureInstructions.d.ts.map +1 -0
- package/lib/typescript/src/components/HACaptureInstructions/HACard/HACard.d.ts +11 -0
- package/lib/typescript/src/components/HACaptureInstructions/HACard/HACard.d.ts.map +1 -0
- package/lib/typescript/src/components/HACaptureInstructions/HACard/styles.d.ts +27 -0
- package/lib/typescript/src/components/HACaptureInstructions/HACard/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/HACaptureInstructions/data.d.ts +9 -0
- package/lib/typescript/src/components/HACaptureInstructions/data.d.ts.map +1 -0
- package/lib/typescript/src/components/HACaptureInstructions/style.d.ts +25 -0
- package/lib/typescript/src/components/HACaptureInstructions/style.d.ts.map +1 -0
- package/lib/typescript/src/components/HACarouselCalibration/HACarouselCalibration.d.ts +7 -0
- package/lib/typescript/src/components/HACarouselCalibration/HACarouselCalibration.d.ts.map +1 -0
- package/lib/typescript/src/components/HACarouselCalibration/HACarouselItem/HACarouselItem.d.ts +17 -0
- package/lib/typescript/src/components/HACarouselCalibration/HACarouselItem/HACarouselItem.d.ts.map +1 -0
- package/lib/typescript/src/components/HACarouselCalibration/HACarouselItem/styles.d.ts +39 -0
- package/lib/typescript/src/components/HACarouselCalibration/HACarouselItem/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/HACarouselCalibration/HAPagination/HAPagination.d.ts +14 -0
- package/lib/typescript/src/components/HACarouselCalibration/HAPagination/HAPagination.d.ts.map +1 -0
- package/lib/typescript/src/components/HACarouselCalibration/HAPagination/styles.d.ts +15 -0
- package/lib/typescript/src/components/HACarouselCalibration/HAPagination/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/HACarouselCalibration/data.d.ts +9 -0
- package/lib/typescript/src/components/HACarouselCalibration/data.d.ts.map +1 -0
- package/lib/typescript/src/components/Typograph/typograph.d.ts +10 -0
- package/lib/typescript/src/components/Typograph/typograph.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +5 -1
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/screens/RegisterOperations/registerOperationPointsBiometrics.d.ts +7 -0
- package/lib/typescript/src/screens/RegisterOperations/registerOperationPointsBiometrics.d.ts.map +1 -0
- package/lib/typescript/src/screens/RegisterOperations/registerOperationPointsLifeCertificate.d.ts +7 -0
- package/lib/typescript/src/screens/RegisterOperations/registerOperationPointsLifeCertificate.d.ts.map +1 -0
- package/lib/typescript/src/screens/RegisterOperations/styles.d.ts +40 -0
- package/lib/typescript/src/screens/RegisterOperations/styles.d.ts.map +1 -0
- package/lib/typescript/src/screens/index.d.ts +3 -1
- package/lib/typescript/src/screens/index.d.ts.map +1 -1
- package/lib/typescript/src/services/index.d.ts +2 -2
- package/lib/typescript/src/services/index.d.ts.map +1 -1
- package/lib/typescript/src/services/services.d.ts +4 -1
- package/lib/typescript/src/services/services.d.ts.map +1 -1
- package/lib/typescript/src/services/types.d.ts +29 -0
- package/lib/typescript/src/services/types.d.ts.map +1 -1
- package/lib/typescript/src/store/modules/operationPoints/index.d.ts +3 -0
- package/lib/typescript/src/store/modules/operationPoints/index.d.ts.map +1 -0
- package/lib/typescript/src/store/modules/operationPoints/selectors.d.ts +24 -0
- package/lib/typescript/src/store/modules/operationPoints/selectors.d.ts.map +1 -0
- package/lib/typescript/src/store/modules/operationPoints/slice.d.ts +4 -0
- package/lib/typescript/src/store/modules/operationPoints/slice.d.ts.map +1 -0
- package/lib/typescript/src/store/modules/operationPoints/types.d.ts +51 -0
- package/lib/typescript/src/store/modules/operationPoints/types.d.ts.map +1 -0
- package/lib/typescript/src/theme/colors.d.ts +14 -0
- package/lib/typescript/src/theme/colors.d.ts.map +1 -0
- package/lib/typescript/src/theme/theme.d.ts +8 -0
- package/lib/typescript/src/theme/theme.d.ts.map +1 -0
- package/lib/typescript/src/utils/index.d.ts +2 -2
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/utils.d.ts +3 -1
- package/lib/typescript/src/utils/utils.d.ts.map +1 -1
- package/package.json +4 -1
- package/src/@types/declarations.d.ts +5 -0
- package/src/assets/svg/exampleCalibration1.svg +9 -0
- package/src/assets/svg/exampleCalibration2.svg +9 -0
- package/src/assets/svg/fingerPrint.svg +30 -0
- package/src/assets/svg/fingerPrintWithMask.svg +34 -0
- package/src/assets/svg/selfieStick.svg +167 -0
- package/src/components/HACaptureInstructions/HACaptureInstructions.tsx +36 -0
- package/src/components/HACaptureInstructions/HACard/HACard.tsx +34 -0
- package/src/components/HACaptureInstructions/HACard/styles.ts +30 -0
- package/src/components/HACaptureInstructions/data.ts +23 -0
- package/src/components/HACaptureInstructions/style.ts +17 -0
- package/src/components/HACarouselCalibration/HACarouselCalibration.tsx +71 -0
- package/src/components/HACarouselCalibration/HACarouselItem/HACarouselItem.tsx +53 -0
- package/src/components/HACarouselCalibration/HACarouselItem/styles.ts +43 -0
- package/src/components/HACarouselCalibration/HAPagination/HAPagination.tsx +51 -0
- package/src/components/HACarouselCalibration/HAPagination/styles.ts +16 -0
- package/src/components/HACarouselCalibration/data.ts +27 -0
- package/src/components/Typograph/typograph.tsx +24 -0
- package/src/components/index.ts +16 -1
- package/src/index.tsx +18 -2
- package/src/screens/RegisterOperations/registerOperationPointsBiometrics.tsx +168 -0
- package/src/screens/RegisterOperations/registerOperationPointsLifeCertificate.tsx +175 -0
- package/src/screens/RegisterOperations/styles.ts +41 -0
- package/src/screens/index.ts +9 -1
- package/src/services/index.ts +18 -2
- package/src/services/services.ts +113 -1
- package/src/services/types.ts +33 -0
- package/src/store/modules/operationPoints/index.ts +3 -0
- package/src/store/modules/operationPoints/selectors.ts +7 -0
- package/src/store/modules/operationPoints/slice.ts +240 -0
- package/src/store/modules/operationPoints/types.ts +61 -0
- package/src/theme/colors.ts +15 -0
- package/src/theme/theme.ts +13 -0
- package/src/utils/index.ts +2 -2
- package/src/utils/utils.ts +9 -1
@@ -0,0 +1,43 @@
|
|
1
|
+
import { Dimensions } from "react-native";
|
2
|
+
import { StyleSheet } from "react-native";
|
3
|
+
|
4
|
+
const { width } = Dimensions.get("window");
|
5
|
+
|
6
|
+
export const styles = StyleSheet.create({
|
7
|
+
container: {
|
8
|
+
flex: 1,
|
9
|
+
width,
|
10
|
+
justifyContent: "center",
|
11
|
+
alignItems: "center",
|
12
|
+
padding: 20
|
13
|
+
},
|
14
|
+
card: {
|
15
|
+
justifyContent: "center",
|
16
|
+
minHeight: "60%",
|
17
|
+
borderRadius: 20,
|
18
|
+
gap: 20,
|
19
|
+
padding: 20
|
20
|
+
},
|
21
|
+
content: {
|
22
|
+
alignItems: "center",
|
23
|
+
justifyContent: "center",
|
24
|
+
gap: 20
|
25
|
+
},
|
26
|
+
title: {
|
27
|
+
textAlign: "center"
|
28
|
+
},
|
29
|
+
text: {
|
30
|
+
textAlign: "center"
|
31
|
+
},
|
32
|
+
containerPagination: {
|
33
|
+
alignSelf: "center"
|
34
|
+
},
|
35
|
+
containerButton: {
|
36
|
+
height: 80,
|
37
|
+
width: 80,
|
38
|
+
alignSelf: "center",
|
39
|
+
justifyContent: "center",
|
40
|
+
alignItems: "center",
|
41
|
+
borderRadius: 50
|
42
|
+
}
|
43
|
+
});
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Dimensions, View } from "react-native";
|
3
|
+
import Animated, { Extrapolation, SharedValue, interpolate, useAnimatedStyle } from "react-native-reanimated";
|
4
|
+
import { useTheme } from "../../../theme/theme";
|
5
|
+
import { styles } from "./styles";
|
6
|
+
|
7
|
+
type PaginationType = {
|
8
|
+
item: {
|
9
|
+
title: string;
|
10
|
+
text: string;
|
11
|
+
ImageComponent?: React.FC<React.SVGProps<SVGSVGElement>>;
|
12
|
+
}[];
|
13
|
+
paginationIndex: number;
|
14
|
+
scrollX: SharedValue<number>;
|
15
|
+
};
|
16
|
+
|
17
|
+
const { width } = Dimensions.get("screen");
|
18
|
+
|
19
|
+
export const HAPagination = ({ item, paginationIndex, scrollX }: PaginationType) => {
|
20
|
+
const { blue, isDark } = useTheme();
|
21
|
+
const dotWithoutFocused = isDark ? "#ffffff25" : "#00000025";
|
22
|
+
|
23
|
+
return (
|
24
|
+
<View style={styles.container}>
|
25
|
+
{item.map((_, index) => {
|
26
|
+
const pgAnimationStyle = useAnimatedStyle(() => {
|
27
|
+
const dotWidth = interpolate(
|
28
|
+
scrollX.value,
|
29
|
+
[(index - 1) * width, index * width, (index + 1) * width],
|
30
|
+
[8, 30, 8],
|
31
|
+
Extrapolation.CLAMP
|
32
|
+
);
|
33
|
+
return { width: dotWidth };
|
34
|
+
});
|
35
|
+
|
36
|
+
return (
|
37
|
+
<Animated.View
|
38
|
+
key={index}
|
39
|
+
style={[
|
40
|
+
{
|
41
|
+
backgroundColor: paginationIndex === index ? blue : dotWithoutFocused
|
42
|
+
},
|
43
|
+
styles.pagination,
|
44
|
+
pgAnimationStyle
|
45
|
+
]}
|
46
|
+
/>
|
47
|
+
);
|
48
|
+
})}
|
49
|
+
</View>
|
50
|
+
);
|
51
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { StyleSheet } from "react-native";
|
2
|
+
|
3
|
+
export const styles = StyleSheet.create({
|
4
|
+
container: {
|
5
|
+
flexDirection: "row",
|
6
|
+
height: 60,
|
7
|
+
justifyContent: "center",
|
8
|
+
alignItems: "center"
|
9
|
+
},
|
10
|
+
pagination: {
|
11
|
+
height: 8,
|
12
|
+
width: 8,
|
13
|
+
marginHorizontal: 2,
|
14
|
+
borderRadius: 8
|
15
|
+
}
|
16
|
+
});
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import ExampleCalibration1 from "../../assets/svg/exampleCalibration1.svg";
|
2
|
+
import ExampleCalibration2 from "../../assets/svg/exampleCalibration2.svg";
|
3
|
+
import FingerPrint from "../../assets/svg/fingerPrint.svg";
|
4
|
+
|
5
|
+
const data: { title: string; ImageComponent?: React.FC<React.SVGProps<SVGSVGElement>>; text: string }[] = [
|
6
|
+
{
|
7
|
+
title: "BOAS VINDAS AO LIVEID",
|
8
|
+
text: `Antes de começarmos, precisamos garantir que seu dispositivo esteja configurado para a melhor experiência possível.\n\nSiga as etapas a seguir para calibrar a captura no seu aparelho.`
|
9
|
+
},
|
10
|
+
{
|
11
|
+
title: "Preparando para a captura perfeita!",
|
12
|
+
ImageComponent: ExampleCalibration1,
|
13
|
+
text: "Para garantir uma leitura precisa, escolha um fundo neutro, como uma parede lisa ou até mesmo uma folha de papel."
|
14
|
+
},
|
15
|
+
{
|
16
|
+
title: "Posicione-se para a melhor leitura!",
|
17
|
+
ImageComponent: ExampleCalibration2,
|
18
|
+
text: "Coloque o dedo indicador direito sobre o diagrama vermelho. Ajuste o zoom, se necessário, para um melhor encaixe."
|
19
|
+
},
|
20
|
+
{
|
21
|
+
title: "Finalizando a calibração!",
|
22
|
+
ImageComponent: FingerPrint,
|
23
|
+
text: "Certifique-se de que sua digital está bem focada. Testaremos diferentes iluminações — se a tela escurecer, não se preocupe, faz parte do processo!"
|
24
|
+
}
|
25
|
+
];
|
26
|
+
|
27
|
+
export default data;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Text, TextStyle, useColorScheme } from "react-native";
|
3
|
+
import { RFValue } from "react-native-responsive-fontsize";
|
4
|
+
|
5
|
+
type Props = {
|
6
|
+
children: string | string[] | undefined;
|
7
|
+
bold?: boolean;
|
8
|
+
style?: TextStyle;
|
9
|
+
};
|
10
|
+
|
11
|
+
const HAText = ({ children, bold, style }: Props) => {
|
12
|
+
const isDark = useColorScheme() === "dark";
|
13
|
+
|
14
|
+
const textStyle: TextStyle = {
|
15
|
+
fontWeight: bold ? "bold" : "normal",
|
16
|
+
color: isDark ? "white" : "black",
|
17
|
+
fontSize: RFValue(16),
|
18
|
+
...style
|
19
|
+
};
|
20
|
+
|
21
|
+
return <Text style={textStyle}>{children}</Text>;
|
22
|
+
};
|
23
|
+
|
24
|
+
export default HAText;
|
package/src/components/index.ts
CHANGED
@@ -4,5 +4,20 @@ import RecordButton from "./recordButton/recordButton";
|
|
4
4
|
import CaptureButton from "./CaptureButton";
|
5
5
|
import CameraConfigInfo from "./CameraConfigInfo";
|
6
6
|
import Gabarito from "./Gabarito";
|
7
|
+
import HAText from "./Typograph/typograph";
|
8
|
+
import Icon from "./icon/icon";
|
9
|
+
import HACarouselCalibration from "./HACarouselCalibration/HACarouselCalibration";
|
10
|
+
import HACaptureInstructions from "./HACaptureInstructions/HACaptureInstructions";
|
7
11
|
|
8
|
-
export {
|
12
|
+
export {
|
13
|
+
DeviceNotFound,
|
14
|
+
ModalMessage,
|
15
|
+
RecordButton,
|
16
|
+
CaptureButton,
|
17
|
+
CameraConfigInfo,
|
18
|
+
Gabarito,
|
19
|
+
HAText,
|
20
|
+
Icon,
|
21
|
+
HACarouselCalibration,
|
22
|
+
HACaptureInstructions
|
23
|
+
};
|
package/src/index.tsx
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
LifeCertificate,
|
3
|
+
FingerRegister,
|
4
|
+
FingerAuth,
|
5
|
+
RegisterOperationPointsBiometrics,
|
6
|
+
RegisterOperationPointsLifeCertificate
|
7
|
+
} from "./screens";
|
2
8
|
|
3
|
-
|
9
|
+
import { HACarouselCalibration, HACaptureInstructions } from "./components";
|
10
|
+
|
11
|
+
export {
|
12
|
+
LifeCertificate,
|
13
|
+
FingerRegister,
|
14
|
+
FingerAuth,
|
15
|
+
RegisterOperationPointsBiometrics,
|
16
|
+
RegisterOperationPointsLifeCertificate,
|
17
|
+
HACarouselCalibration,
|
18
|
+
HACaptureInstructions
|
19
|
+
};
|
@@ -0,0 +1,168 @@
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from "react";
|
2
|
+
import { ActivityIndicator, Alert, BackHandler, Modal, View, useColorScheme } from "react-native";
|
3
|
+
import { Camera, Point, useCameraDevice, useCameraFormat, useCameraPermission } from "react-native-vision-camera";
|
4
|
+
import { runOnJS } from "react-native-reanimated";
|
5
|
+
import { Gesture, GestureDetector, GestureHandlerRootView } from "react-native-gesture-handler";
|
6
|
+
import { readFile } from "react-native-fs";
|
7
|
+
import Slider from "@react-native-community/slider";
|
8
|
+
|
9
|
+
import { useDispatch, useSelector } from "../../store/modules/operationPoints";
|
10
|
+
import { scale0to1Inverse, useIsForeground } from "../../utils";
|
11
|
+
import { CaptureButton, DeviceNotFound, Gabarito, HAText } from "../../components";
|
12
|
+
import { styles } from "./styles";
|
13
|
+
|
14
|
+
type Props = {
|
15
|
+
onSuccess: () => void;
|
16
|
+
};
|
17
|
+
|
18
|
+
const RegisterOperationPointsBiometrics = ({ onSuccess }: Props) => {
|
19
|
+
const isDark = useColorScheme() === "dark";
|
20
|
+
const backgroundColor = isDark ? "black" : "white";
|
21
|
+
const [zoom, setZoom] = useState<number>(2);
|
22
|
+
const [torch, setTorch] = useState<"off" | "on">("off");
|
23
|
+
const dispatch = useDispatch();
|
24
|
+
const { hasPermission, requestPermission } = useCameraPermission();
|
25
|
+
const cameraRef = useRef<Camera>(null);
|
26
|
+
const isForeground = useIsForeground();
|
27
|
+
const isActive = isForeground;
|
28
|
+
|
29
|
+
const { loading, exposureScaleZeroToOneBiometrics, message, base64Images } = useSelector();
|
30
|
+
const imagesCount = base64Images.length;
|
31
|
+
|
32
|
+
const containerCaptureStyled = [styles.containerCapture, { bottom: 20 }];
|
33
|
+
|
34
|
+
const device = useCameraDevice("back");
|
35
|
+
const cameraFormat = useCameraFormat(device, [
|
36
|
+
{
|
37
|
+
photoResolution: {
|
38
|
+
width: 1280,
|
39
|
+
height: 720
|
40
|
+
}
|
41
|
+
}
|
42
|
+
]);
|
43
|
+
|
44
|
+
const cameraPermission = useCallback(async () => {
|
45
|
+
if (!hasPermission) {
|
46
|
+
await requestPermission();
|
47
|
+
}
|
48
|
+
}, [hasPermission, requestPermission]);
|
49
|
+
|
50
|
+
useEffect(() => {
|
51
|
+
cameraPermission();
|
52
|
+
}, [cameraPermission]);
|
53
|
+
|
54
|
+
useEffect(() => {
|
55
|
+
if (imagesCount === 3 && device != null) {
|
56
|
+
dispatch.sendImagesBase64({
|
57
|
+
base64Images,
|
58
|
+
exposureScaleZeroToOneBiometrics,
|
59
|
+
exposureMin: device.minExposure,
|
60
|
+
exposureMax: device.maxExposure,
|
61
|
+
zoomMin: device.minZoom,
|
62
|
+
zoomMax: device.maxZoom
|
63
|
+
});
|
64
|
+
}
|
65
|
+
}, [imagesCount, device, dispatch]);
|
66
|
+
|
67
|
+
const takePhoto = async () => {
|
68
|
+
const photo = await cameraRef.current?.takePhoto();
|
69
|
+
if (photo != null) {
|
70
|
+
const imageBase64 = await readFile(photo.path, "base64");
|
71
|
+
dispatch.setImageBase64(imageBase64);
|
72
|
+
}
|
73
|
+
};
|
74
|
+
|
75
|
+
const focus = useCallback((point: Point) => {
|
76
|
+
const camera = cameraRef.current;
|
77
|
+
if (camera != null) {
|
78
|
+
camera.focus(point);
|
79
|
+
}
|
80
|
+
}, []);
|
81
|
+
|
82
|
+
const gesture = Gesture.Tap().onBegin(({ x, y }) => {
|
83
|
+
runOnJS(focus)({ x, y });
|
84
|
+
});
|
85
|
+
|
86
|
+
useEffect(() => {
|
87
|
+
if (loading === "succeeded") {
|
88
|
+
Alert.alert("Sucesso", message, [{ text: "OK", onPress: () => onSuccess && onSuccess() }]);
|
89
|
+
}
|
90
|
+
if (loading === "failed") {
|
91
|
+
Alert.alert("Continue", message, [
|
92
|
+
{
|
93
|
+
text: "OK",
|
94
|
+
onPress: () => dispatch.changeExposureBiometrics()
|
95
|
+
}
|
96
|
+
]);
|
97
|
+
}
|
98
|
+
}, [loading, message, dispatch]);
|
99
|
+
|
100
|
+
const backAction = () => {
|
101
|
+
const exit = BackHandler.exitApp;
|
102
|
+
Alert.alert("Atenção!", "Tem certeza que deseja sair?", [
|
103
|
+
{
|
104
|
+
text: "Cancelar",
|
105
|
+
onPress: () => null,
|
106
|
+
style: "cancel"
|
107
|
+
},
|
108
|
+
{ text: "Sim", onPress: exit }
|
109
|
+
]);
|
110
|
+
return true;
|
111
|
+
};
|
112
|
+
|
113
|
+
useEffect(
|
114
|
+
useCallback(() => {
|
115
|
+
const onBackPress = () => {
|
116
|
+
backAction();
|
117
|
+
return true;
|
118
|
+
};
|
119
|
+
BackHandler.addEventListener("hardwareBackPress", onBackPress);
|
120
|
+
return () => {
|
121
|
+
BackHandler.removeEventListener("hardwareBackPress", onBackPress);
|
122
|
+
};
|
123
|
+
}, [backAction])
|
124
|
+
);
|
125
|
+
|
126
|
+
const onInitialized = () => setTorch("on");
|
127
|
+
|
128
|
+
if (device == null || hasPermission === false)
|
129
|
+
return <DeviceNotFound hasPermission cameraPermission={cameraPermission} />;
|
130
|
+
|
131
|
+
return (
|
132
|
+
<GestureHandlerRootView style={{ flex: 1 }}>
|
133
|
+
<GestureDetector gesture={gesture}>
|
134
|
+
<View style={styles.containerCamera}>
|
135
|
+
<Camera
|
136
|
+
ref={cameraRef}
|
137
|
+
device={device}
|
138
|
+
style={styles.camera}
|
139
|
+
format={cameraFormat}
|
140
|
+
isActive={isActive}
|
141
|
+
torch={torch}
|
142
|
+
exposure={scale0to1Inverse(exposureScaleZeroToOneBiometrics, device.minExposure, device.maxExposure)}
|
143
|
+
zoom={zoom}
|
144
|
+
onInitialized={onInitialized}
|
145
|
+
photo
|
146
|
+
/>
|
147
|
+
<Gabarito />
|
148
|
+
</View>
|
149
|
+
</GestureDetector>
|
150
|
+
<View style={containerCaptureStyled}>
|
151
|
+
<CaptureButton onPress={takePhoto} imagesCount={imagesCount} />
|
152
|
+
</View>
|
153
|
+
<View style={[styles.containerSlider, { backgroundColor }]}>
|
154
|
+
<HAText bold>{`Ponto de operação`}</HAText>
|
155
|
+
<Slider maximumValue={4} minimumValue={2} value={zoom} onValueChange={(value) => setZoom(value)} step={1} />
|
156
|
+
</View>
|
157
|
+
{loading === "pending" && (
|
158
|
+
<Modal animationType="fade" transparent visible={true}>
|
159
|
+
<View style={styles.containerModalLoading}>
|
160
|
+
<ActivityIndicator size="large" color="#fff" />
|
161
|
+
</View>
|
162
|
+
</Modal>
|
163
|
+
)}
|
164
|
+
</GestureHandlerRootView>
|
165
|
+
);
|
166
|
+
};
|
167
|
+
|
168
|
+
export default RegisterOperationPointsBiometrics;
|
@@ -0,0 +1,175 @@
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from "react";
|
2
|
+
import { ActivityIndicator, Alert, BackHandler, Modal, View } from "react-native";
|
3
|
+
import { Camera, useCameraDevice, useCameraFormat, useCameraPermission } from "react-native-vision-camera";
|
4
|
+
|
5
|
+
import { useDispatch, useSelector } from "../../store/modules/operationPoints";
|
6
|
+
import { scale0to1Inverse, useIsForeground } from "../../utils";
|
7
|
+
import { DeviceNotFound, RecordButton } from "../../components";
|
8
|
+
import { styles } from "./styles";
|
9
|
+
|
10
|
+
type Props = {
|
11
|
+
onSuccess: () => void;
|
12
|
+
};
|
13
|
+
|
14
|
+
const RegisterOperationPointsLifeCertificate = ({ onSuccess }: Props) => {
|
15
|
+
const [torch, setTorch] = useState<"off" | "on">("off");
|
16
|
+
const dispatch = useDispatch();
|
17
|
+
const { hasPermission, requestPermission } = useCameraPermission();
|
18
|
+
const cameraRef = useRef<Camera>(null);
|
19
|
+
const isForeground = useIsForeground();
|
20
|
+
const isActive = isForeground;
|
21
|
+
|
22
|
+
const [intervalState, setIntervalState] = useState<NodeJS.Timeout | null>(null);
|
23
|
+
const [timer, setTimer] = useState(10);
|
24
|
+
const [isRecord, setIsRecord] = useState(false);
|
25
|
+
|
26
|
+
const { loading, registered, exposureScaleZeroToOneLifeCertificate, message } = useSelector();
|
27
|
+
|
28
|
+
const device = useCameraDevice("back");
|
29
|
+
const cameraFormat = useCameraFormat(device, [
|
30
|
+
{
|
31
|
+
videoResolution: {
|
32
|
+
width: 1280,
|
33
|
+
height: 720
|
34
|
+
}
|
35
|
+
}
|
36
|
+
]);
|
37
|
+
const exposure = scale0to1Inverse(
|
38
|
+
exposureScaleZeroToOneLifeCertificate,
|
39
|
+
device !== undefined ? device.minExposure : 0,
|
40
|
+
device !== undefined ? device.maxExposure : 0
|
41
|
+
);
|
42
|
+
|
43
|
+
const cameraPermission = useCallback(async () => {
|
44
|
+
if (!hasPermission) {
|
45
|
+
await requestPermission();
|
46
|
+
}
|
47
|
+
}, [hasPermission, requestPermission]);
|
48
|
+
|
49
|
+
useEffect(() => {
|
50
|
+
cameraPermission();
|
51
|
+
}, [cameraPermission]);
|
52
|
+
|
53
|
+
useEffect(() => {
|
54
|
+
if (loading === "succeeded") {
|
55
|
+
Alert.alert("Sucesso", message, [
|
56
|
+
{
|
57
|
+
text: "OK",
|
58
|
+
onPress: () => {
|
59
|
+
registered ? () => onSuccess && onSuccess() : null;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
]);
|
63
|
+
}
|
64
|
+
if (loading === "failed") {
|
65
|
+
Alert.alert("Continue", message, [
|
66
|
+
{
|
67
|
+
text: "OK",
|
68
|
+
onPress: () => dispatch.changeExposureLifeCertificate()
|
69
|
+
}
|
70
|
+
]);
|
71
|
+
}
|
72
|
+
setTimer(10);
|
73
|
+
}, [loading, message, dispatch]);
|
74
|
+
|
75
|
+
const backAction = () => {
|
76
|
+
const exit = BackHandler.exitApp;
|
77
|
+
Alert.alert("Atenção!", "Tem certeza que deseja sair?", [
|
78
|
+
{
|
79
|
+
text: "Cancelar",
|
80
|
+
onPress: () => null,
|
81
|
+
style: "cancel"
|
82
|
+
},
|
83
|
+
{ text: "Sim", onPress: exit }
|
84
|
+
]);
|
85
|
+
return true;
|
86
|
+
};
|
87
|
+
|
88
|
+
useEffect(
|
89
|
+
useCallback(() => {
|
90
|
+
const onBackPress = () => {
|
91
|
+
backAction();
|
92
|
+
return true;
|
93
|
+
};
|
94
|
+
BackHandler.addEventListener("hardwareBackPress", onBackPress);
|
95
|
+
return () => {
|
96
|
+
BackHandler.removeEventListener("hardwareBackPress", onBackPress);
|
97
|
+
};
|
98
|
+
}, [backAction])
|
99
|
+
);
|
100
|
+
|
101
|
+
const startVideoRecording = useCallback(() => {
|
102
|
+
setIsRecord(true);
|
103
|
+
if (device !== undefined) {
|
104
|
+
cameraRef.current?.startRecording({
|
105
|
+
fileType: "mp4",
|
106
|
+
onRecordingFinished: (video) =>
|
107
|
+
dispatch.sendVideosLifeCertificate({
|
108
|
+
exposureScaleZeroToOneLifeCertificate,
|
109
|
+
exposureMax: device.maxExposure,
|
110
|
+
exposureMin: device.minExposure,
|
111
|
+
videoPath: video.path
|
112
|
+
}),
|
113
|
+
onRecordingError: (error) => console.error(error)
|
114
|
+
});
|
115
|
+
}
|
116
|
+
}, [dispatch]);
|
117
|
+
|
118
|
+
const recordingVideo = useCallback(() => {
|
119
|
+
startVideoRecording();
|
120
|
+
setIntervalState(
|
121
|
+
setInterval(() => {
|
122
|
+
setTimer((prevTimer) => prevTimer - 1);
|
123
|
+
}, 1000)
|
124
|
+
);
|
125
|
+
}, [startVideoRecording]);
|
126
|
+
|
127
|
+
const stopRecodingVideo = useCallback(async () => {
|
128
|
+
setIsRecord(false);
|
129
|
+
await cameraRef.current?.stopRecording();
|
130
|
+
}, [dispatch]);
|
131
|
+
|
132
|
+
useEffect(() => {
|
133
|
+
if (timer < 0) {
|
134
|
+
if (!intervalState) return;
|
135
|
+
clearInterval(intervalState);
|
136
|
+
stopRecodingVideo();
|
137
|
+
}
|
138
|
+
}, [timer, intervalState, stopRecodingVideo]);
|
139
|
+
|
140
|
+
const onInitialized = () => setTorch("on");
|
141
|
+
|
142
|
+
if (device == null || hasPermission === false)
|
143
|
+
return <DeviceNotFound hasPermission={hasPermission} cameraPermission={cameraPermission} />;
|
144
|
+
|
145
|
+
return (
|
146
|
+
<>
|
147
|
+
<View style={styles.containerCamera}>
|
148
|
+
<Camera
|
149
|
+
ref={cameraRef}
|
150
|
+
device={device}
|
151
|
+
style={styles.camera}
|
152
|
+
format={cameraFormat}
|
153
|
+
isActive={isActive}
|
154
|
+
torch={torch}
|
155
|
+
exposure={exposure}
|
156
|
+
zoom={0}
|
157
|
+
onInitialized={onInitialized}
|
158
|
+
video
|
159
|
+
/>
|
160
|
+
</View>
|
161
|
+
<View style={[styles.containerCapture, { bottom: 0 }]}>
|
162
|
+
<RecordButton onPress={recordingVideo} disabled={loading === "pending"} timer={timer} isRecording={isRecord} />
|
163
|
+
</View>
|
164
|
+
{loading === "pending" && (
|
165
|
+
<Modal animationType="fade" transparent visible>
|
166
|
+
<View style={styles.containerModalLoading}>
|
167
|
+
<ActivityIndicator size="large" color="#fff" />
|
168
|
+
</View>
|
169
|
+
</Modal>
|
170
|
+
)}
|
171
|
+
</>
|
172
|
+
);
|
173
|
+
};
|
174
|
+
|
175
|
+
export default RegisterOperationPointsLifeCertificate;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { StyleSheet, Platform } from "react-native";
|
2
|
+
|
3
|
+
export const styles = StyleSheet.create({
|
4
|
+
containerCamera: {
|
5
|
+
flex: 1,
|
6
|
+
justifyContent: "center"
|
7
|
+
},
|
8
|
+
camera: {
|
9
|
+
flex: 1
|
10
|
+
},
|
11
|
+
box: {
|
12
|
+
flexDirection: "row",
|
13
|
+
height: 50,
|
14
|
+
justifyContent: "center",
|
15
|
+
alignItems: "center",
|
16
|
+
borderRadius: 50,
|
17
|
+
backgroundColor: "#1F75FF",
|
18
|
+
marginVertical: Platform.OS === "android" ? 100 : 120
|
19
|
+
},
|
20
|
+
text: {
|
21
|
+
position: "absolute",
|
22
|
+
color: "#fff"
|
23
|
+
},
|
24
|
+
containerCapture: {
|
25
|
+
position: "absolute",
|
26
|
+
width: "100%",
|
27
|
+
marginBottom: "30%",
|
28
|
+
alignItems: "center"
|
29
|
+
},
|
30
|
+
containerModalLoading: {
|
31
|
+
flex: 1,
|
32
|
+
justifyContent: "center",
|
33
|
+
alignItems: "center",
|
34
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
35
|
+
},
|
36
|
+
containerSlider: {
|
37
|
+
height: Platform.OS === "android" ? 100 : 120,
|
38
|
+
padding: 20,
|
39
|
+
gap: 10
|
40
|
+
}
|
41
|
+
});
|
package/src/screens/index.ts
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
import FingerRegister from "./FingerRegister/FingerRegister";
|
2
2
|
import LifeCertificate from "./LifeCertificate/LifeCertificate";
|
3
3
|
import FingerAuth from "./FingerAuth/FingerAuth";
|
4
|
+
import RegisterOperationPointsBiometrics from "./RegisterOperations/registerOperationPointsBiometrics";
|
5
|
+
import RegisterOperationPointsLifeCertificate from "./RegisterOperations/registerOperationPointsLifeCertificate";
|
4
6
|
|
5
|
-
export {
|
7
|
+
export {
|
8
|
+
FingerRegister,
|
9
|
+
LifeCertificate,
|
10
|
+
FingerAuth,
|
11
|
+
RegisterOperationPointsBiometrics,
|
12
|
+
RegisterOperationPointsLifeCertificate
|
13
|
+
};
|
package/src/services/index.ts
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
lifeCertificate,
|
3
|
+
getConfigsApi,
|
4
|
+
registerFingerImages,
|
5
|
+
authFinger,
|
6
|
+
getConfigOperationPoints,
|
7
|
+
sendImagesForRegisterOperationPoints,
|
8
|
+
sendVideoForRegisterOperationPoints
|
9
|
+
} from "./services";
|
2
10
|
|
3
11
|
const BASE_URL = "https://api.liveid.app.br";
|
4
12
|
const TOKEN =
|
@@ -39,4 +47,12 @@ export const verificaCPF = async (cpf: any) => {
|
|
39
47
|
return data;
|
40
48
|
};
|
41
49
|
|
42
|
-
export {
|
50
|
+
export {
|
51
|
+
lifeCertificate,
|
52
|
+
getConfigsApi,
|
53
|
+
registerFingerImages,
|
54
|
+
authFinger,
|
55
|
+
getConfigOperationPoints,
|
56
|
+
sendImagesForRegisterOperationPoints,
|
57
|
+
sendVideoForRegisterOperationPoints
|
58
|
+
};
|