react-native-timacare 3.3.66 → 3.3.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=AlertLoan;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _AppModal=_interopRequireDefault(require("./AppModal"));var _icons=require("../assets/icons");var _MText=require("./MText");var _jsxFileName="/Users/tima/Tima/react-native-timacare/src/components/AlertLoan.tsx";var modalSafeProps={useNativeDriver:true,useNativeDriverForBackdrop:true,hideModalContentWhileAnimating:true,backdropTransitionOutTiming:0};function AlertLoan(_ref){var open=_ref.open,onClose=_ref.onClose;return _react.default.createElement(_AppModal.default,(0,_extends2.default)({isVisible:open},modalSafeProps,{__self:this,__source:{fileName:_jsxFileName,lineNumber:22,columnNumber:5}}),_react.default.createElement(_reactNative.SafeAreaView,{style:{backgroundColor:'#FFFFFF',borderRadius:12},__self:this,__source:{fileName:_jsxFileName,lineNumber:23,columnNumber:7}},_react.default.createElement(_reactNative.View,{style:{flexDirection:'row-reverse',marginTop:5},__self:this,__source:{fileName:_jsxFileName,lineNumber:29,columnNumber:9}},_react.default.createElement(_reactNative.TouchableOpacity,{onPress:onClose,style:{width:30,height:30,alignItems:'center',justifyContent:'center'},__self:this,__source:{fileName:_jsxFileName,lineNumber:35,columnNumber:11}},_react.default.createElement(_icons.Close2Icon,{__self:this,__source:{fileName:_jsxFileName,lineNumber:44,columnNumber:13}}))),_react.default.createElement(_reactNative.Image,{source:require('../assets/img/Frame1000011990.png'),style:{height:230,resizeMode:'contain',width:'100%'},__self:this,__source:{fileName:_jsxFileName,lineNumber:47,columnNumber:9}}),_react.default.createElement(_reactNative.View,{style:{paddingHorizontal:24,marginTop:24,flexDirection:'column',gap:8,alignItems:'center'},__self:this,__source:{fileName:_jsxFileName,lineNumber:56,columnNumber:9}},_react.default.createElement(_MText.MText,{style:{fontSize:16,fontWeight:'bold',textAlign:'center'},__self:this,__source:{fileName:_jsxFileName,lineNumber:65,columnNumber:11}},"\u0110\u01A1n vay \u0111ang ch\u1EDD ph\xEA duy\u1EC7t"),_react.default.createElement(_MText.MText,{style:{fontSize:14,textAlign:'center',color:'#828282'},__self:this,__source:{fileName:_jsxFileName,lineNumber:74,columnNumber:11}},_react.default.createElement(_MText.MText,{style:{fontSize:14,color:'#EF592E',fontWeight:'bold'},__self:this,__source:{fileName:_jsxFileName,lineNumber:81,columnNumber:13}},"Chuy\xEAn vi\xEAn Tima s\u1EBD s\u1EDBm li\xEAn h\u1EC7"),' ',"\u0111\u1EC3 x\xE1c minh th\xF4ng tin. Anh/ch\u1ECB vui l\xF2ng \u0111\u1EC3 \xFD \u0111i\u1EC7n tho\u1EA1i \u0111\u1EC3 \u0111\u01B0\u1EE3c h\u1ED7 tr\u1EE3 gi\u1EA3i ng\xE2n nhanh nh\u1EA5t"),_react.default.createElement(_reactNative.TouchableOpacity,{onPress:onClose,style:{borderWidth:1,borderColor:'#EF592E',borderRadius:24,height:40,alignItems:'center',justifyContent:'center',marginBottom:24,marginTop:16,width:'100%'},__self:this,__source:{fileName:_jsxFileName,lineNumber:93,columnNumber:11}},_react.default.createElement(_MText.MText,{style:{color:'#EF592E'},__self:this,__source:{fileName:_jsxFileName,lineNumber:107,columnNumber:13}},"\u0110\xE3 hi\u1EC3u")))));}
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=AlertLoan;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _AppModal=_interopRequireDefault(require("./AppModal"));var _MText=require("./MText");var _jsxFileName="/Users/tima/Tima/react-native-timacare/src/components/AlertLoan.tsx";var modalSafeProps={useNativeDriver:true,useNativeDriverForBackdrop:true,hideModalContentWhileAnimating:true,backdropTransitionOutTiming:0};function AlertLoan(_ref){var open=_ref.open,onClose=_ref.onClose;return _react.default.createElement(_AppModal.default,(0,_extends2.default)({isVisible:open},modalSafeProps,{__self:this,__source:{fileName:_jsxFileName,lineNumber:21,columnNumber:5}}),_react.default.createElement(_reactNative.SafeAreaView,{style:{backgroundColor:'#FFFFFF',borderRadius:12},__self:this,__source:{fileName:_jsxFileName,lineNumber:22,columnNumber:7}},_react.default.createElement(_reactNative.Image,{source:require('../assets/img/Frame1000011990.png'),style:{height:230,resizeMode:'contain',width:'100%'},__self:this,__source:{fileName:_jsxFileName,lineNumber:28,columnNumber:9}}),_react.default.createElement(_reactNative.View,{style:{paddingHorizontal:24,marginTop:24,flexDirection:'column',gap:8,alignItems:'center'},__self:this,__source:{fileName:_jsxFileName,lineNumber:37,columnNumber:9}},_react.default.createElement(_MText.MText,{style:{fontSize:16,fontWeight:'bold',textAlign:'center'},__self:this,__source:{fileName:_jsxFileName,lineNumber:46,columnNumber:11}},"\u0110\u01A1n vay \u0111ang ch\u1EDD ph\xEA duy\u1EC7t"),_react.default.createElement(_MText.MText,{style:{fontSize:14,textAlign:'center',color:'#828282'},__self:this,__source:{fileName:_jsxFileName,lineNumber:55,columnNumber:11}},_react.default.createElement(_MText.MText,{style:{fontSize:14,color:'#EF592E',fontWeight:'bold'},__self:this,__source:{fileName:_jsxFileName,lineNumber:62,columnNumber:13}},"Chuy\xEAn vi\xEAn Tima s\u1EBD s\u1EDBm li\xEAn h\u1EC7"),' ',"\u0111\u1EC3 x\xE1c minh th\xF4ng tin. Anh/ch\u1ECB vui l\xF2ng \u0111\u1EC3 \xFD \u0111i\u1EC7n tho\u1EA1i \u0111\u1EC3 \u0111\u01B0\u1EE3c h\u1ED7 tr\u1EE3 gi\u1EA3i ng\xE2n nhanh nh\u1EA5t"),_react.default.createElement(_reactNative.TouchableOpacity,{onPress:onClose,style:{borderWidth:1,borderColor:'#EF592E',borderRadius:24,height:40,alignItems:'center',justifyContent:'center',marginBottom:24,marginTop:16,width:'100%'},__self:this,__source:{fileName:_jsxFileName,lineNumber:74,columnNumber:11}},_react.default.createElement(_MText.MText,{style:{color:'#EF592E'},__self:this,__source:{fileName:_jsxFileName,lineNumber:88,columnNumber:13}},"\u0110\xE3 hi\u1EC3u")))));}
2
2
  //# sourceMappingURL=AlertLoan.js.map
@@ -2,7 +2,6 @@
2
2
  import React from 'react';
3
3
  import { Image, SafeAreaView, TouchableOpacity, View } from 'react-native';
4
4
  import Modal from './AppModal';
5
- import { Close2Icon, CloseIcon, IconNavClose } from '../assets/icons';
6
5
  import { MText } from './MText';
7
6
  interface IModalOptionLoan {
8
7
  open: boolean;
@@ -26,24 +25,6 @@ export default function AlertLoan({ open, onClose }: IModalOptionLoan) {
26
25
  borderRadius: 12,
27
26
  }}
28
27
  >
29
- <View
30
- style={{
31
- flexDirection: 'row-reverse',
32
- marginTop: 5,
33
- }}
34
- >
35
- <TouchableOpacity
36
- onPress={onClose}
37
- style={{
38
- width: 30,
39
- height: 30,
40
- alignItems: 'center',
41
- justifyContent: 'center',
42
- }}
43
- >
44
- <Close2Icon />
45
- </TouchableOpacity>
46
- </View>
47
28
  <Image
48
29
  source={require('../assets/img/Frame1000011990.png')}
49
30
  style={{
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_AppModal","_icons","_MText","_jsxFileName","modalSafeProps","useNativeDriver","useNativeDriverForBackdrop","hideModalContentWhileAnimating","backdropTransitionOutTiming","AlertLoan","_ref","open","onClose","default","createElement","_extends2","isVisible","__self","__source","fileName","lineNumber","columnNumber","SafeAreaView","style","backgroundColor","borderRadius","View","flexDirection","marginTop","TouchableOpacity","onPress","width","height","alignItems","justifyContent","Close2Icon","Image","source","resizeMode","paddingHorizontal","gap","MText","fontSize","fontWeight","textAlign","color","borderWidth","borderColor","marginBottom"],"sourceRoot":"../../../src","sources":["components/AlertLoan.tsx"],"mappings":"sPACA,IAAAA,MAAA,C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,sBAEM,CACS,CACd,CACM,CACT,CAAC,CAEZ","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_AppModal","_MText","_jsxFileName","modalSafeProps","useNativeDriver","useNativeDriverForBackdrop","hideModalContentWhileAnimating","backdropTransitionOutTiming","AlertLoan","_ref","open","onClose","default","createElement","_extends2","isVisible","__self","__source","fileName","lineNumber","columnNumber","SafeAreaView","style","backgroundColor","borderRadius","Image","source","height","resizeMode","width","View","paddingHorizontal","marginTop","flexDirection","gap","alignItems","MText","fontSize","fontWeight","textAlign","color","TouchableOpacity","onPress","borderWidth","borderColor","justifyContent","marginBottom"],"sourceRoot":"../../../src","sources":["components/AlertLoan.tsx"],"mappings":"sPACA,IAAAA,MAAA,CAAAC,sBAAA,CAAAC,OAAA,WACA,IAAAC,YAAA,CAAAD,OAAA,iBACA,IAAAE,SAAA,CAAAH,sBAAA,CAAAC,OAAA,gBACA,IAAAG,MAAA,CAAAH,OAAA,YAAgC,IAAAI,YAAA,uEAOhC,GAAM,CAAAC,cAAc,CAAG,CACrBC,eAAe,CAAE,IAAI,CACrBC,0BAA0B,CAAE,IAAI,CAChCC,8BAA8B,CAAE,IAAI,CACpCC,2BAA2B,CAAE,CAC/B,CAAC,CAEc,QAAS,CAAAC,SAASA,CAAAC,IAAA,CAAsC,IAAnC,CAAAC,IAAI,CAAAD,IAAA,CAAJC,IAAI,CAAEC,OAAO,CAAAF,IAAA,CAAPE,OAAO,CAC/C,MACE,CAAAf,MAAA,CAAAgB,OAAA,CAAAC,aAAA,CAACb,SAAA,CAAAY,OAAK,IAAAE,SAAA,CAAAF,OAAA,GAACG,SAAS,CAAEL,IAAK,EAAKP,cAAc,EAAAa,MAAA,MAAAC,QAAA,EAAAC,QAAA,CAAAhB,YAAA,CAAAiB,UAAA,IAAAC,YAAA,MACxCxB,MAAA,CAAAgB,OAAA,CAAAC,aAAA,CAACd,YAAA,CAAAsB,YAAY,EACXC,KAAK,CAAE,CACLC,eAAe,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,UAAA,IAAAC,YAAA,MAEFxB,MAAA,CAAAgB,OAAA,CAAAC,aAAA,CAACZ,MAAA,CAAAmC,KAAK,EACJd,KAAK,CAAE,CACLe,QAAQ,CAAE,EAAE,CACZG,KAAK,CAAE,SAAS,CAChBF,UAAU,CAAE,MACd,CAAE,CAAAtB,MAAA,MAAAC,QAAA,EAAAC,QAAA,CAAAhB,YAAA,CAAAiB,UAAA,IAAAC,YAAA,MACH,yDAEM,CAAC,CAAC,GAAG,CAAC,iMAGR,CAAC,CACRxB,MAAA,CAAAgB,OAAA,CAAAC,aAAA,CAACd,YAAA,CAAA0C,gBAAgB,EACfC,OAAO,CAAE/B,OAAQ,CACjBW,KAAK,CAAE,CACLqB,WAAW,CAAE,CAAC,CACdC,WAAW,CAAE,SAAS,CACtBpB,YAAY,CAAE,EAAE,CAChBG,MAAM,CAAE,EAAE,CACVQ,UAAU,CAAE,QAAQ,CACpBU,cAAc,CAAE,QAAQ,CACxBC,YAAY,CAAE,EAAE,CAChBd,SAAS,CAAE,EAAE,CACbH,KAAK,CAAE,MACT,CAAE,CAAAb,MAAA,MAAAC,QAAA,EAAAC,QAAA,CAAAhB,YAAA,CAAAiB,UAAA,IAAAC,YAAA,MAEFxB,MAAA,CAAAgB,OAAA,CAAAC,aAAA,CAACZ,MAAA,CAAAmC,KAAK,EACJd,KAAK,CAAE,CACLkB,KAAK,CAAE,SACT,CAAE,CAAAxB,MAAA,MAAAC,QAAA,EAAAC,QAAA,CAAAhB,YAAA,CAAAiB,UAAA,IAAAC,YAAA,MACH,sBAEM,CACS,CACd,CACM,CACT,CAAC,CAEZ","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=TTSSelfie;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _native=require("@react-navigation/native");var _reactNativePermissions=require("react-native-permissions");var _MText=require("../../components/MText");var _MButton=_interopRequireDefault(require("../../components/MButton"));var _CommonStyles=require("../CommonStyles");var _icons=require("../../assets/icons");var _Loading=_interopRequireDefault(require("../../components/Loading"));var _api=require("../../services/api");var _navigation=require("../../navigation");var _AppStore=_interopRequireDefault(require("../../AppStore"));var _utils=require("../../utils");var _reactNativeSafeAreaContext=require("react-native-safe-area-context");var _reactNativeVisionCamera=require("react-native-vision-camera");var _AlertGlobal=require("../../components/ModalNotification/AlertGlobal");var _jsxFileName="/Users/tima/Tima/react-native-timacare/src/screens/toan-trinh-so/TTSSelfie.tsx";function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap(),n=new WeakMap();return(_interopRequireWildcard=function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var o,i,f={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return f;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,f);}for(var _t in e)"default"!==_t&&{}.hasOwnProperty.call(e,_t)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,_t))&&(i.get||i.set)?o(f,_t,i):f[_t]=e[_t]);return f;})(e,t);}function TTSSelfie(props){var insets=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)();var isFocused=(0,_native.useIsFocused)();var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),shouldRenderCamera=_useState2[0],setShouldRenderCamera=_useState2[1];var navigation=(0,_native.useNavigation)();var _useState3=(0,_react.useState)(false),_useState4=(0,_slicedToArray2.default)(_useState3,2),taking=_useState4[0],setTaking=_useState4[1];var _useState5=(0,_react.useState)(false),_useState6=(0,_slicedToArray2.default)(_useState5,2),isLoading=_useState6[0],setIsLoading=_useState6[1];var _useState7=(0,_react.useState)(false),_useState8=(0,_slicedToArray2.default)(_useState7,2),passPermission=_useState8[0],setPassPermission=_useState8[1];var device=(0,_reactNativeVisionCamera.useCameraDevice)('front');var myCamera=(0,_react.useRef)(null);var format=(0,_reactNativeVisionCamera.useCameraFormat)(device,[{photoResolution:{width:1280,height:1280}}]);var _requestPermissions=function requestPermissions(){(0,_reactNativePermissions.request)(_reactNative.Platform.OS==='ios'?_reactNativePermissions.PERMISSIONS.IOS.CAMERA:_reactNativePermissions.PERMISSIONS.ANDROID.CAMERA).then(function(result){switch(result){case _reactNativePermissions.RESULTS.UNAVAILABLE:console.log('This feature is not available (on this device / in this context)');_AlertGlobal.AlertGlobal.show({type:'warning',title:'Thông báo',message:'Máy ảnh trên thiết bị không tương thích.\nVui lòng kiểm tra lại thiết bị!',primaryText:'Đồng ý'});break;case _reactNativePermissions.RESULTS.DENIED:console.log('The permission has not been requested / is denied but requestable');_AlertGlobal.AlertGlobal.show({type:'warning',title:'Thông báo',message:'Bạn đã từ chối quyền máy ảnh. Vui lòng cấp quyền máy ảnh để tiếp tục!',primaryText:'Đồng ý',onPrimaryPress:function onPrimaryPress(){if(_reactNative.Platform.OS==='ios'){(0,_reactNativePermissions.openSettings)();}else{_requestPermissions();}}});break;case _reactNativePermissions.RESULTS.LIMITED:console.log('The permission is limited: some actions are possible');_AlertGlobal.AlertGlobal.show({type:'warning',title:'Thông báo',message:'Quyền máy ảnh bị hạn chế. Vui lòng kiểm tra lại để tiếp tục!',primaryText:'Đồng ý',onPrimaryPress:function onPrimaryPress(){if(_reactNative.Platform.OS==='ios'){(0,_reactNativePermissions.openSettings)();}else{_requestPermissions();}}});break;case _reactNativePermissions.RESULTS.GRANTED:console.log('The permission is granted');setPassPermission(true);break;case _reactNativePermissions.RESULTS.BLOCKED:console.log('The permission is denied and not requestable anymore');_AlertGlobal.AlertGlobal.show({type:'warning',title:'Thông báo',message:'Bạn đã từ chối quyền máy ảnh. Vui lòng cấp quyền máy ảnh để tiếp tục!',primaryText:'Đồng ý',onPrimaryPress:function onPrimaryPress(){if(_reactNative.Platform.OS==='ios'){(0,_reactNativePermissions.openSettings)();}else{(0,_reactNativePermissions.openSettings)();}}});break;}});};(0,_react.useEffect)(function(){_requestPermissions();var trackEvent=function _callee(){var _props$route,_props$route$params,_props$route$params$l,_props$route2,_props$route2$params,_props$route2$params$;return _regenerator.default.async(function(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=1;return _regenerator.default.awrap((0,_utils.logEvent)('cccd_completed',{event:'cccd_completed',createdAt:new Date(),deviceId:_AppStore.default.deviceId,loanId:String(props==null?void 0:(_props$route=props.route)==null?void 0:(_props$route$params=_props$route.params)==null?void 0:(_props$route$params$l=_props$route$params.loan)==null?void 0:_props$route$params$l.id),utmSource:props==null?void 0:(_props$route2=props.route)==null?void 0:(_props$route2$params=_props$route2.params)==null?void 0:(_props$route2$params$=_props$route2$params.loan)==null?void 0:_props$route2$params$.utmSource}));case 1:(0,_utils.logEventFb)('cccd_completed');case 2:case"end":return _context.stop();}},null,null,null,Promise);};trackEvent();},[]);(0,_react.useEffect)(function(){var timeout;if(isFocused){timeout=setTimeout(function(){setShouldRenderCamera(true);},500);}else{setShouldRenderCamera(false);}return function(){return clearTimeout(timeout);};},[isFocused]);var takePhoto=function _callee2(){var data,_props$route3,_props$route3$params,_props$route3$params$,formData,response,_response$data,_props$route4,_props$route4$params,_props$route4$params$,_props$route5,_props$route5$params,_props$route5$params$,_props$route7,_props$route7$params,_props$route7$params$,_props$route6,_props$route6$params,_props$route8,_props$route8$params,_props$route9,_props$route9$params,_response$data2,_response$data2$meta;return _regenerator.default.async(function(_context2){while(1)switch(_context2.prev=_context2.next){case 0:if(!(myCamera.current==null||taking)){_context2.next=1;break;}return _context2.abrupt("return");case 1:setTaking(true);_context2.next=2;return _regenerator.default.awrap(myCamera.current.takePhoto({qualityPrioritization:'speed'}));case 2:data=_context2.sent;setTaking(false);if(!data){_context2.next=4;break;}setIsLoading(true);formData=new FormData();formData.append('LoanBriefId',props==null?void 0:(_props$route3=props.route)==null?void 0:(_props$route3$params=_props$route3.params)==null?void 0:(_props$route3$params$=_props$route3$params.loan)==null?void 0:_props$route3$params$.id);formData.append('TypeDocumentId',125);formData.append('image',{uri:'file://'+data.path,type:'image/jpg',name:'selfie.jpg'});_context2.next=3;return _regenerator.default.awrap(_api.Api.getInstance().uploadImageAutoDE(formData));case 3:response=_context2.sent;setIsLoading(false);if(response.kind==='ok'){if(((_response$data=response.data)==null?void 0:_response$data.meta.errorCode)===200){if((props==null?void 0:(_props$route4=props.route)==null?void 0:(_props$route4$params=_props$route4.params)==null?void 0:(_props$route4$params$=_props$route4$params.loan)==null?void 0:_props$route4$params$.typeLoan)===6||(props==null?void 0:(_props$route5=props.route)==null?void 0:(_props$route5$params=_props$route5.params)==null?void 0:(_props$route5$params$=_props$route5$params.loan)==null?void 0:_props$route5$params$.typeLoan)===4){navigation.push(_navigation.ScreenNames.TopupLoanInfo,{loan:props==null?void 0:(_props$route6=props.route)==null?void 0:(_props$route6$params=_props$route6.params)==null?void 0:_props$route6$params.loan});}else if((props==null?void 0:(_props$route7=props.route)==null?void 0:(_props$route7$params=_props$route7.params)==null?void 0:(_props$route7$params$=_props$route7$params.loan)==null?void 0:_props$route7$params$.typeLoan)===8){navigation.push(_navigation.ScreenNames.InfoLoanMotobike,{loan:props==null?void 0:(_props$route8=props.route)==null?void 0:(_props$route8$params=_props$route8.params)==null?void 0:_props$route8$params.loan});}else{navigation.push(_navigation.ScreenNames.ReviewInformation,{loan:props==null?void 0:(_props$route9=props.route)==null?void 0:(_props$route9$params=_props$route9.params)==null?void 0:_props$route9$params.loan});}}else{_AlertGlobal.AlertGlobal.show({type:'warning',title:'Thông báo',message:(_response$data2=response.data)==null?void 0:(_response$data2$meta=_response$data2.meta)==null?void 0:_response$data2$meta.errorMessage,primaryText:'Đóng'});}}else{_AlertGlobal.AlertGlobal.show({type:'warning',title:'Thông báo',message:'Có lỗi xảy ra. Vui lòng thử lại sau',primaryText:'Đóng'});}case 4:case"end":return _context2.stop();}},null,null,null,Promise);};return _react.default.createElement(_reactNative.View,{style:{flex:1,backgroundColor:'black'},pointerEvents:'box-none',__self:this,__source:{fileName:_jsxFileName,lineNumber:210,columnNumber:5}},passPermission&&shouldRenderCamera?_react.default.createElement(_reactNative.View,{style:[_CommonStyles.commonStyles.fill,{width:_reactNative.Dimensions.get('window').width,height:_reactNative.Dimensions.get('window').height}],__self:this,__source:{fileName:_jsxFileName,lineNumber:215,columnNumber:9}},_react.default.createElement(_reactNative.View,{style:{marginVertical:24,flexDirection:'row',alignItems:'center',justifyContent:'center',marginTop:insets.top+16},__self:this,__source:{fileName:_jsxFileName,lineNumber:224,columnNumber:11}},_react.default.createElement(_MButton.default,{onPress:function onPress(){navigation.goBack();},style:{position:'absolute',left:16},__self:this,__source:{fileName:_jsxFileName,lineNumber:233,columnNumber:13}},_react.default.createElement(_icons.IconBackWhite,{__self:this,__source:{fileName:_jsxFileName,lineNumber:242,columnNumber:15}})),_react.default.createElement(_MText.MText,{style:{color:'white',fontWeight:'bold',textAlgin:'center'},__self:this,__source:{fileName:_jsxFileName,lineNumber:244,columnNumber:13}},"X\xE1c th\u1EF1c khu\xF4n m\u1EB7t")),_react.default.createElement(_reactNativeVisionCamera.Camera,{style:{width:_reactNative.Dimensions.get('window').width,height:_reactNative.Dimensions.get('window').width*4/3.1},ref:myCamera,device:device,isActive:true,photo:true,format:format,__self:this,__source:{fileName:_jsxFileName,lineNumber:255,columnNumber:11}}),_react.default.createElement(_reactNative.View,{style:{position:'absolute',bottom:20,left:0,right:0},__self:this,__source:{fileName:_jsxFileName,lineNumber:267,columnNumber:11}},!taking&&_react.default.createElement(_react.default.Fragment,null,_react.default.createElement(_MText.MText,{style:{color:'white',textAlign:'center',fontSize:14,paddingHorizontal:24},__self:this,__source:{fileName:_jsxFileName,lineNumber:277,columnNumber:17}},"Xin vui l\xF2ng nh\xECn th\u1EB3ng, khu\xF4n m\u1EB7t \u1EDF trong khung h\xECnh, \xE1nh s\xE1ng \u0111\u1EE7 r\xF5 n\xE9t khu\xF4n m\u1EB7t"),_react.default.createElement(_reactNative.View,{style:{alignItems:'center',marginVertical:24},__self:this,__source:{fileName:_jsxFileName,lineNumber:288,columnNumber:17}},_react.default.createElement(_MButton.default,{onPress:function onPress(){takePhoto();},__self:this,__source:{fileName:_jsxFileName,lineNumber:294,columnNumber:19}},_react.default.createElement(_icons.TakePhotoSvg,{__self:this,__source:{fileName:_jsxFileName,lineNumber:299,columnNumber:21}})))))):null,_react.default.createElement(_Loading.default,{isLoading:isLoading,__self:this,__source:{fileName:_jsxFileName,lineNumber:308,columnNumber:7}}));}
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=TTSSelfie;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _native=require("@react-navigation/native");var _reactNativeSafeAreaContext=require("react-native-safe-area-context");var _reactNativePermissions=require("react-native-permissions");var _reactNativeVisionCamera=require("react-native-vision-camera");var _reactNativeSvg=require("react-native-svg");var _MText=require("../../components/MText");var _MButton=_interopRequireDefault(require("../../components/MButton"));var _CommonStyles=require("../CommonStyles");var _icons=require("../../assets/icons");var _Loading=_interopRequireDefault(require("../../components/Loading"));var _api=require("../../services/api");var _navigation=require("../../navigation");var _AppStore=_interopRequireDefault(require("../../AppStore"));var _utils=require("../../utils");var _AlertGlobal=require("../../components/ModalNotification/AlertGlobal");var _jsxFileName="/Users/tima/Tima/react-native-timacare/src/screens/toan-trinh-so/TTSSelfie.tsx";function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap(),n=new WeakMap();return(_interopRequireWildcard=function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var o,i,f={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return f;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,f);}for(var _t2 in e)"default"!==_t2&&{}.hasOwnProperty.call(e,_t2)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,_t2))&&(i.get||i.set)?o(f,_t2,i):f[_t2]=e[_t2]);return f;})(e,t);}var ORANGE='#F05123';var SCREEN_WIDTH=_reactNative.Dimensions.get('window').width;var OVAL_WIDTH=Math.round(SCREEN_WIDTH*0.72);var OVAL_HEIGHT=Math.round(OVAL_WIDTH*1.33);function TTSSelfie(props){var _this=this;var insets=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)();var isFocused=(0,_native.useIsFocused)();var navigation=(0,_native.useNavigation)();var myCamera=(0,_react.useRef)(null);var takingRef=(0,_react.useRef)(false);var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),passPermission=_useState2[0],setPassPermission=_useState2[1];var _useState3=(0,_react.useState)(false),_useState4=(0,_slicedToArray2.default)(_useState3,2),shouldRenderCamera=_useState4[0],setShouldRenderCamera=_useState4[1];var _useState5=(0,_react.useState)(false),_useState6=(0,_slicedToArray2.default)(_useState5,2),taking=_useState6[0],setTaking=_useState6[1];var _useState7=(0,_react.useState)(false),_useState8=(0,_slicedToArray2.default)(_useState7,2),isLoading=_useState8[0],setIsLoading=_useState8[1];var _useState9=(0,_react.useState)({width:SCREEN_WIDTH,height:0}),_useState0=(0,_slicedToArray2.default)(_useState9,2),stage=_useState0[0],setStage=_useState0[1];var device=(0,_reactNativeVisionCamera.useCameraDevice)('front');var format=(0,_reactNativeVisionCamera.useCameraFormat)(device,[{photoResolution:{width:1280,height:1280}}]);var _requestPermissions=function requestPermissions(){(0,_reactNativePermissions.request)(_reactNative.Platform.OS==='ios'?_reactNativePermissions.PERMISSIONS.IOS.CAMERA:_reactNativePermissions.PERMISSIONS.ANDROID.CAMERA).then(function(result){switch(result){case _reactNativePermissions.RESULTS.UNAVAILABLE:_AlertGlobal.AlertGlobal.show({type:'warning',title:'Thông báo',message:'Máy ảnh trên thiết bị không tương thích.\nVui lòng kiểm tra lại thiết bị!',primaryText:'Đồng ý'});break;case _reactNativePermissions.RESULTS.DENIED:_AlertGlobal.AlertGlobal.show({type:'warning',title:'Thông báo',message:'Bạn đã từ chối quyền máy ảnh. Vui lòng cấp quyền máy ảnh để tiếp tục!',primaryText:'Đồng ý',onPrimaryPress:function onPrimaryPress(){if(_reactNative.Platform.OS==='ios'){(0,_reactNativePermissions.openSettings)();}else{_requestPermissions();}}});break;case _reactNativePermissions.RESULTS.LIMITED:_AlertGlobal.AlertGlobal.show({type:'warning',title:'Thông báo',message:'Quyền máy ảnh bị hạn chế. Vui lòng kiểm tra lại để tiếp tục!',primaryText:'Đồng ý',onPrimaryPress:function onPrimaryPress(){if(_reactNative.Platform.OS==='ios'){(0,_reactNativePermissions.openSettings)();}else{_requestPermissions();}}});break;case _reactNativePermissions.RESULTS.GRANTED:setPassPermission(true);break;case _reactNativePermissions.RESULTS.BLOCKED:_AlertGlobal.AlertGlobal.show({type:'warning',title:'Thông báo',message:'Bạn đã từ chối quyền máy ảnh. Vui lòng cấp quyền máy ảnh để tiếp tục!',primaryText:'Đồng ý',onPrimaryPress:function onPrimaryPress(){return(0,_reactNativePermissions.openSettings)();}});break;}});};(0,_react.useEffect)(function(){_requestPermissions();var trackEvent=function _callee(){var _props$route,_props$route$params,_props$route$params$l,_props$route2,_props$route2$params,_props$route2$params$;return _regenerator.default.async(function(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=1;return _regenerator.default.awrap((0,_utils.logEvent)('cccd_completed',{event:'cccd_completed',createdAt:new Date(),deviceId:_AppStore.default.deviceId,loanId:String(props==null?void 0:(_props$route=props.route)==null?void 0:(_props$route$params=_props$route.params)==null?void 0:(_props$route$params$l=_props$route$params.loan)==null?void 0:_props$route$params$l.id),utmSource:props==null?void 0:(_props$route2=props.route)==null?void 0:(_props$route2$params=_props$route2.params)==null?void 0:(_props$route2$params$=_props$route2$params.loan)==null?void 0:_props$route2$params$.utmSource}));case 1:(0,_utils.logEventFb)('cccd_completed');case 2:case"end":return _context.stop();}},null,null,null,Promise);};trackEvent();},[]);(0,_react.useEffect)(function(){var timeout;if(isFocused){timeout=setTimeout(function(){setShouldRenderCamera(true);},500);}else{setShouldRenderCamera(false);}return function(){return clearTimeout(timeout);};},[isFocused]);var takePhoto=function _callee2(){var _props$route3,_props$route3$params,data,loan,formData,response,_response$data,_response$data2,_response$data2$meta,_t;return _regenerator.default.async(function(_context2){while(1)switch(_context2.prev=_context2.next){case 0:if(!(myCamera.current==null||takingRef.current)){_context2.next=1;break;}return _context2.abrupt("return");case 1:takingRef.current=true;setTaking(true);_context2.prev=2;_context2.next=3;return _regenerator.default.awrap(myCamera.current.takePhoto({qualityPrioritization:'speed'}));case 3:data=_context2.sent;setTaking(false);if(data){_context2.next=4;break;}takingRef.current=false;return _context2.abrupt("return");case 4:setIsLoading(true);loan=props==null?void 0:(_props$route3=props.route)==null?void 0:(_props$route3$params=_props$route3.params)==null?void 0:_props$route3$params.loan;formData=new FormData();formData.append('LoanBriefId',loan==null?void 0:loan.id);formData.append('TypeDocumentId',125);formData.append('image',{uri:'file://'+data.path,type:'image/jpg',name:'selfie.jpg'});_context2.next=5;return _regenerator.default.awrap(_api.Api.getInstance().uploadImageAutoDE(formData));case 5:response=_context2.sent;setIsLoading(false);takingRef.current=false;if(response.kind==='ok'){if(((_response$data=response.data)==null?void 0:_response$data.meta.errorCode)===200){if((loan==null?void 0:loan.typeLoan)===6||(loan==null?void 0:loan.typeLoan)===4){navigation.push(_navigation.ScreenNames.TopupLoanInfo,{loan:loan});}else if((loan==null?void 0:loan.typeLoan)===8){navigation.push(_navigation.ScreenNames.InfoLoanMotobike,{loan:loan});}else if((loan==null?void 0:loan.typeLoan)===7){navigation.push(_navigation.ScreenNames.ReviewInfoLoanBuyCar,{loan:loan});}else{navigation.push(_navigation.ScreenNames.ReviewInformation,{loan:loan});}}else{_AlertGlobal.AlertGlobal.show({type:'warning',title:'Thông báo',message:(_response$data2=response.data)==null?void 0:(_response$data2$meta=_response$data2.meta)==null?void 0:_response$data2$meta.errorMessage,primaryText:'Đóng'});}}else{_AlertGlobal.AlertGlobal.show({type:'warning',title:'Thông báo',message:'Có lỗi xảy ra. Vui lòng thử lại sau',primaryText:'Đóng'});}_context2.next=7;break;case 6:_context2.prev=6;_t=_context2["catch"](2);console.log('takePhoto error',_t);setTaking(false);setIsLoading(false);takingRef.current=false;case 7:case"end":return _context2.stop();}},null,null,[[2,6]],Promise);};var renderOvalMask=function renderOvalMask(){var w=stage.width,h=stage.height;if(!w||!h)return null;var cx=w/2;var cy=h/2;var rx=OVAL_WIDTH/2;var ry=Math.min(OVAL_HEIGHT,h-16)/2;var hole="M "+(cx-rx)+" "+cy+" a "+rx+" "+ry+" 0 1 0 "+rx*2+" 0 a "+rx+" "+ry+" 0 1 0 "+-rx*2+" 0 Z";return _react.default.createElement(_reactNativeSvg.Svg,{pointerEvents:"none",style:_reactNative.StyleSheet.absoluteFill,width:w,height:h,__self:_this,__source:{fileName:_jsxFileName,lineNumber:226,columnNumber:7}},_react.default.createElement(_reactNativeSvg.Path,{d:"M 0 0 H "+w+" V "+h+" H 0 Z "+hole,fill:"#FFFFFF",fillRule:"evenodd",__self:_this,__source:{fileName:_jsxFileName,lineNumber:232,columnNumber:9}}),_react.default.createElement(_reactNativeSvg.Ellipse,{cx:cx,cy:cy,rx:rx+8,ry:ry+8,stroke:ORANGE,strokeWidth:1,strokeOpacity:0.25,fill:"none",__self:_this,__source:{fileName:_jsxFileName,lineNumber:238,columnNumber:9}}),_react.default.createElement(_reactNativeSvg.Ellipse,{cx:cx,cy:cy,rx:rx,ry:ry,stroke:ORANGE,strokeWidth:2,strokeDasharray:"6 5",strokeLinecap:"round",fill:"none",__self:_this,__source:{fileName:_jsxFileName,lineNumber:248,columnNumber:9}}));};return _react.default.createElement(_reactNative.View,{style:styles.container,__self:this,__source:{fileName:_jsxFileName,lineNumber:264,columnNumber:5}},_react.default.createElement(_reactNative.View,{style:[styles.header,{paddingTop:insets.top+12}],__self:this,__source:{fileName:_jsxFileName,lineNumber:265,columnNumber:7}},_react.default.createElement(_MButton.default,{onPress:function onPress(){return navigation.goBack();},style:styles.backButton,__self:this,__source:{fileName:_jsxFileName,lineNumber:266,columnNumber:9}},_react.default.createElement(_icons.IconBack,{__self:this,__source:{fileName:_jsxFileName,lineNumber:267,columnNumber:11}})),_react.default.createElement(_reactNative.View,{style:styles.titleWrap,__self:this,__source:{fileName:_jsxFileName,lineNumber:269,columnNumber:9}},_react.default.createElement(_MText.MText,{style:styles.headerTitle,__self:this,__source:{fileName:_jsxFileName,lineNumber:270,columnNumber:11}},"X\xE1c th\u1EF1c khu\xF4n m\u1EB7t"))),_react.default.createElement(_reactNative.View,{style:styles.stage,onLayout:function onLayout(e){return setStage(e.nativeEvent.layout);},__self:this,__source:{fileName:_jsxFileName,lineNumber:274,columnNumber:7}},passPermission&&shouldRenderCamera&&device?_react.default.createElement(_reactNativeVisionCamera.Camera,{ref:myCamera,style:_reactNative.StyleSheet.absoluteFill,device:device,isActive:isFocused,photo:true,format:format,__self:this,__source:{fileName:_jsxFileName,lineNumber:279,columnNumber:11}}):_react.default.createElement(_reactNative.View,{style:[_reactNative.StyleSheet.absoluteFill,_CommonStyles.commonStyles.alignCenter,_CommonStyles.commonStyles.justifyCenter],__self:this,__source:{fileName:_jsxFileName,lineNumber:288,columnNumber:11}},_react.default.createElement(_reactNative.ActivityIndicator,{color:ORANGE,size:"large",__self:this,__source:{fileName:_jsxFileName,lineNumber:295,columnNumber:13}})),renderOvalMask()),_react.default.createElement(_MText.MText,{style:styles.instruction,__self:this,__source:{fileName:_jsxFileName,lineNumber:301,columnNumber:7}},"Xin vui l\xF2ng nh\xECn th\u1EB3ng, khu\xF4n m\u1EB7t \u1EDF trong khung h\xECnh, \xE1nh s\xE1ng \u0111\u1EE7 r\xF5 n\xE9t khu\xF4n m\u1EB7t"),_react.default.createElement(_reactNative.View,{style:[styles.captureWrap,{marginBottom:insets.bottom+24}],__self:this,__source:{fileName:_jsxFileName,lineNumber:306,columnNumber:7}},_react.default.createElement(_reactNative.View,{style:styles.captureHalo,__self:this,__source:{fileName:_jsxFileName,lineNumber:308,columnNumber:9}},taking?_react.default.createElement(_reactNative.ActivityIndicator,{color:ORANGE,size:"large",__self:this,__source:{fileName:_jsxFileName,lineNumber:310,columnNumber:13}}):_react.default.createElement(_MButton.default,{onPress:takePhoto,__self:this,__source:{fileName:_jsxFileName,lineNumber:312,columnNumber:13}},_react.default.createElement(_icons.TakePhotoSvg,{__self:this,__source:{fileName:_jsxFileName,lineNumber:313,columnNumber:15}})))),_react.default.createElement(_Loading.default,{isLoading:isLoading,__self:this,__source:{fileName:_jsxFileName,lineNumber:319,columnNumber:7}}));}var styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:'#FFFFFF'},header:{flexDirection:'row',alignItems:'center',paddingHorizontal:16,paddingBottom:8},backButton:{width:32,height:32,justifyContent:'center'},titleWrap:{flex:1,alignItems:'center',justifyContent:'center',marginRight:32},headerTitle:{color:'#333333',fontSize:16,fontWeight:'600'},stage:{flex:1,overflow:'hidden',backgroundColor:'#FFFFFF'},instruction:{textAlign:'center',color:'#333333',fontSize:14,lineHeight:20,paddingHorizontal:32,marginTop:16},captureWrap:{alignItems:'center',marginTop:24},captureHalo:{width:88,height:88,borderRadius:44,alignItems:'center',justifyContent:'center',backgroundColor:'rgba(240, 81, 35, 0.10)'}});
2
2
  //# sourceMappingURL=TTSSelfie.js.map
@@ -1,41 +1,57 @@
1
1
  // @ts-nocheck
2
2
  import React, { useEffect, useRef, useState } from 'react';
3
- import { Dimensions, Platform, View } from 'react-native';
3
+ import {
4
+ ActivityIndicator,
5
+ Dimensions,
6
+ Platform,
7
+ StyleSheet,
8
+ View,
9
+ } from 'react-native';
4
10
  import { useNavigation, useIsFocused } from '@react-navigation/native';
11
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
5
12
  import {
6
13
  request,
7
14
  PERMISSIONS,
8
15
  RESULTS,
9
16
  openSettings,
10
17
  } from 'react-native-permissions';
18
+ import {
19
+ Camera,
20
+ useCameraDevice,
21
+ useCameraFormat,
22
+ } from 'react-native-vision-camera';
23
+ import { Svg, Ellipse, Path } from 'react-native-svg';
11
24
  import { MText } from '../../components/MText';
12
25
  import MButton from '../../components/MButton';
13
26
  import { commonStyles } from '../CommonStyles';
14
- import { IconBackWhite, TakePhotoSvg } from '../../assets/icons';
27
+ import { IconBack, TakePhotoSvg } from '../../assets/icons';
15
28
  import Loading from '../../components/Loading';
16
29
  import { Api } from '../../services/api';
17
30
  import { ScreenNames } from '../../navigation';
18
31
  import appStore from '../../AppStore';
19
32
  import { logEvent, logEventFb } from '../../utils';
20
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
21
- import {
22
- Camera,
23
- useCameraDevice,
24
- useCameraFormat,
25
- } from 'react-native-vision-camera';
26
33
  import { AlertGlobal } from '../../components/ModalNotification/AlertGlobal';
27
34
 
35
+ const ORANGE = '#F05123';
36
+ const SCREEN_WIDTH = Dimensions.get('window').width;
37
+ // Khung oval: rộng ~72% màn hình, cao gấp 1.33 lần chiều rộng (tỉ lệ khuôn mặt)
38
+ const OVAL_WIDTH = Math.round(SCREEN_WIDTH * 0.72);
39
+ const OVAL_HEIGHT = Math.round(OVAL_WIDTH * 1.33);
40
+
28
41
  export default function TTSSelfie(props: any) {
29
42
  const insets = useSafeAreaInsets();
30
43
  const isFocused = useIsFocused();
31
- const [shouldRenderCamera, setShouldRenderCamera] = useState(false);
32
44
  const navigation = useNavigation();
45
+ const myCamera = useRef(null);
46
+ const takingRef = useRef(false);
47
+ const [passPermission, setPassPermission] = useState(false);
48
+ const [shouldRenderCamera, setShouldRenderCamera] = useState(false);
33
49
  const [taking, setTaking] = useState(false);
34
50
  const [isLoading, setIsLoading] = useState(false);
35
- const [passPermission, setPassPermission] = useState(false);
36
- const device = useCameraDevice('front');
37
- const myCamera = useRef(null);
51
+ // Kích thước vùng preview để vẽ mặt nạ oval đúng tâm
52
+ const [stage, setStage] = useState({ width: SCREEN_WIDTH, height: 0 });
38
53
 
54
+ const device = useCameraDevice('front');
39
55
  const format = useCameraFormat(device, [
40
56
  { photoResolution: { width: 1280, height: 1280 } },
41
57
  ]);
@@ -48,9 +64,6 @@ export default function TTSSelfie(props: any) {
48
64
  ).then((result) => {
49
65
  switch (result) {
50
66
  case RESULTS.UNAVAILABLE:
51
- console.log(
52
- 'This feature is not available (on this device / in this context)'
53
- );
54
67
  AlertGlobal.show({
55
68
  type: 'warning',
56
69
  title: 'Thông báo',
@@ -60,9 +73,6 @@ export default function TTSSelfie(props: any) {
60
73
  });
61
74
  break;
62
75
  case RESULTS.DENIED:
63
- console.log(
64
- 'The permission has not been requested / is denied but requestable'
65
- );
66
76
  AlertGlobal.show({
67
77
  type: 'warning',
68
78
  title: 'Thông báo',
@@ -79,7 +89,6 @@ export default function TTSSelfie(props: any) {
79
89
  });
80
90
  break;
81
91
  case RESULTS.LIMITED:
82
- console.log('The permission is limited: some actions are possible');
83
92
  AlertGlobal.show({
84
93
  type: 'warning',
85
94
  title: 'Thông báo',
@@ -96,24 +105,16 @@ export default function TTSSelfie(props: any) {
96
105
  });
97
106
  break;
98
107
  case RESULTS.GRANTED:
99
- console.log('The permission is granted');
100
108
  setPassPermission(true);
101
109
  break;
102
110
  case RESULTS.BLOCKED:
103
- console.log('The permission is denied and not requestable anymore');
104
111
  AlertGlobal.show({
105
112
  type: 'warning',
106
113
  title: 'Thông báo',
107
114
  message:
108
115
  'Bạn đã từ chối quyền máy ảnh. Vui lòng cấp quyền máy ảnh để tiếp tục!',
109
116
  primaryText: 'Đồng ý',
110
- onPrimaryPress: () => {
111
- if (Platform.OS === 'ios') {
112
- openSettings();
113
- } else {
114
- openSettings();
115
- }
116
- },
117
+ onPrimaryPress: () => openSettings(),
117
118
  });
118
119
  break;
119
120
  }
@@ -137,30 +138,34 @@ export default function TTSSelfie(props: any) {
137
138
 
138
139
  useEffect(() => {
139
140
  let timeout: NodeJS.Timeout;
140
-
141
141
  if (isFocused) {
142
142
  // Delay mounting camera to give Android time to release the previous one
143
143
  timeout = setTimeout(() => {
144
144
  setShouldRenderCamera(true);
145
- }, 500); // thử 300ms–500ms nếu cần
145
+ }, 500);
146
146
  } else {
147
147
  setShouldRenderCamera(false);
148
148
  }
149
-
150
149
  return () => clearTimeout(timeout);
151
150
  }, [isFocused]);
152
151
 
153
152
  const takePhoto = async () => {
154
- if (myCamera.current == null || taking) return;
153
+ if (myCamera.current == null || takingRef.current) return;
154
+ takingRef.current = true;
155
155
  setTaking(true);
156
- const data = await myCamera.current.takePhoto({
157
- qualityPrioritization: 'speed',
158
- });
159
- setTaking(false);
160
- if (data) {
156
+ try {
157
+ const data = await myCamera.current.takePhoto({
158
+ qualityPrioritization: 'speed',
159
+ });
160
+ setTaking(false);
161
+ if (!data) {
162
+ takingRef.current = false;
163
+ return;
164
+ }
161
165
  setIsLoading(true);
166
+ const loan = props?.route?.params?.loan;
162
167
  const formData = new FormData();
163
- formData.append('LoanBriefId', props?.route?.params?.loan?.id);
168
+ formData.append('LoanBriefId', loan?.id);
164
169
  formData.append('TypeDocumentId', 125); // Anh selfie
165
170
  formData.append('image', {
166
171
  uri: 'file://' + data.path,
@@ -169,23 +174,17 @@ export default function TTSSelfie(props: any) {
169
174
  });
170
175
  const response = await Api.getInstance().uploadImageAutoDE(formData);
171
176
  setIsLoading(false);
177
+ takingRef.current = false;
172
178
  if (response.kind === 'ok') {
173
179
  if (response.data?.meta.errorCode === 200) {
174
- if (
175
- props?.route?.params?.loan?.typeLoan === 6 ||
176
- props?.route?.params?.loan?.typeLoan === 4
177
- ) {
178
- navigation.push(ScreenNames.TopupLoanInfo, {
179
- loan: props?.route?.params?.loan,
180
- });
181
- } else if (props?.route?.params?.loan?.typeLoan === 8) {
182
- navigation.push(ScreenNames.InfoLoanMotobike, {
183
- loan: props?.route?.params?.loan,
184
- });
180
+ if (loan?.typeLoan === 6 || loan?.typeLoan === 4) {
181
+ navigation.push(ScreenNames.TopupLoanInfo, { loan });
182
+ } else if (loan?.typeLoan === 8) {
183
+ navigation.push(ScreenNames.InfoLoanMotobike, { loan });
184
+ } else if (loan?.typeLoan === 7) {
185
+ navigation.push(ScreenNames.ReviewInfoLoanBuyCar, { loan });
185
186
  } else {
186
- navigation.push(ScreenNames.ReviewInformation, {
187
- loan: props?.route?.params?.loan,
188
- });
187
+ navigation.push(ScreenNames.ReviewInformation, { loan });
189
188
  }
190
189
  } else {
191
190
  AlertGlobal.show({
@@ -203,109 +202,161 @@ export default function TTSSelfie(props: any) {
203
202
  primaryText: 'Đóng',
204
203
  });
205
204
  }
205
+ } catch (err) {
206
+ console.log('takePhoto error', err);
207
+ setTaking(false);
208
+ setIsLoading(false);
209
+ takingRef.current = false;
206
210
  }
207
211
  };
208
212
 
213
+ // Mặt nạ: phủ trắng toàn bộ vùng preview, khoét một lỗ hình oval ở giữa
214
+ // (fillRule evenodd) -> chỉ nhìn thấy camera bên trong oval.
215
+ const renderOvalMask = () => {
216
+ const { width: w, height: h } = stage;
217
+ if (!w || !h) return null;
218
+ const cx = w / 2;
219
+ const cy = h / 2;
220
+ const rx = OVAL_WIDTH / 2;
221
+ const ry = Math.min(OVAL_HEIGHT, h - 16) / 2;
222
+ const hole = `M ${cx - rx} ${cy} a ${rx} ${ry} 0 1 0 ${
223
+ rx * 2
224
+ } 0 a ${rx} ${ry} 0 1 0 ${-rx * 2} 0 Z`;
225
+ return (
226
+ <Svg
227
+ pointerEvents="none"
228
+ style={StyleSheet.absoluteFill}
229
+ width={w}
230
+ height={h}
231
+ >
232
+ <Path
233
+ d={`M 0 0 H ${w} V ${h} H 0 Z ${hole}`}
234
+ fill="#FFFFFF"
235
+ fillRule="evenodd"
236
+ />
237
+ {/* Vòng ngoài mờ tạo chiều sâu cho khung, vòng trong nét đứt là mốc căn mặt */}
238
+ <Ellipse
239
+ cx={cx}
240
+ cy={cy}
241
+ rx={rx + 8}
242
+ ry={ry + 8}
243
+ stroke={ORANGE}
244
+ strokeWidth={1}
245
+ strokeOpacity={0.25}
246
+ fill="none"
247
+ />
248
+ <Ellipse
249
+ cx={cx}
250
+ cy={cy}
251
+ rx={rx}
252
+ ry={ry}
253
+ stroke={ORANGE}
254
+ strokeWidth={2}
255
+ strokeDasharray="6 5"
256
+ strokeLinecap="round"
257
+ fill="none"
258
+ />
259
+ </Svg>
260
+ );
261
+ };
262
+
209
263
  return (
210
- <View
211
- style={{ flex: 1, backgroundColor: 'black' }}
212
- pointerEvents={'box-none'}
213
- >
214
- {passPermission && shouldRenderCamera ? (
215
- <View
216
- style={[
217
- commonStyles.fill,
218
- {
219
- width: Dimensions.get('window').width,
220
- height: Dimensions.get('window').height,
221
- },
222
- ]}
223
- >
224
- <View
225
- style={{
226
- marginVertical: 24,
227
- flexDirection: 'row',
228
- alignItems: 'center',
229
- justifyContent: 'center',
230
- marginTop: insets.top + 16,
231
- }}
232
- >
233
- <MButton
234
- onPress={() => {
235
- navigation.goBack();
236
- }}
237
- style={{
238
- position: 'absolute',
239
- left: 16,
240
- }}
241
- >
242
- <IconBackWhite />
243
- </MButton>
244
- <MText
245
- style={{
246
- color: 'white',
247
- fontWeight: 'bold',
248
- textAlgin: 'center',
249
- }}
250
- >
251
- Xác thực khuôn mặt
252
- </MText>
253
- </View>
264
+ <View style={styles.container}>
265
+ <View style={[styles.header, { paddingTop: insets.top + 12 }]}>
266
+ <MButton onPress={() => navigation.goBack()} style={styles.backButton}>
267
+ <IconBack />
268
+ </MButton>
269
+ <View style={styles.titleWrap}>
270
+ <MText style={styles.headerTitle}>Xác thực khuôn mặt</MText>
271
+ </View>
272
+ </View>
254
273
 
274
+ <View
275
+ style={styles.stage}
276
+ onLayout={(e) => setStage(e.nativeEvent.layout)}
277
+ >
278
+ {passPermission && shouldRenderCamera && device ? (
255
279
  <Camera
256
- style={{
257
- width: Dimensions.get('window').width,
258
- height: (Dimensions.get('window').width * 4) / 3.1,
259
- }}
260
280
  ref={myCamera}
281
+ style={StyleSheet.absoluteFill}
261
282
  device={device}
262
- isActive={true}
283
+ isActive={isFocused}
263
284
  photo={true}
264
285
  format={format}
265
286
  />
266
-
287
+ ) : (
267
288
  <View
268
- style={{
269
- position: 'absolute',
270
- bottom: 20,
271
- left: 0,
272
- right: 0,
273
- }}
289
+ style={[
290
+ StyleSheet.absoluteFill,
291
+ commonStyles.alignCenter,
292
+ commonStyles.justifyCenter,
293
+ ]}
274
294
  >
275
- {!taking && (
276
- <>
277
- <MText
278
- style={{
279
- color: 'white',
280
- textAlign: 'center',
281
- fontSize: 14,
282
- paddingHorizontal: 24,
283
- }}
284
- >
285
- Xin vui lòng nhìn thẳng, khuôn mặt ở trong khung hình, ánh
286
- sáng đủ rõ nét khuôn mặt
287
- </MText>
288
- <View
289
- style={{
290
- alignItems: 'center',
291
- marginVertical: 24,
292
- }}
293
- >
294
- <MButton
295
- onPress={() => {
296
- takePhoto();
297
- }}
298
- >
299
- <TakePhotoSvg />
300
- </MButton>
301
- </View>
302
- </>
303
- )}
295
+ <ActivityIndicator color={ORANGE} size="large" />
304
296
  </View>
297
+ )}
298
+ {renderOvalMask()}
299
+ </View>
300
+
301
+ <MText style={styles.instruction}>
302
+ Xin vui lòng nhìn thẳng, khuôn mặt ở trong khung hình, ánh sáng đủ rõ
303
+ nét khuôn mặt
304
+ </MText>
305
+
306
+ <View style={[styles.captureWrap, { marginBottom: insets.bottom + 24 }]}>
307
+ {/* Quầng cam nhạt quanh nút chụp: tách nút khỏi nền trắng, đúng thiết kế */}
308
+ <View style={styles.captureHalo}>
309
+ {taking ? (
310
+ <ActivityIndicator color={ORANGE} size="large" />
311
+ ) : (
312
+ <MButton onPress={takePhoto}>
313
+ <TakePhotoSvg />
314
+ </MButton>
315
+ )}
305
316
  </View>
306
- ) : null}
317
+ </View>
307
318
 
308
319
  <Loading isLoading={isLoading} />
309
320
  </View>
310
321
  );
311
322
  }
323
+
324
+ const styles = StyleSheet.create({
325
+ container: { flex: 1, backgroundColor: '#FFFFFF' },
326
+ header: {
327
+ flexDirection: 'row',
328
+ alignItems: 'center',
329
+ paddingHorizontal: 16,
330
+ paddingBottom: 8,
331
+ },
332
+ backButton: { width: 32, height: 32, justifyContent: 'center' },
333
+ titleWrap: {
334
+ flex: 1,
335
+ alignItems: 'center',
336
+ justifyContent: 'center',
337
+ marginRight: 32,
338
+ },
339
+ headerTitle: { color: '#333333', fontSize: 16, fontWeight: '600' },
340
+ stage: {
341
+ flex: 1,
342
+ overflow: 'hidden',
343
+ backgroundColor: '#FFFFFF',
344
+ },
345
+ instruction: {
346
+ textAlign: 'center',
347
+ color: '#333333',
348
+ fontSize: 14,
349
+ lineHeight: 20,
350
+ paddingHorizontal: 32,
351
+ marginTop: 16,
352
+ },
353
+ captureWrap: { alignItems: 'center', marginTop: 24 },
354
+ captureHalo: {
355
+ width: 88,
356
+ height: 88,
357
+ borderRadius: 44,
358
+ alignItems: 'center',
359
+ justifyContent: 'center',
360
+ backgroundColor: 'rgba(240, 81, 35, 0.10)',
361
+ },
362
+ });