@ha_tecno/live-id-sdk 2.9.1 → 2.9.3
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 +93 -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/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/screens/FingerRegister/FingerRegister.js +95 -14
- 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/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 +3 -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/package.json +1 -1
- package/src/index.tsx +2 -2
- package/src/screens/FingerRegister/FingerRegister.tsx +74 -13
- package/src/screens/FingerRegister/styles.ts +31 -1
- package/src/screens/index.ts +1 -2
- package/lib/commonjs/screens/MultiFingerRegister/MultiFingerRegister.js +0 -249
- package/lib/commonjs/screens/MultiFingerRegister/MultiFingerRegister.js.map +0 -1
- package/lib/commonjs/screens/MultiFingerRegister/styles.js +0 -65
- package/lib/commonjs/screens/MultiFingerRegister/styles.js.map +0 -1
- package/lib/module/screens/MultiFingerRegister/MultiFingerRegister.js +0 -240
- package/lib/module/screens/MultiFingerRegister/MultiFingerRegister.js.map +0 -1
- package/lib/module/screens/MultiFingerRegister/styles.js +0 -59
- 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 -55
- package/lib/typescript/src/screens/MultiFingerRegister/styles.d.ts.map +0 -1
- package/src/screens/MultiFingerRegister/MultiFingerRegister.tsx +0 -212
- package/src/screens/MultiFingerRegister/styles.ts +0 -50
@@ -1,240 +0,0 @@
|
|
1
|
-
import React, { useCallback, useEffect, useRef, useState } from "react";
|
2
|
-
import { View, Modal, TouchableOpacity, Platform } from "react-native";
|
3
|
-
import { Camera, 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 from "react-native-picker-select";
|
8
|
-
import { CameraConfigInfo, CaptureButton, DeviceNotFound, Gabarito, ModalMessage } from "../../components";
|
9
|
-
import { styles } from "./styles";
|
10
|
-
import { useDispatch, useSelector } from "../../store/modules/fingerRegister";
|
11
|
-
import Icon from "../../components/icon/icon";
|
12
|
-
import { useIsForeground } from "../../utils";
|
13
|
-
var Finger = /*#__PURE__*/function (Finger) {
|
14
|
-
Finger["LEFT_THUMB"] = "LT";
|
15
|
-
Finger["LEFT_INDEX"] = "LI";
|
16
|
-
Finger["LEFT_MIDDLE"] = "LM";
|
17
|
-
Finger["LEFT_RING"] = "LR";
|
18
|
-
Finger["LEFT_PINKY"] = "LP";
|
19
|
-
Finger["RIGHT_THUMB"] = "RT";
|
20
|
-
Finger["RIGHT_INDEX"] = "RI";
|
21
|
-
Finger["RIGHT_MIDDLE"] = "RM";
|
22
|
-
Finger["RIGHT_RING"] = "RR";
|
23
|
-
Finger["RIGHT_PINKY"] = "RP";
|
24
|
-
return Finger;
|
25
|
-
}(Finger || {});
|
26
|
-
const MultiFingerRegister = ({
|
27
|
-
testID,
|
28
|
-
UID,
|
29
|
-
onSuccess,
|
30
|
-
isFocused,
|
31
|
-
mock
|
32
|
-
}) => {
|
33
|
-
const [showModal, setShowModal] = useState(false);
|
34
|
-
const cameraRef = useRef(null);
|
35
|
-
const isForeground = useIsForeground();
|
36
|
-
const isActive = isFocused !== undefined ? isForeground && isFocused : isForeground;
|
37
|
-
const {
|
38
|
-
hasPermission,
|
39
|
-
requestPermission
|
40
|
-
} = useCameraPermission();
|
41
|
-
const device = useCameraDevice("back");
|
42
|
-
const state = useSelector();
|
43
|
-
const dispatch = useDispatch();
|
44
|
-
const containerCaptureStyled = [styles.containerCapture, {
|
45
|
-
bottom: state.showButtonInfo ? 75 : 20
|
46
|
-
}];
|
47
|
-
const pickerStyled = {
|
48
|
-
chevronDown: {
|
49
|
-
display: "none"
|
50
|
-
},
|
51
|
-
chevronUp: {
|
52
|
-
display: "none"
|
53
|
-
},
|
54
|
-
inputIOS: {
|
55
|
-
fontSize: 16,
|
56
|
-
color: "#000",
|
57
|
-
textAlign: "center"
|
58
|
-
},
|
59
|
-
inputAndroid: {
|
60
|
-
fontSize: 14,
|
61
|
-
color: "#000",
|
62
|
-
textAlign: "center"
|
63
|
-
}
|
64
|
-
};
|
65
|
-
const itemsPicker = [{
|
66
|
-
label: "Indicador Direito",
|
67
|
-
value: Finger.RIGHT_INDEX
|
68
|
-
}, {
|
69
|
-
label: "Médio Direito",
|
70
|
-
value: Finger.RIGHT_MIDDLE
|
71
|
-
}, {
|
72
|
-
label: "Anelar Direito",
|
73
|
-
value: Finger.RIGHT_RING
|
74
|
-
}, {
|
75
|
-
label: "Mínimo Direito",
|
76
|
-
value: Finger.RIGHT_PINKY
|
77
|
-
}, {
|
78
|
-
label: "Polegar Direito",
|
79
|
-
value: Finger.RIGHT_THUMB
|
80
|
-
}, {
|
81
|
-
label: "Indicador Esquerdo",
|
82
|
-
value: Finger.LEFT_INDEX
|
83
|
-
}, {
|
84
|
-
label: "Médio Esquerdo",
|
85
|
-
value: Finger.LEFT_MIDDLE
|
86
|
-
}, {
|
87
|
-
label: "Anelar Esquerdo",
|
88
|
-
value: Finger.LEFT_RING
|
89
|
-
}, {
|
90
|
-
label: "Mínimo Esquerdo",
|
91
|
-
value: Finger.LEFT_PINKY
|
92
|
-
}, {
|
93
|
-
label: "Polegar Esquerdo",
|
94
|
-
value: Finger.LEFT_THUMB
|
95
|
-
}];
|
96
|
-
useEffect(() => {
|
97
|
-
Orientation.lockToPortrait();
|
98
|
-
return () => {
|
99
|
-
Orientation.unlockAllOrientations();
|
100
|
-
};
|
101
|
-
});
|
102
|
-
const cameraPermission = useCallback(async () => {
|
103
|
-
if (!hasPermission) {
|
104
|
-
await requestPermission();
|
105
|
-
}
|
106
|
-
}, [hasPermission, requestPermission]);
|
107
|
-
useEffect(() => {
|
108
|
-
cameraPermission();
|
109
|
-
dispatch.getConfig("finger");
|
110
|
-
}, [cameraPermission, dispatch.getConfig]);
|
111
|
-
const cameraFormat = useCameraFormat(device, [{
|
112
|
-
photoResolution: {
|
113
|
-
width: 1280,
|
114
|
-
height: 720
|
115
|
-
}
|
116
|
-
}]);
|
117
|
-
useEffect(() => {
|
118
|
-
if (state.base64Images !== undefined && state.base64Images.length === 3) {
|
119
|
-
if (!UID) {
|
120
|
-
dispatch.setModal("Ocorreu um erro!", "Erro: UID não encontrado!");
|
121
|
-
}
|
122
|
-
dispatch.handleLoading();
|
123
|
-
dispatch.sendImages(state.base64Images, UID, mock, state.currentFinger);
|
124
|
-
}
|
125
|
-
}, [dispatch.sendImages, dispatch.handleLoading, state.base64Images, state.base64Images.length, mock]);
|
126
|
-
useEffect(() => {
|
127
|
-
if (state.code === 0) {
|
128
|
-
dispatch.setModal("Sucesso!", "Cadastro de digital realizado com sucesso!");
|
129
|
-
onSuccess && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(state.code));
|
130
|
-
mock === true ? setTimeout(() => dispatch.handleLoading(), 2000) : dispatch.handleLoading();
|
131
|
-
dispatch.handleFinger();
|
132
|
-
}
|
133
|
-
if (state.code !== 0 && state.code !== null) {
|
134
|
-
dispatch.setModal("Ocorreu um erro!", `Erro: ${state.message}`);
|
135
|
-
dispatch.handleLoading();
|
136
|
-
}
|
137
|
-
dispatch.resetState();
|
138
|
-
}, [state.code, state.message, dispatch.handleLoading, dispatch.resetState, dispatch.setModal, onSuccess, mock]);
|
139
|
-
const takePhoto = async () => {
|
140
|
-
var _cameraRef$current;
|
141
|
-
const photo = await ((_cameraRef$current = cameraRef.current) === null || _cameraRef$current === void 0 ? void 0 : _cameraRef$current.takePhoto({
|
142
|
-
qualityPrioritization: "balanced"
|
143
|
-
}));
|
144
|
-
if (photo != null) {
|
145
|
-
dispatch.setImagePath(photo.path);
|
146
|
-
}
|
147
|
-
};
|
148
|
-
const focus = useCallback(point => {
|
149
|
-
const camera = cameraRef.current;
|
150
|
-
if (camera != null) {
|
151
|
-
camera.focus(point);
|
152
|
-
}
|
153
|
-
}, []);
|
154
|
-
const gesture = Gesture.Tap().onBegin(({
|
155
|
-
x,
|
156
|
-
y
|
157
|
-
}) => {
|
158
|
-
runOnJS(focus)({
|
159
|
-
x,
|
160
|
-
y
|
161
|
-
});
|
162
|
-
});
|
163
|
-
const openModal = () => {
|
164
|
-
setShowModal(true);
|
165
|
-
};
|
166
|
-
const closeModel = () => {
|
167
|
-
setShowModal(false);
|
168
|
-
};
|
169
|
-
const handleCurrentFinger = value => {
|
170
|
-
setTimeout(() => Platform.OS === "android" && closeModel(), 500);
|
171
|
-
dispatch.setCurrentFinger(value);
|
172
|
-
};
|
173
|
-
if (device == null || hasPermission === false) return /*#__PURE__*/React.createElement(DeviceNotFound, {
|
174
|
-
hasPermission: hasPermission,
|
175
|
-
cameraPermission: cameraPermission
|
176
|
-
});
|
177
|
-
return /*#__PURE__*/React.createElement(GestureHandlerRootView, {
|
178
|
-
style: styles.root
|
179
|
-
}, /*#__PURE__*/React.createElement(GestureDetector, {
|
180
|
-
gesture: gesture
|
181
|
-
}, /*#__PURE__*/React.createElement(View, {
|
182
|
-
style: styles.cameraContainer
|
183
|
-
}, /*#__PURE__*/React.createElement(Camera, {
|
184
|
-
ref: cameraRef,
|
185
|
-
style: styles.camera,
|
186
|
-
device: device,
|
187
|
-
format: cameraFormat,
|
188
|
-
isActive: isActive,
|
189
|
-
torch: isActive ? "on" : "off",
|
190
|
-
exposure: state.exposure,
|
191
|
-
zoom: state.zoom,
|
192
|
-
photo: true
|
193
|
-
}), /*#__PURE__*/React.createElement(Gabarito, null))), /*#__PURE__*/React.createElement(View, {
|
194
|
-
style: styles.containerModalIcon
|
195
|
-
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
196
|
-
onPress: openModal
|
197
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
198
|
-
name: "cog",
|
199
|
-
size: 40,
|
200
|
-
color: "#fff"
|
201
|
-
}))), /*#__PURE__*/React.createElement(View, {
|
202
|
-
style: containerCaptureStyled
|
203
|
-
}, /*#__PURE__*/React.createElement(CaptureButton, {
|
204
|
-
onPress: takePhoto,
|
205
|
-
imagesCount: state.base64Images.length,
|
206
|
-
testID: testID
|
207
|
-
})), state.showButtonInfo && /*#__PURE__*/React.createElement(CameraConfigInfo, {
|
208
|
-
exposure: state.exposure,
|
209
|
-
zoom: state.zoom
|
210
|
-
}), /*#__PURE__*/React.createElement(ModalMessage, {
|
211
|
-
isLoading: state.loading,
|
212
|
-
modal: state.modal
|
213
|
-
}), /*#__PURE__*/React.createElement(Modal, {
|
214
|
-
animationType: "slide",
|
215
|
-
transparent: true,
|
216
|
-
visible: showModal,
|
217
|
-
onRequestClose: closeModel
|
218
|
-
}, /*#__PURE__*/React.createElement(View, {
|
219
|
-
style: styles.containerModal
|
220
|
-
}, /*#__PURE__*/React.createElement(View, {
|
221
|
-
style: styles.modal
|
222
|
-
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
223
|
-
onPress: closeModel,
|
224
|
-
style: styles.iconClose
|
225
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
226
|
-
name: "close",
|
227
|
-
size: 32,
|
228
|
-
color: "red"
|
229
|
-
})), /*#__PURE__*/React.createElement(Picker, {
|
230
|
-
style: pickerStyled,
|
231
|
-
useNativeAndroidPickerStyle: false,
|
232
|
-
placeholder: {},
|
233
|
-
onDonePress: closeModel,
|
234
|
-
items: itemsPicker,
|
235
|
-
value: state.currentFinger,
|
236
|
-
onValueChange: handleCurrentFinger
|
237
|
-
})))));
|
238
|
-
};
|
239
|
-
export default MultiFingerRegister;
|
240
|
-
//# sourceMappingURL=MultiFingerRegister.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["React","useCallback","useEffect","useRef","useState","View","Modal","TouchableOpacity","Platform","Camera","useCameraDevice","useCameraFormat","useCameraPermission","Orientation","Gesture","GestureDetector","GestureHandlerRootView","runOnJS","Picker","CameraConfigInfo","CaptureButton","DeviceNotFound","Gabarito","ModalMessage","styles","useDispatch","useSelector","Icon","useIsForeground","Finger","MultiFingerRegister","testID","UID","onSuccess","isFocused","mock","showModal","setShowModal","cameraRef","isForeground","isActive","undefined","hasPermission","requestPermission","device","state","dispatch","containerCaptureStyled","containerCapture","bottom","showButtonInfo","pickerStyled","chevronDown","display","chevronUp","inputIOS","fontSize","color","textAlign","inputAndroid","itemsPicker","label","value","RIGHT_INDEX","RIGHT_MIDDLE","RIGHT_RING","RIGHT_PINKY","RIGHT_THUMB","LEFT_INDEX","LEFT_MIDDLE","LEFT_RING","LEFT_PINKY","LEFT_THUMB","lockToPortrait","unlockAllOrientations","cameraPermission","getConfig","cameraFormat","photoResolution","width","height","base64Images","length","setModal","handleLoading","sendImages","currentFinger","code","setTimeout","handleFinger","message","resetState","takePhoto","_cameraRef$current","photo","current","qualityPrioritization","setImagePath","path","focus","point","camera","gesture","Tap","onBegin","x","y","openModal","closeModel","handleCurrentFinger","OS","setCurrentFinger","createElement","style","root","cameraContainer","ref","format","torch","exposure","zoom","containerModalIcon","onPress","name","size","imagesCount","isLoading","loading","modal","animationType","transparent","visible","onRequestClose","containerModal","iconClose","useNativeAndroidPickerStyle","placeholder","onDonePress","items","onValueChange"],"sourceRoot":"../../../../src","sources":["screens/MultiFingerRegister/MultiFingerRegister.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACvE,SAASC,IAAI,EAAEC,KAAK,EAAEC,gBAAgB,EAAEC,QAAQ,QAAQ,cAAc;AACtE,SAASC,MAAM,EAASC,eAAe,EAAEC,eAAe,EAAEC,mBAAmB,QAAQ,4BAA4B;AACjH,OAAOC,WAAW,MAAM,iCAAiC;AACzD,SAASC,OAAO,EAAEC,eAAe,EAAEC,sBAAsB,QAAQ,8BAA8B;AAC/F,SAASC,OAAO,QAAQ,yBAAyB;AACjD,OAAOC,MAAM,MAAuB,4BAA4B;AAEhE,SAASC,gBAAgB,EAAEC,aAAa,EAAEC,cAAc,EAAEC,QAAQ,EAAEC,YAAY,QAAQ,kBAAkB;AAC1G,SAASC,MAAM,QAAQ,UAAU;AACjC,SAASC,WAAW,EAAEC,WAAW,QAAQ,oCAAoC;AAC7E,OAAOC,IAAI,MAAM,4BAA4B;AAC7C,SAASC,eAAe,QAAQ,aAAa;AAAC,IAEzCC,MAAM,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA,EAANA,MAAM;AAqBX,MAAMC,mBAAmB,GAAGA,CAAC;EAAEC,MAAM;EAAEC,GAAG;EAAEC,SAAS;EAAEC,SAAS;EAAEC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AA,CAAC9F,MAAM;IACL+F,KAAK,EAAE9D,YAAa;IACpBoF,2BAA2B,EAAE,KAAM;IACnCC,WAAW,EAAE,CAAC,CAAE;IAChBC,WAAW,EAAE7B,UAAW;IACxB8B,KAAK,EAAE9E,WAAY;IACnBE,KAAK,EAAEjB,KAAK,CAACyC,aAAc;IAC3BqD,aAAa,EAAE9B;EAAoB,CACpC,CACG,CACF,CACD,CACe,CAAC;AAE7B,CAAC;AAED,eAAe/E,mBAAmB"}
|
@@ -1,59 +0,0 @@
|
|
1
|
-
import { StyleSheet, Dimensions, Platform } from "react-native";
|
2
|
-
const {
|
3
|
-
height
|
4
|
-
} = Dimensions.get("window");
|
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
|
-
flex: 1,
|
36
|
-
justifyContent: "flex-end",
|
37
|
-
marginBottom: "15%"
|
38
|
-
},
|
39
|
-
modal: {
|
40
|
-
margin: 20,
|
41
|
-
backgroundColor: "white",
|
42
|
-
borderRadius: 20,
|
43
|
-
padding: Platform.OS === "ios" ? 35 : 20,
|
44
|
-
shadowColor: "#000",
|
45
|
-
shadowOffset: {
|
46
|
-
width: 0,
|
47
|
-
height: 2
|
48
|
-
},
|
49
|
-
shadowOpacity: 0.25,
|
50
|
-
shadowRadius: 4,
|
51
|
-
elevation: 5
|
52
|
-
},
|
53
|
-
iconClose: {
|
54
|
-
position: "absolute",
|
55
|
-
alignSelf: "flex-end",
|
56
|
-
padding: 8
|
57
|
-
}
|
58
|
-
});
|
59
|
-
//# sourceMappingURL=styles.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["StyleSheet","Dimensions","Platform","height","get","styles","create","container","flex","root","cameraContainer","justifyContent","camera","paddingBottom","containerCapture","position","width","alignItems","cameraConfigs","containerModalIcon","top","right","zIndex","containerModal","marginBottom","modal","margin","backgroundColor","borderRadius","padding","OS","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","iconClose","alignSelf"],"sourceRoot":"../../../../src","sources":["screens/MultiFingerRegister/styles.ts"],"mappings":"AAAA,SAASA,UAAU,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,cAAc;AAE/D,MAAM;EAAEC;AAAO,CAAC,GAAGF,UAAU,CAACG,GAAG,CAAC,QAAQ,CAAC;AAE3C,OAAO,MAAMC,MAAM,GAAGL,UAAU,CAACM,MAAM,CAAC;EACtCC,SAAS,EAAE;IACTC,IAAI,EAAE;EACR,CAAC;EACDC,IAAI,EAAE;IACJD,IAAI,EAAE;EACR,CAAC;EACDE,eAAe,EAAE;IACfF,IAAI,EAAE,CAAC;IACPG,cAAc,EAAE;EAClB,CAAC;EACDC,MAAM,EAAE;IACNJ,IAAI,EAAE,CAAC;IACPK,aAAa,EAAEV,MAAM,GAAG;EAC1B,CAAC;EACDW,gBAAgB,EAAE;IAChBC,QAAQ,EAAE,UAAU;IACpBC,KAAK,EAAE,MAAM;IACbC,UAAU,EAAE;EACd,CAAC;EACDC,aAAa,EAAE;IACbD,UAAU,EAAE;EACd,CAAC;EACDE,kBAAkB,EAAE;IAClBJ,QAAQ,EAAE,UAAU;IACpBK,GAAG,EAAE,EAAE;IACPC,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE;EACV,CAAC;EACDC,cAAc,EAAE;IAAEf,IAAI,EAAE,CAAC;IAAEG,cAAc,EAAE,UAAU;IAAEa,YAAY,EAAE;EAAM,CAAC;EAC5EC,KAAK,EAAE;IACLC,MAAM,EAAE,EAAE;IACVC,eAAe,EAAE,OAAO;IACxBC,YAAY,EAAE,EAAE;IAChBC,OAAO,EAAE3B,QAAQ,CAAC4B,EAAE,KAAK,KAAK,GAAG,EAAE,GAAG,EAAE;IACxCC,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MACZhB,KAAK,EAAE,CAAC;MACRb,MAAM,EAAE;IACV,CAAC;IACD8B,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE;EACb,CAAC;EACDC,SAAS,EAAE;IAAErB,QAAQ,EAAE,UAAU;IAAEsB,SAAS,EAAE,UAAU;IAAER,OAAO,EAAE;EAAE;AACvE,CAAC,CAAC"}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
/// <reference types="react" />
|
2
|
-
type Props = {
|
3
|
-
UID: string;
|
4
|
-
onSuccess: (code: number) => void;
|
5
|
-
isFocused?: boolean;
|
6
|
-
mock?: boolean;
|
7
|
-
testID?: string;
|
8
|
-
};
|
9
|
-
declare const MultiFingerRegister: ({ testID, UID, onSuccess, isFocused, mock }: Props) => JSX.Element;
|
10
|
-
export default MultiFingerRegister;
|
11
|
-
//# sourceMappingURL=MultiFingerRegister.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"MultiFingerRegister.d.ts","sourceRoot":"","sources":["../../../../../src/screens/MultiFingerRegister/MultiFingerRegister.tsx"],"names":[],"mappings":";AA2BA,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,QAAA,MAAM,mBAAmB,gDAAiD,KAAK,gBA8K9E,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
@@ -1,55 +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
|
-
flex: number;
|
32
|
-
justifyContent: "flex-end";
|
33
|
-
marginBottom: "15%";
|
34
|
-
};
|
35
|
-
modal: {
|
36
|
-
margin: number;
|
37
|
-
backgroundColor: string;
|
38
|
-
borderRadius: number;
|
39
|
-
padding: number;
|
40
|
-
shadowColor: string;
|
41
|
-
shadowOffset: {
|
42
|
-
width: number;
|
43
|
-
height: number;
|
44
|
-
};
|
45
|
-
shadowOpacity: number;
|
46
|
-
shadowRadius: number;
|
47
|
-
elevation: number;
|
48
|
-
};
|
49
|
-
iconClose: {
|
50
|
-
position: "absolute";
|
51
|
-
alignSelf: "flex-end";
|
52
|
-
padding: number;
|
53
|
-
};
|
54
|
-
};
|
55
|
-
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6CjB,CAAC"}
|
@@ -1,212 +0,0 @@
|
|
1
|
-
import React, { useCallback, useEffect, useRef, useState } from "react";
|
2
|
-
import { View, Modal, TouchableOpacity, Platform } 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 Icon from "../../components/icon/icon";
|
13
|
-
import { useIsForeground } from "../../utils";
|
14
|
-
|
15
|
-
enum Finger {
|
16
|
-
LEFT_THUMB = "LT",
|
17
|
-
LEFT_INDEX = "LI",
|
18
|
-
LEFT_MIDDLE = "LM",
|
19
|
-
LEFT_RING = "LR",
|
20
|
-
LEFT_PINKY = "LP",
|
21
|
-
RIGHT_THUMB = "RT",
|
22
|
-
RIGHT_INDEX = "RI",
|
23
|
-
RIGHT_MIDDLE = "RM",
|
24
|
-
RIGHT_RING = "RR",
|
25
|
-
RIGHT_PINKY = "RP"
|
26
|
-
}
|
27
|
-
|
28
|
-
type Props = {
|
29
|
-
UID: string;
|
30
|
-
onSuccess: (code: number) => void;
|
31
|
-
isFocused?: boolean;
|
32
|
-
mock?: boolean;
|
33
|
-
testID?: string;
|
34
|
-
};
|
35
|
-
|
36
|
-
const MultiFingerRegister = ({ testID, UID, onSuccess, isFocused, mock }: Props) => {
|
37
|
-
const [showModal, setShowModal] = useState(false);
|
38
|
-
const cameraRef = useRef<Camera>(null);
|
39
|
-
const isForeground = useIsForeground();
|
40
|
-
const isActive = isFocused !== undefined ? isForeground && isFocused : isForeground;
|
41
|
-
const { hasPermission, requestPermission } = useCameraPermission();
|
42
|
-
const device = useCameraDevice("back");
|
43
|
-
const state = useSelector();
|
44
|
-
const dispatch = useDispatch();
|
45
|
-
|
46
|
-
const containerCaptureStyled = [styles.containerCapture, { bottom: state.showButtonInfo ? 75 : 20 }];
|
47
|
-
const pickerStyled: PickerStyle = {
|
48
|
-
chevronDown: { display: "none" },
|
49
|
-
chevronUp: { display: "none" },
|
50
|
-
inputIOS: {
|
51
|
-
fontSize: 16,
|
52
|
-
color: "#000",
|
53
|
-
textAlign: "center"
|
54
|
-
},
|
55
|
-
inputAndroid: {
|
56
|
-
fontSize: 14,
|
57
|
-
color: "#000",
|
58
|
-
textAlign: "center"
|
59
|
-
}
|
60
|
-
};
|
61
|
-
|
62
|
-
const itemsPicker = [
|
63
|
-
{ label: "Indicador Direito", value: Finger.RIGHT_INDEX },
|
64
|
-
{ label: "Médio Direito", value: Finger.RIGHT_MIDDLE },
|
65
|
-
{ label: "Anelar Direito", value: Finger.RIGHT_RING },
|
66
|
-
{ label: "Mínimo Direito", value: Finger.RIGHT_PINKY },
|
67
|
-
{ label: "Polegar Direito", value: Finger.RIGHT_THUMB },
|
68
|
-
{ label: "Indicador Esquerdo", value: Finger.LEFT_INDEX },
|
69
|
-
{ label: "Médio Esquerdo", value: Finger.LEFT_MIDDLE },
|
70
|
-
{ label: "Anelar Esquerdo", value: Finger.LEFT_RING },
|
71
|
-
{ label: "Mínimo Esquerdo", value: Finger.LEFT_PINKY },
|
72
|
-
{ label: "Polegar Esquerdo", value: Finger.LEFT_THUMB }
|
73
|
-
];
|
74
|
-
|
75
|
-
useEffect(() => {
|
76
|
-
Orientation.lockToPortrait();
|
77
|
-
return () => {
|
78
|
-
Orientation.unlockAllOrientations();
|
79
|
-
};
|
80
|
-
});
|
81
|
-
|
82
|
-
const cameraPermission = useCallback(async () => {
|
83
|
-
if (!hasPermission) {
|
84
|
-
await requestPermission();
|
85
|
-
}
|
86
|
-
}, [hasPermission, requestPermission]);
|
87
|
-
|
88
|
-
useEffect(() => {
|
89
|
-
cameraPermission();
|
90
|
-
dispatch.getConfig("finger");
|
91
|
-
}, [cameraPermission, dispatch.getConfig]);
|
92
|
-
|
93
|
-
const cameraFormat = useCameraFormat(device, [
|
94
|
-
{
|
95
|
-
photoResolution: {
|
96
|
-
width: 1280,
|
97
|
-
height: 720
|
98
|
-
}
|
99
|
-
}
|
100
|
-
]);
|
101
|
-
|
102
|
-
useEffect(() => {
|
103
|
-
if (state.base64Images !== undefined && state.base64Images.length === 3) {
|
104
|
-
if (!UID) {
|
105
|
-
dispatch.setModal("Ocorreu um erro!", "Erro: UID não encontrado!");
|
106
|
-
}
|
107
|
-
dispatch.handleLoading();
|
108
|
-
dispatch.sendImages(state.base64Images, UID, mock, state.currentFinger);
|
109
|
-
}
|
110
|
-
}, [dispatch.sendImages, dispatch.handleLoading, state.base64Images, state.base64Images.length, mock]);
|
111
|
-
|
112
|
-
useEffect(() => {
|
113
|
-
if (state.code === 0) {
|
114
|
-
dispatch.setModal("Sucesso!", "Cadastro de digital realizado com sucesso!");
|
115
|
-
onSuccess && onSuccess?.(state.code);
|
116
|
-
mock === true ? setTimeout(() => dispatch.handleLoading(), 2000) : dispatch.handleLoading();
|
117
|
-
dispatch.handleFinger();
|
118
|
-
}
|
119
|
-
if (state.code !== 0 && state.code !== null) {
|
120
|
-
dispatch.setModal("Ocorreu um erro!", `Erro: ${state.message}`);
|
121
|
-
dispatch.handleLoading();
|
122
|
-
}
|
123
|
-
dispatch.resetState();
|
124
|
-
}, [state.code, state.message, dispatch.handleLoading, dispatch.resetState, dispatch.setModal, onSuccess, mock]);
|
125
|
-
|
126
|
-
const takePhoto = async () => {
|
127
|
-
const photo = await cameraRef.current?.takePhoto({
|
128
|
-
qualityPrioritization: "balanced"
|
129
|
-
});
|
130
|
-
if (photo != null) {
|
131
|
-
dispatch.setImagePath(photo.path);
|
132
|
-
}
|
133
|
-
};
|
134
|
-
|
135
|
-
const focus = useCallback((point: Point) => {
|
136
|
-
const camera = cameraRef.current;
|
137
|
-
if (camera != null) {
|
138
|
-
camera.focus(point);
|
139
|
-
}
|
140
|
-
}, []);
|
141
|
-
|
142
|
-
const gesture = Gesture.Tap().onBegin(({ x, y }) => {
|
143
|
-
runOnJS(focus)({ x, y });
|
144
|
-
});
|
145
|
-
|
146
|
-
const openModal = () => {
|
147
|
-
setShowModal(true);
|
148
|
-
};
|
149
|
-
|
150
|
-
const closeModel = () => {
|
151
|
-
setShowModal(false);
|
152
|
-
};
|
153
|
-
|
154
|
-
const handleCurrentFinger = (value: string) => {
|
155
|
-
setTimeout(() => Platform.OS === "android" && closeModel(), 500);
|
156
|
-
dispatch.setCurrentFinger(value as Finger);
|
157
|
-
};
|
158
|
-
|
159
|
-
if (device == null || hasPermission === false)
|
160
|
-
return <DeviceNotFound hasPermission={hasPermission} cameraPermission={cameraPermission} />;
|
161
|
-
|
162
|
-
return (
|
163
|
-
<GestureHandlerRootView style={styles.root}>
|
164
|
-
<GestureDetector gesture={gesture}>
|
165
|
-
<View style={styles.cameraContainer}>
|
166
|
-
<Camera
|
167
|
-
ref={cameraRef}
|
168
|
-
style={styles.camera}
|
169
|
-
device={device}
|
170
|
-
format={cameraFormat}
|
171
|
-
isActive={isActive}
|
172
|
-
torch={isActive ? "on" : "off"}
|
173
|
-
exposure={state.exposure}
|
174
|
-
zoom={state.zoom}
|
175
|
-
photo
|
176
|
-
/>
|
177
|
-
<Gabarito />
|
178
|
-
</View>
|
179
|
-
</GestureDetector>
|
180
|
-
<View style={styles.containerModalIcon}>
|
181
|
-
<TouchableOpacity onPress={openModal}>
|
182
|
-
<Icon name="cog" size={40} color="#fff" />
|
183
|
-
</TouchableOpacity>
|
184
|
-
</View>
|
185
|
-
<View style={containerCaptureStyled}>
|
186
|
-
<CaptureButton onPress={takePhoto} imagesCount={state.base64Images.length} testID={testID} />
|
187
|
-
</View>
|
188
|
-
{state.showButtonInfo && <CameraConfigInfo exposure={state.exposure} zoom={state.zoom} />}
|
189
|
-
<ModalMessage isLoading={state.loading} modal={state.modal} />
|
190
|
-
<Modal animationType="slide" transparent={true} visible={showModal} onRequestClose={closeModel}>
|
191
|
-
<View style={styles.containerModal}>
|
192
|
-
<View style={styles.modal}>
|
193
|
-
<TouchableOpacity onPress={closeModel} style={styles.iconClose}>
|
194
|
-
<Icon name="close" size={32} color="red" />
|
195
|
-
</TouchableOpacity>
|
196
|
-
<Picker
|
197
|
-
style={pickerStyled}
|
198
|
-
useNativeAndroidPickerStyle={false}
|
199
|
-
placeholder={{}}
|
200
|
-
onDonePress={closeModel}
|
201
|
-
items={itemsPicker}
|
202
|
-
value={state.currentFinger}
|
203
|
-
onValueChange={handleCurrentFinger}
|
204
|
-
/>
|
205
|
-
</View>
|
206
|
-
</View>
|
207
|
-
</Modal>
|
208
|
-
</GestureHandlerRootView>
|
209
|
-
);
|
210
|
-
};
|
211
|
-
|
212
|
-
export default MultiFingerRegister;
|
@@ -1,50 +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: { flex: 1, justifyContent: "flex-end", marginBottom: "15%" },
|
35
|
-
modal: {
|
36
|
-
margin: 20,
|
37
|
-
backgroundColor: "white",
|
38
|
-
borderRadius: 20,
|
39
|
-
padding: Platform.OS === "ios" ? 35 : 20,
|
40
|
-
shadowColor: "#000",
|
41
|
-
shadowOffset: {
|
42
|
-
width: 0,
|
43
|
-
height: 2
|
44
|
-
},
|
45
|
-
shadowOpacity: 0.25,
|
46
|
-
shadowRadius: 4,
|
47
|
-
elevation: 5
|
48
|
-
},
|
49
|
-
iconClose: { position: "absolute", alignSelf: "flex-end", padding: 8 }
|
50
|
-
});
|