From 9ae63e9c5d6f61442cc6647c48a0e1209064aa4c Mon Sep 17 00:00:00 2001 From: swaraj Date: Mon, 10 Jun 2024 17:21:26 +0530 Subject: [PATCH 1/5] added descirption for some of the props --- .../component/LiveLocationTracking/README.md | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/__app/component/LiveLocationTracking/README.md b/__app/component/LiveLocationTracking/README.md index 3964639..bbeb9b7 100644 --- a/__app/component/LiveLocationTracking/README.md +++ b/__app/component/LiveLocationTracking/README.md @@ -175,50 +175,52 @@ return ( mapTypeControl - - + Boolean + This allows the user to choose a map type (ROADMAP, SATELLITE, HYBRID, or TERRAIN) panControl - + Boolean zoomControl - - + Boolean + This adds a buttons for changing the zoom level of the map. scaleControl - - + Boolean + This displays a map scale element. streetViewControl - - + Boolean + This contains a Pegman icon which can be dragged onto the map to enable Street View. overviewMapControl - + Boolean rotateControl - - + Boolean + This provides a combination of tilt and rotate options for maps containing oblique imagery. This control appears by default near the bottom right of the map. fullscreenControl - - + Boolean + This offers the option to open the map in fullscreen mode. + Note: iOS doesn't support the fullscreen feature. The fullscreen control is therefore not visible on iOS devices. + From 1135824ce0142d41ee50b6a1d84ec2e6761a78ae Mon Sep 17 00:00:00 2001 From: Himanshu Gupta Date: Mon, 10 Jun 2024 17:58:09 +0530 Subject: [PATCH 2/5] Added Author 100 beats --- .github/README.md | 8 ++++++++ README.md | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/.github/README.md b/.github/README.md index d5cde0d..121be78 100644 --- a/.github/README.md +++ b/.github/README.md @@ -243,6 +243,14 @@ Thanks goes to these wonderful people
+ + + 100beats +
+ 100beats +
+
+ diff --git a/README.md b/README.md index 63be987..9253e1a 100644 --- a/README.md +++ b/README.md @@ -241,6 +241,14 @@ Thanks goes to these wonderful people
+ + + 100beats +
+ 100beats +
+
+ From cbc7b49952f9dcb84c3ba199185f2e9cdbcb9e0f Mon Sep 17 00:00:00 2001 From: Himanshu Gupta Date: Fri, 14 Jun 2024 17:47:29 +0530 Subject: [PATCH 3/5] Update README.md Signed-off-by: Himanshu Gupta --- __app/component/SnapScanner/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/__app/component/SnapScanner/README.md b/__app/component/SnapScanner/README.md index 8bdbadc..c399a40 100644 --- a/__app/component/SnapScanner/README.md +++ b/__app/component/SnapScanner/README.md @@ -150,5 +150,13 @@ return ( To hide/remove unsupported feature, make it false. Default value is true. + + + via + + String + To open gallary/Phone Camera/File System + Default value is gallery. Possible values are gallary/camera/phone + From 2e5bed6e3a2b35e27f75068066bd87174c914e49 Mon Sep 17 00:00:00 2001 From: Himanshu Gupta Date: Fri, 14 Jun 2024 18:09:00 +0530 Subject: [PATCH 4/5] Updated Live Location tracking --- .../LiveLocationTracking.js | 71 ++++++++----------- .../component/LiveLocationTracking/README.md | 13 ++-- __app/component/LiveLocationTracking/index.js | 7 +- 3 files changed, 36 insertions(+), 55 deletions(-) diff --git a/__app/component/LiveLocationTracking/LiveLocationTracking.js b/__app/component/LiveLocationTracking/LiveLocationTracking.js index 4bd3201..78bd1a9 100644 --- a/__app/component/LiveLocationTracking/LiveLocationTracking.js +++ b/__app/component/LiveLocationTracking/LiveLocationTracking.js @@ -2,7 +2,7 @@ import React, { useEffect, useRef } from 'react'; import PropTypes from 'prop-types'; import dependentJsService from '../services/dependentJsService'; -import { handleError, handleSuccess, handleLoading } from '../services/handlerService'; +import { handleSuccess, handleError, handleLoading } from '../services/handlerService'; import Wrapper from '../Wrapper/Wrapper'; const failureMsgDefault = { @@ -16,6 +16,8 @@ const failureMsgDefault = { error: '', }; +const isBrowserSupport = () => navigator?.geolocation?.watchPosition; + const checkPermitByBrowser = async (failureMsg, failureCb) => { try { const permissions = await navigator.permissions.query({ name: 'geolocation' }); @@ -43,22 +45,22 @@ const checkScriptInBrowser = async (failureMsg, failureCb, isProdKey, googleKey) }; function LiveLocationTracking({ - successCb, - failureCb, - successMsg, - failureMsg: failureMsgProps, - loadingCb, - googleKey, - isProdKey, - destinationLatLng, - mapTypeControl, - panControl, - zoomControl, - scaleControl, - streetViewControl, - overviewMapControl, - rotateControl, - fullscreenControl, + successCb = () => {}, + failureCb = () => {}, + loadingCb = () => {}, + successMsg = 'Successfully!!', + failureMsg: failureMsgProps = { ...failureMsgDefault }, + googleKey = '', + isProdKey = true, + destinationLatLng = { lat: 12.9387901, lng: 77.6407703 }, + mapTypeControl = true, + panControl = true, + zoomControl = true, + scaleControl = true, + streetViewControl = true, + overviewMapControl = true, + rotateControl = true, + fullscreenControl = true, }) { const directionMapRef = useRef(); let directionsService; @@ -167,8 +169,10 @@ function LiveLocationTracking({ }; const init = async () => { - if (LiveLocationTracking.isBrowserSupport()) { + if (isBrowserSupport()) { handleLoading({ loadingCb }); + + // Your Code will start from here const isPermitByBrowser = await checkPermitByBrowser(failureMsg, failureCb); const isScriptInBrowser = await checkScriptInBrowser( failureMsg, @@ -203,6 +207,7 @@ function LiveLocationTracking({ // }, 200); } }; + // Your Code will end here } else { return handleError({ msgType: 'UN_SUPPORTED_FEATURE', msg: failureMsg.unSupported, failureCb }); } @@ -224,9 +229,9 @@ function LiveLocationTracking({ ); } -LiveLocationTracking.isBrowserSupport = () => navigator?.geolocation?.watchPosition; - LiveLocationTracking.propTypes = { + // eslint-disable-next-line react/no-unused-prop-types + showForever: PropTypes.bool, successCb: PropTypes.func, failureCb: PropTypes.func, loadingCb: PropTypes.func, @@ -245,28 +250,8 @@ LiveLocationTracking.propTypes = { fullscreenControl: PropTypes.bool, }; -LiveLocationTracking.defaultProps = { - successCb: () => {}, - failureCb: () => {}, - loadingCb: () => {}, - successMsg: '', - failureMsg: { ...failureMsgDefault }, - - destinationLatLng: { lat: 12.9387901, lng: 77.6407703 }, - isProdKey: true, - googleKey: '', - mapTypeControl: true, - panControl: true, - zoomControl: true, - scaleControl: true, - streetViewControl: true, - overviewMapControl: true, - rotateControl: true, - fullscreenControl: true, -}; +const WLiveLocationTracking = Wrapper(LiveLocationTracking, isBrowserSupport); -export default Wrapper(LiveLocationTracking); +export { WLiveLocationTracking as LiveLocationTracking }; -// WALKING - bike -// TWO_WHEELER - Walking -// DRIVING - Car +export default WLiveLocationTracking; diff --git a/__app/component/LiveLocationTracking/README.md b/__app/component/LiveLocationTracking/README.md index bbeb9b7..0dccbce 100644 --- a/__app/component/LiveLocationTracking/README.md +++ b/__app/component/LiveLocationTracking/README.md @@ -139,22 +139,22 @@ return ( Props - Type + Type - Description + Description Default Values - showForever + showForever - Boolean + Boolean To hide/remove unsupported feature, make it false. - Default value is true - + Default value is true. + googleKey (*) String @@ -225,4 +225,3 @@ return ( - diff --git a/__app/component/LiveLocationTracking/index.js b/__app/component/LiveLocationTracking/index.js index b230cdb..bee1e89 100644 --- a/__app/component/LiveLocationTracking/index.js +++ b/__app/component/LiveLocationTracking/index.js @@ -1,5 +1,2 @@ -import LiveLocationTracking from './LiveLocationTracking'; - -export { LiveLocationTracking }; - -export default LiveLocationTracking; +export * from './LiveLocationTracking'; +export { default } from './LiveLocationTracking'; From f0940ff624b31da005b7576c72e8d3c697bdc79b Mon Sep 17 00:00:00 2001 From: Himanshu Gupta Date: Fri, 14 Jun 2024 18:26:53 +0530 Subject: [PATCH 5/5] fix(facedetector, livelocation tracking): default props pass in params instead of using prop-types --- __app/component/FaceDetector/FaceDetector.js | 48 +++++++++---------- .../FaceDetector/FaceDetectorClose.js | 2 + .../FaceDetector/FaceDetectorFacing.js | 2 + .../FaceDetector/FaceDetectorFlash.js | 6 ++- __app/component/FaceDetector/README.md | 32 +++++++++---- __app/component/FaceDetector/index.js | 22 ++------- .../LiveLocationTracking.js | 2 +- 7 files changed, 59 insertions(+), 55 deletions(-) diff --git a/__app/component/FaceDetector/FaceDetector.js b/__app/component/FaceDetector/FaceDetector.js index bbe1c72..721a839 100644 --- a/__app/component/FaceDetector/FaceDetector.js +++ b/__app/component/FaceDetector/FaceDetector.js @@ -1,7 +1,6 @@ -/* eslint-disable no-inner-declarations */ import React, { useEffect, useState } from 'react'; import PropTypes from 'prop-types'; -import { handleError, handleLoading } from '../services/handlerService'; +import { handleSuccess, handleError, handleLoading } from '../services/handlerService'; import Wrapper from '../Wrapper/Wrapper'; let mediaStream = null; @@ -14,23 +13,24 @@ const failureMsgDefault = { flashUnsupported: 'Flash is not supporting in your device', }; +const isBrowserSupport = () => navigator?.mediaDevices && globalThis.FaceDetector; + function FaceDetector({ - // successCb, - failureCb, - loadingCb, - // successMsg, - failureMsg: failureMsgProps, - cameraType, - zIndex, + successCb = () => {}, + failureCb = () => {}, + loadingCb = () => {}, + successMsg = 'Successfully!!', + failureMsg: failureMsgProps = { ...failureMsgDefault }, + cameraType = 'back', + zIndex = 9, children, -}) { +} = {}) { const failureMsg = { ...failureMsgDefault, ...failureMsgProps }; let list = null; let video = null; let facingMode; const [flash, setFlash] = useState(false); - const [isBrowser, setIsBrowser] = useState(false); const [faces, setFaces] = useState([]); const stopStreaming = () => { @@ -58,6 +58,12 @@ function FaceDetector({ if (getFaces[0]) { setFaces(getFaces); + handleSuccess({ + msgType: 'SUCCESSFUL', + msg: successMsg, + successCb, + data: [...getFaces], + }); // cancelAnimationFrame(videoUnmount); // stopStreaming(); // clearTimeout(unmoutRenderLoop); @@ -159,7 +165,6 @@ function FaceDetector({ }; useEffect(() => { - setIsBrowser(true); handleBrowserSupport(); return () => { @@ -167,7 +172,7 @@ function FaceDetector({ }; }, []); - return isBrowser && FaceDetector.isBrowserSupport() && ( + return isBrowserSupport() && (
{ @@ -199,9 +204,8 @@ function FaceDetector({ ); } -FaceDetector.isBrowserSupport = () => navigator?.mediaDevices && globalThis.FaceDetector; - FaceDetector.propTypes = { + // showForever: PropTypes.bool, // successCb: PropTypes.func, failureCb: PropTypes.func, loadingCb: PropTypes.func, @@ -211,14 +215,8 @@ FaceDetector.propTypes = { cameraType: PropTypes.oneOf(['back', 'front']), }; -FaceDetector.defaultProps = { - // successCb: () => {}, - failureCb: () => {}, - loadingCb: () => {}, - // successMsg: '', - failureMsg: { ...failureMsgDefault }, - zIndex: 9, - cameraType: 'back', -}; +const WFaceDetector = Wrapper(FaceDetector, isBrowserSupport); + +export { WFaceDetector as FaceDetector }; -export default Wrapper(FaceDetector); +export default WFaceDetector; diff --git a/__app/component/FaceDetector/FaceDetectorClose.js b/__app/component/FaceDetector/FaceDetectorClose.js index 8228cfd..5c956d0 100644 --- a/__app/component/FaceDetector/FaceDetectorClose.js +++ b/__app/component/FaceDetector/FaceDetectorClose.js @@ -38,4 +38,6 @@ function FaceDetectorClose({ ); } +export { FaceDetectorClose }; + export default FaceDetectorClose; diff --git a/__app/component/FaceDetector/FaceDetectorFacing.js b/__app/component/FaceDetector/FaceDetectorFacing.js index c67fbb5..fd0e91f 100644 --- a/__app/component/FaceDetector/FaceDetectorFacing.js +++ b/__app/component/FaceDetector/FaceDetectorFacing.js @@ -32,4 +32,6 @@ function FaceDetectorFacing({ ); } +export { FaceDetectorFacing }; + export default FaceDetectorFacing; diff --git a/__app/component/FaceDetector/FaceDetectorFlash.js b/__app/component/FaceDetector/FaceDetectorFlash.js index 50f0066..8b1a7bc 100644 --- a/__app/component/FaceDetector/FaceDetectorFlash.js +++ b/__app/component/FaceDetector/FaceDetectorFlash.js @@ -1,6 +1,6 @@ import React from 'react'; -function FaceDetector({ +function FaceDetectorFlash({ toggleFlash, children, zIndex, @@ -32,4 +32,6 @@ function FaceDetector({ ); } -export default FaceDetector; +export { FaceDetectorFlash }; + +export default FaceDetectorFlash; diff --git a/__app/component/FaceDetector/README.md b/__app/component/FaceDetector/README.md index 068e26e..416effc 100644 --- a/__app/component/FaceDetector/README.md +++ b/__app/component/FaceDetector/README.md @@ -12,8 +12,8 @@ A minimal [Demo Link](https://6jpxdq.csb.app/?component=FaceDetector) | Value | Used as a | Description| |--------- | -------- |-----------------| -| FaceDetector | Component :white_check_mark: | Can be used as Component | -| faceDetector | Service :x: | Can't be used as Service | +| FaceDetector | :white_check_mark: Component | Can be used as Component | +| faceDetector | :x: Service | Can be used as Service | ##### 1. Here's an example of basic usage with Multiple Import: with Default Import: ```javascript @@ -134,14 +134,6 @@ return ( } - - - - showForever - - Boolean - To hide/remove unsupported feature, make it false. Default value is true -
---
@@ -149,6 +141,26 @@ return ( + + Props + + + Type + + + Description + + + Default Values + + + + showForever + + Boolean + To hide/remove unsupported feature, make it false. + Default value is true. + ### Child Component diff --git a/__app/component/FaceDetector/index.js b/__app/component/FaceDetector/index.js index 42a4287..8188946 100644 --- a/__app/component/FaceDetector/index.js +++ b/__app/component/FaceDetector/index.js @@ -1,18 +1,6 @@ -import FaceDetector from './FaceDetector'; -import FaceDetectorFlash from './FaceDetectorFlash'; -import FaceDetectorClose from './FaceDetectorClose'; -import FaceDetectorFacing from './FaceDetectorFacing'; +export * from './FaceDetector'; +export * from './FaceDetectorClose'; +export * from './FaceDetectorFlash'; +export * from './FaceDetectorFacing'; -export { - FaceDetector, - FaceDetectorFlash, - FaceDetectorClose, - FaceDetectorFacing, -}; - -export default { - Init: FaceDetector, - Flash: FaceDetectorFlash, - Close: FaceDetectorClose, - Facing: FaceDetectorFacing, -}; +export { default } from './FaceDetector'; diff --git a/__app/component/LiveLocationTracking/LiveLocationTracking.js b/__app/component/LiveLocationTracking/LiveLocationTracking.js index 78bd1a9..11233cd 100644 --- a/__app/component/LiveLocationTracking/LiveLocationTracking.js +++ b/__app/component/LiveLocationTracking/LiveLocationTracking.js @@ -61,7 +61,7 @@ function LiveLocationTracking({ overviewMapControl = true, rotateControl = true, fullscreenControl = true, -}) { +} = {}) { const directionMapRef = useRef(); let directionsService; let directionsRenderer;