Skip to content

Commit

Permalink
Merge branch 'main'
Browse files Browse the repository at this point in the history
  • Loading branch information
opensrc0 committed May 18, 2024
2 parents 9a10c74 + eaa12db commit e079bc9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 changes: 13 additions & 9 deletions __app/component/Scanner/Scanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand All @@ -147,7 +151,7 @@ function Scanner({
cancelAnimationFrame(videoUnmount);
stopStreaming();
clearTimeout(unmoutRenderLoop);
toggleFlash(false);
if (flash) toggleFlash(false);
facingMode = 'back';
};

Expand Down
2 changes: 1 addition & 1 deletion __app/component/services/handlerService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e079bc9

Please sign in to comment.