Skip to content

Commit

Permalink
fix(locateme): added loading CB in locate me
Browse files Browse the repository at this point in the history
  • Loading branch information
opensrc0 committed Apr 2, 2024
1 parent 363fc37 commit 964369b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
7 changes: 5 additions & 2 deletions __app/component/LocateMe/LocateMe.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import Wrapper from '../Wrapper/Wrapper';
import { handleSuccess, handleError } from '../services/handlerService';
import { handleSuccess, handleError, handleLoading } from '../services/handlerService';
import dependentJsService from '../services/dependentJsService';

const checkPermitByBrowser = async (disbaleToast, failureMsg, failureCb) => {
Expand Down Expand Up @@ -87,12 +87,14 @@ function LocateMe({
failureCb,
successMsg,
failureMsg,
loadingCb,
children,
isProdKey,
googleKey,
}) {
const onClick = async () => {
if (LocateMe.isBrowserSupport()) {
handleLoading(loadingCb);
const isPermitByBrowser = await checkPermitByBrowser(disbaleToast, failureMsg, failureCb);
const isScriptInBrowser = await checkScriptInBrowser(
disbaleToast,
Expand Down Expand Up @@ -147,7 +149,7 @@ LocateMe.defaultProps = {
disbaleToast: false,
successCb: () => {},
failureCb: () => {},
successMsg: '',
successMsg: 'Located Successfully',
failureMsg: {
unSupported: '',
permissionDenied: '',
Expand All @@ -157,6 +159,7 @@ LocateMe.defaultProps = {
invalidLatLng: '',
error: '',
},
loadingCb: () => {},
isProdKey: true,
googleKey: '',
};
Expand Down
14 changes: 6 additions & 8 deletions __app/component/Scanner/ScannerInit.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,13 @@ ScannerInit.defaultProps = {
failureCb: () => {},
successMsg: '',
failureMsg: {
unSupported: '',
streaming: '',
barCodeDetection: '',
invalidImage: '',
flash: '',
unableToScan: '',
unSupported: 'QR-Code/Bar-Code/UPI Scanner is not supporting in your device',
streaming: 'Camera streaming failed',
barCodeDetection: 'Bar code detection failed',
invalidImage: 'Invalid Images',
flash: 'Flash is not supporting in your device',
unableToScan: 'Unable to scan',
},
zIndex: 9,
cameraType: 'back',
};

export default ScannerInit;
8 changes: 8 additions & 0 deletions __app/component/services/handlerService.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,11 @@ export const handleError = ({ disbaleToast, msg, msgType, failureCb }) => {

return false;
};

export const handleLoading = ({ loadingCb }) => {
loadingCb({
msgType: 'LOADING',
msg: 'Loading...',
status: 'LOADING',
});
};

0 comments on commit 964369b

Please sign in to comment.