@ha_tecno/live-id-sdk 2.9.2 → 2.10.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/commonjs/index.js +0 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/screens/FingerRegister/FingerRegister.js +95 -12
- package/lib/commonjs/screens/FingerRegister/FingerRegister.js.map +1 -1
- package/lib/commonjs/screens/FingerRegister/styles.js +30 -0
- package/lib/commonjs/screens/FingerRegister/styles.js.map +1 -1
- package/lib/commonjs/screens/index.js +0 -7
- package/lib/commonjs/screens/index.js.map +1 -1
- package/lib/commonjs/utils/index.js +8 -2
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/utils.js +6 -2
- package/lib/commonjs/utils/utils.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/screens/FingerRegister/FingerRegister.js +98 -15
- package/lib/module/screens/FingerRegister/FingerRegister.js.map +1 -1
- package/lib/module/screens/FingerRegister/styles.js +31 -1
- package/lib/module/screens/FingerRegister/styles.js.map +1 -1
- package/lib/module/screens/index.js +1 -2
- package/lib/module/screens/index.js.map +1 -1
- package/lib/module/utils/index.js +2 -2
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/utils.js +4 -1
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/screens/FingerRegister/FingerRegister.d.ts +4 -2
- package/lib/typescript/src/screens/FingerRegister/FingerRegister.d.ts.map +1 -1
- package/lib/typescript/src/screens/FingerRegister/styles.d.ts +30 -0
- package/lib/typescript/src/screens/FingerRegister/styles.d.ts.map +1 -1
- package/lib/typescript/src/screens/index.d.ts +1 -2
- package/lib/typescript/src/screens/index.d.ts.map +1 -1
- 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 +9 -1
- package/lib/typescript/src/utils/utils.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/index.tsx +2 -2
- package/src/screens/FingerRegister/FingerRegister.tsx +78 -14
- package/src/screens/FingerRegister/styles.ts +31 -1
- package/src/screens/index.ts +1 -2
- package/src/utils/index.ts +2 -2
- package/src/utils/utils.ts +10 -1
- package/lib/commonjs/screens/MultiFingerRegister/MultiFingerRegister.js +0 -219
- package/lib/commonjs/screens/MultiFingerRegister/MultiFingerRegister.js.map +0 -1
- package/lib/commonjs/screens/MultiFingerRegister/styles.js +0 -66
- package/lib/commonjs/screens/MultiFingerRegister/styles.js.map +0 -1
- package/lib/module/screens/MultiFingerRegister/MultiFingerRegister.js +0 -210
- package/lib/module/screens/MultiFingerRegister/MultiFingerRegister.js.map +0 -1
- package/lib/module/screens/MultiFingerRegister/styles.js +0 -60
- package/lib/module/screens/MultiFingerRegister/styles.js.map +0 -1
- package/lib/typescript/src/screens/MultiFingerRegister/MultiFingerRegister.d.ts +0 -11
- package/lib/typescript/src/screens/MultiFingerRegister/MultiFingerRegister.d.ts.map +0 -1
- package/lib/typescript/src/screens/MultiFingerRegister/styles.d.ts +0 -56
- package/lib/typescript/src/screens/MultiFingerRegister/styles.d.ts.map +0 -1
- package/src/screens/MultiFingerRegister/MultiFingerRegister.tsx +0 -190
- package/src/screens/MultiFingerRegister/styles.ts +0 -59
@@ -1,56 +0,0 @@
|
|
1
|
-
export declare const styles: {
|
2
|
-
container: {
|
3
|
-
flex: number;
|
4
|
-
};
|
5
|
-
root: {
|
6
|
-
flex: number;
|
7
|
-
};
|
8
|
-
cameraContainer: {
|
9
|
-
flex: number;
|
10
|
-
justifyContent: "center";
|
11
|
-
};
|
12
|
-
camera: {
|
13
|
-
flex: number;
|
14
|
-
paddingBottom: number;
|
15
|
-
};
|
16
|
-
containerCapture: {
|
17
|
-
position: "absolute";
|
18
|
-
width: "100%";
|
19
|
-
alignItems: "center";
|
20
|
-
};
|
21
|
-
cameraConfigs: {
|
22
|
-
alignItems: "center";
|
23
|
-
};
|
24
|
-
containerModalIcon: {
|
25
|
-
position: "absolute";
|
26
|
-
top: number;
|
27
|
-
right: number;
|
28
|
-
zIndex: number;
|
29
|
-
};
|
30
|
-
containerModal: {
|
31
|
-
position: "absolute";
|
32
|
-
justifyContent: "flex-start";
|
33
|
-
alignSelf: "center";
|
34
|
-
width: "100%";
|
35
|
-
};
|
36
|
-
modal: {
|
37
|
-
margin: number;
|
38
|
-
backgroundColor: string;
|
39
|
-
borderRadius: number;
|
40
|
-
padding: number;
|
41
|
-
shadowColor: string;
|
42
|
-
shadowOffset: {
|
43
|
-
width: number;
|
44
|
-
height: number;
|
45
|
-
};
|
46
|
-
shadowOpacity: number;
|
47
|
-
shadowRadius: number;
|
48
|
-
elevation: number;
|
49
|
-
};
|
50
|
-
iconClose: {
|
51
|
-
position: "absolute";
|
52
|
-
alignSelf: "flex-end";
|
53
|
-
padding: number;
|
54
|
-
};
|
55
|
-
};
|
56
|
-
//# sourceMappingURL=styles.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/screens/MultiFingerRegister/styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDjB,CAAC"}
|
@@ -1,190 +0,0 @@
|
|
1
|
-
import React, { useCallback, useEffect, useRef } from "react";
|
2
|
-
import { View } from "react-native";
|
3
|
-
import { Camera, Point, useCameraDevice, useCameraFormat, useCameraPermission } from "react-native-vision-camera";
|
4
|
-
import Orientation from "react-native-orientation-locker";
|
5
|
-
import { Gesture, GestureDetector, GestureHandlerRootView } from "react-native-gesture-handler";
|
6
|
-
import { runOnJS } from "react-native-reanimated";
|
7
|
-
import Picker, { PickerStyle } from "react-native-picker-select";
|
8
|
-
|
9
|
-
import { CameraConfigInfo, CaptureButton, DeviceNotFound, Gabarito, ModalMessage } from "../../components";
|
10
|
-
import { styles } from "./styles";
|
11
|
-
import { useDispatch, useSelector } from "../../store/modules/fingerRegister";
|
12
|
-
import { useIsForeground } from "../../utils";
|
13
|
-
|
14
|
-
enum Finger {
|
15
|
-
LEFT_THUMB = "LT",
|
16
|
-
LEFT_INDEX = "LI",
|
17
|
-
LEFT_MIDDLE = "LM",
|
18
|
-
LEFT_RING = "LR",
|
19
|
-
LEFT_PINKY = "LP",
|
20
|
-
RIGHT_THUMB = "RT",
|
21
|
-
RIGHT_INDEX = "RI",
|
22
|
-
RIGHT_MIDDLE = "RM",
|
23
|
-
RIGHT_RING = "RR",
|
24
|
-
RIGHT_PINKY = "RP"
|
25
|
-
}
|
26
|
-
|
27
|
-
type Props = {
|
28
|
-
UID: string;
|
29
|
-
onSuccess: (code: number) => void;
|
30
|
-
isFocused?: boolean;
|
31
|
-
mock?: boolean;
|
32
|
-
testID?: string;
|
33
|
-
};
|
34
|
-
|
35
|
-
const MultiFingerRegister = ({ testID, UID, onSuccess, isFocused, mock }: Props) => {
|
36
|
-
const cameraRef = useRef<Camera>(null);
|
37
|
-
const isForeground = useIsForeground();
|
38
|
-
const isActive = isFocused !== undefined ? isForeground && isFocused : isForeground;
|
39
|
-
const { hasPermission, requestPermission } = useCameraPermission();
|
40
|
-
const device = useCameraDevice("back");
|
41
|
-
const state = useSelector();
|
42
|
-
const dispatch = useDispatch();
|
43
|
-
|
44
|
-
const containerCaptureStyled = [styles.containerCapture, { bottom: state.showButtonInfo ? 75 : 20 }];
|
45
|
-
const pickerStyled: PickerStyle = {
|
46
|
-
chevronDown: { display: "none" },
|
47
|
-
chevronUp: { display: "none" },
|
48
|
-
inputIOS: {
|
49
|
-
fontSize: 16,
|
50
|
-
color: "#000",
|
51
|
-
textAlign: "center"
|
52
|
-
},
|
53
|
-
inputAndroid: {
|
54
|
-
fontSize: 14,
|
55
|
-
color: "#000",
|
56
|
-
textAlign: "center"
|
57
|
-
}
|
58
|
-
};
|
59
|
-
|
60
|
-
const itemsPicker = [
|
61
|
-
{ label: "Indicador Direito", value: Finger.RIGHT_INDEX },
|
62
|
-
{ label: "Médio Direito", value: Finger.RIGHT_MIDDLE },
|
63
|
-
{ label: "Anelar Direito", value: Finger.RIGHT_RING },
|
64
|
-
{ label: "Mínimo Direito", value: Finger.RIGHT_PINKY },
|
65
|
-
{ label: "Polegar Direito", value: Finger.RIGHT_THUMB },
|
66
|
-
{ label: "Indicador Esquerdo", value: Finger.LEFT_INDEX },
|
67
|
-
{ label: "Médio Esquerdo", value: Finger.LEFT_MIDDLE },
|
68
|
-
{ label: "Anelar Esquerdo", value: Finger.LEFT_RING },
|
69
|
-
{ label: "Mínimo Esquerdo", value: Finger.LEFT_PINKY },
|
70
|
-
{ label: "Polegar Esquerdo", value: Finger.LEFT_THUMB }
|
71
|
-
];
|
72
|
-
|
73
|
-
useEffect(() => {
|
74
|
-
Orientation.lockToPortrait();
|
75
|
-
return () => {
|
76
|
-
Orientation.unlockAllOrientations();
|
77
|
-
};
|
78
|
-
});
|
79
|
-
|
80
|
-
const cameraPermission = useCallback(async () => {
|
81
|
-
if (!hasPermission) {
|
82
|
-
await requestPermission();
|
83
|
-
}
|
84
|
-
}, [hasPermission, requestPermission]);
|
85
|
-
|
86
|
-
useEffect(() => {
|
87
|
-
cameraPermission();
|
88
|
-
dispatch.getConfig("finger");
|
89
|
-
}, [cameraPermission, dispatch.getConfig]);
|
90
|
-
|
91
|
-
const cameraFormat = useCameraFormat(device, [
|
92
|
-
{
|
93
|
-
photoResolution: {
|
94
|
-
width: 1280,
|
95
|
-
height: 720
|
96
|
-
}
|
97
|
-
}
|
98
|
-
]);
|
99
|
-
|
100
|
-
useEffect(() => {
|
101
|
-
if (state.base64Images !== undefined && state.base64Images.length === 3) {
|
102
|
-
if (!UID) {
|
103
|
-
dispatch.setModal("Ocorreu um erro!", "Erro: UID não encontrado!");
|
104
|
-
}
|
105
|
-
dispatch.handleLoading();
|
106
|
-
dispatch.sendImages(state.base64Images, UID, mock, state.currentFinger);
|
107
|
-
}
|
108
|
-
}, [dispatch.sendImages, dispatch.handleLoading, state.base64Images, state.base64Images.length, mock]);
|
109
|
-
|
110
|
-
useEffect(() => {
|
111
|
-
if (state.code === 0) {
|
112
|
-
dispatch.setModal("Sucesso!", "Cadastro de digital realizado com sucesso!");
|
113
|
-
onSuccess && onSuccess?.(state.code);
|
114
|
-
mock === true ? setTimeout(() => dispatch.handleLoading(), 2000) : dispatch.handleLoading();
|
115
|
-
dispatch.handleFinger();
|
116
|
-
}
|
117
|
-
if (state.code !== 0 && state.code !== null) {
|
118
|
-
dispatch.setModal("Ocorreu um erro!", `Erro: ${state.message}`);
|
119
|
-
dispatch.handleLoading();
|
120
|
-
}
|
121
|
-
dispatch.resetState();
|
122
|
-
}, [state.code, state.message, dispatch.handleLoading, dispatch.resetState, dispatch.setModal, onSuccess, mock]);
|
123
|
-
|
124
|
-
const takePhoto = async () => {
|
125
|
-
const photo = await cameraRef.current?.takePhoto({
|
126
|
-
qualityPrioritization: "balanced"
|
127
|
-
});
|
128
|
-
if (photo != null) {
|
129
|
-
dispatch.setImagePath(photo.path);
|
130
|
-
}
|
131
|
-
};
|
132
|
-
|
133
|
-
const focus = useCallback((point: Point) => {
|
134
|
-
const camera = cameraRef.current;
|
135
|
-
if (camera != null) {
|
136
|
-
camera.focus(point);
|
137
|
-
}
|
138
|
-
}, []);
|
139
|
-
|
140
|
-
const gesture = Gesture.Tap().onBegin(({ x, y }) => {
|
141
|
-
runOnJS(focus)({ x, y });
|
142
|
-
});
|
143
|
-
|
144
|
-
const handleCurrentFinger = (value: string) => {
|
145
|
-
dispatch.setCurrentFinger(value as Finger);
|
146
|
-
};
|
147
|
-
|
148
|
-
if (device == null || hasPermission === false)
|
149
|
-
return <DeviceNotFound hasPermission={hasPermission} cameraPermission={cameraPermission} />;
|
150
|
-
|
151
|
-
return (
|
152
|
-
<GestureHandlerRootView style={styles.root}>
|
153
|
-
<GestureDetector gesture={gesture}>
|
154
|
-
<View style={styles.cameraContainer}>
|
155
|
-
<Camera
|
156
|
-
ref={cameraRef}
|
157
|
-
style={styles.camera}
|
158
|
-
device={device}
|
159
|
-
format={cameraFormat}
|
160
|
-
isActive={isActive}
|
161
|
-
torch={isActive ? "on" : "off"}
|
162
|
-
exposure={state.exposure}
|
163
|
-
zoom={state.zoom}
|
164
|
-
photo
|
165
|
-
/>
|
166
|
-
<Gabarito />
|
167
|
-
</View>
|
168
|
-
</GestureDetector>
|
169
|
-
<View style={containerCaptureStyled}>
|
170
|
-
<CaptureButton onPress={takePhoto} imagesCount={state.base64Images.length} testID={testID} />
|
171
|
-
</View>
|
172
|
-
{state.showButtonInfo && <CameraConfigInfo exposure={state.exposure} zoom={state.zoom} />}
|
173
|
-
<ModalMessage isLoading={state.loading} modal={state.modal} />
|
174
|
-
<View style={styles.containerModal}>
|
175
|
-
<View style={styles.modal}>
|
176
|
-
<Picker
|
177
|
-
style={pickerStyled}
|
178
|
-
useNativeAndroidPickerStyle={false}
|
179
|
-
placeholder={{}}
|
180
|
-
items={itemsPicker}
|
181
|
-
value={state.currentFinger}
|
182
|
-
onValueChange={handleCurrentFinger}
|
183
|
-
/>
|
184
|
-
</View>
|
185
|
-
</View>
|
186
|
-
</GestureHandlerRootView>
|
187
|
-
);
|
188
|
-
};
|
189
|
-
|
190
|
-
export default MultiFingerRegister;
|
@@ -1,59 +0,0 @@
|
|
1
|
-
import { StyleSheet, Dimensions, Platform } from "react-native";
|
2
|
-
|
3
|
-
const { height } = Dimensions.get("window");
|
4
|
-
|
5
|
-
export const styles = StyleSheet.create({
|
6
|
-
container: {
|
7
|
-
flex: 1
|
8
|
-
},
|
9
|
-
root: {
|
10
|
-
flex: 1
|
11
|
-
},
|
12
|
-
cameraContainer: {
|
13
|
-
flex: 1,
|
14
|
-
justifyContent: "center"
|
15
|
-
},
|
16
|
-
camera: {
|
17
|
-
flex: 1,
|
18
|
-
paddingBottom: height * 0.2
|
19
|
-
},
|
20
|
-
containerCapture: {
|
21
|
-
position: "absolute",
|
22
|
-
width: "100%",
|
23
|
-
alignItems: "center"
|
24
|
-
},
|
25
|
-
cameraConfigs: {
|
26
|
-
alignItems: "center"
|
27
|
-
},
|
28
|
-
containerModalIcon: {
|
29
|
-
position: "absolute",
|
30
|
-
top: 10,
|
31
|
-
right: 10,
|
32
|
-
zIndex: 9999
|
33
|
-
},
|
34
|
-
containerModal: {
|
35
|
-
position: "absolute",
|
36
|
-
justifyContent: "flex-start",
|
37
|
-
alignSelf: "center",
|
38
|
-
width: "100%"
|
39
|
-
},
|
40
|
-
modal: {
|
41
|
-
margin: 20,
|
42
|
-
backgroundColor: "white",
|
43
|
-
borderRadius: 20,
|
44
|
-
padding: Platform.OS === "ios" ? 35 : 20,
|
45
|
-
shadowColor: "#000",
|
46
|
-
shadowOffset: {
|
47
|
-
width: 0,
|
48
|
-
height: 2
|
49
|
-
},
|
50
|
-
shadowOpacity: 0.25,
|
51
|
-
shadowRadius: 4,
|
52
|
-
elevation: 5
|
53
|
-
},
|
54
|
-
iconClose: {
|
55
|
-
position: "absolute",
|
56
|
-
alignSelf: "flex-end",
|
57
|
-
padding: 8
|
58
|
-
}
|
59
|
-
});
|