diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 277f5cc..4b58fe9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,17 +17,17 @@ jobs: matrix: node-version: [21.6.1] os: [ubuntu-latest] - + steps: - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - + - run: npm ci - run: npm run prod - run: npm run semantic-release - env: + env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/__app/component/Scanner/Scanner.js b/__app/component/Scanner/Scanner.js index 862d7c0..73ca9e0 100644 --- a/__app/component/Scanner/Scanner.js +++ b/__app/component/Scanner/Scanner.js @@ -122,15 +122,19 @@ function Scanner({ }; const toggleFlash = async (close) => { - const track = mediaStream.getVideoTracks()[0]; - try { - await track.applyConstraints({ - advanced: [{ torch: close === false ? false : !flash }], - }); - setFlash((s) => (close === false ? false : !s)); - } catch (error) { - return handleError({ msgType: 'FLASH_UPSUPPORTED', msg: failureMsg.flashUnsupported, failureCb }); + if (mediaStream) { + const track = mediaStream.getVideoTracks()[0]; + try { + await track.applyConstraints({ + advanced: [{ torch: !flash }], + }); + setFlash((s) => (close === false ? false : !s)); + } catch (error) { + return handleError({ msgType: 'FLASH_UPSUPPORTED', msg: failureMsg.flashUnsupported, failureCb }); + } + return true; } + return true; }; @@ -147,7 +151,7 @@ function Scanner({ cancelAnimationFrame(videoUnmount); stopStreaming(); clearTimeout(unmoutRenderLoop); - toggleFlash(false); + if (flash) toggleFlash(false); facingMode = 'back'; }; diff --git a/__app/component/services/handlerService.js b/__app/component/services/handlerService.js index 1bc5807..e5c9e6b 100644 --- a/__app/component/services/handlerService.js +++ b/__app/component/services/handlerService.js @@ -3,7 +3,7 @@ export const handleSuccess = ({ msg, msgType, successCb, data }) => { msgType, msg, data, - status: 'SUCCESS SUCCESS SUCCESS SUCCESS SUCCESS SUCCESS SUCCESS', + status: 'SUCCESS', }; console.table('%c SUCCESS::%s', 'color: green; font-size: 20px', '', rtn); successCb(rtn);