Skip to content

Commit

Permalink
Bug fix for issue 74 (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
mebjas authored Jul 5, 2020
1 parent 97dffe6 commit fabb8da
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
12 changes: 8 additions & 4 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
### Version 1.1.6
+ Bug fixes
+ [#74](https://github.com/mebjas/html5-qrcode/issues/74) - state errors on file based scanning.

### Version 1.1.0
+ Added support for full scanner with end to end UI - `Html5QrcodeScanner`
+ Added support for a full scanner with end to end UI - `Html5QrcodeScanner`

### Version 1.0.9
+ Fixed issue https://github.com/mebjas/html5-qrcode/issues/41
+ Added support for verbose logging in library as constructor argument.
+ Fixed issue [#41](https://github.com/mebjas/html5-qrcode/issues/41)
+ Added support for verbose logging in the library as a constructor argument.

### Version 1.0.8
+ Added support for realtime feedbacks on viewfinder for inline scanning
Expand All @@ -13,7 +17,7 @@
|On Android|![](./assets/pixel3.gif)|

### Version 1.0.7
+ Fixed the video size issue in [issues/21](https://github.com/mebjas/html5-qrcode/issues/21)
+ Fixed the video size issue in [#21](https://github.com/mebjas/html5-qrcode/issues/21)
+ Removed fixed height of viewfinder, now the height is based on the video stream. The width is honored if the input element has a default width. Otherwise default width is applied.
+ If `config.qrbox` is greater than derived height, the config is ignored & no shading is applied.
+ The sequence of steps have changed
Expand Down
10 changes: 9 additions & 1 deletion html5-qrcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,10 @@ class Html5QrcodeScanner {
}
const file = e.target.files[0];
$this.html5Qrcode.scanFile(file, true)
.then($this.qrCodeSuccessCallback)
.then(qrCode => {
$this.__resetHeaderMessage();
$this.qrCodeSuccessCallback(qrCode);
})
.catch(error => {
$this.__setStatus("ERROR", Html5QrcodeScanner.STATUS_WARNING);
$this.__setHeaderMessage(error, Html5QrcodeScanner.STATUS_WARNING);
Expand Down Expand Up @@ -1225,6 +1228,11 @@ class Html5QrcodeScanner {
return;
}

// Cleanup states
$this.__setStatus("IDLE");
$this.__resetHeaderMessage();
$this.__getFileScanInput().value = "";

$this.sectionSwapAllowed = false;
if ($this.currentScanType == Html5QrcodeScanner.SCAN_TYPE_CAMERA) {
// swap to file
Expand Down
2 changes: 1 addition & 1 deletion minified/html5-qrcode.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "html5-qrcode",
"version": "1.1.5",
"version": "1.1.6",
"description": "a cross platform HTML5 QR Code scanner",
"main": "html5-qrcode.js",
"scripts": {
Expand Down
14 changes: 12 additions & 2 deletions transpiled/html5-qrcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,11 @@ var Html5QrcodeScanner = /*#__PURE__*/function () {
}

var file = e.target.files[0];
$this.html5Qrcode.scanFile(file, true).then($this.qrCodeSuccessCallback)["catch"](function (error) {
$this.html5Qrcode.scanFile(file, true).then(function (qrCode) {
$this.__resetHeaderMessage();

$this.qrCodeSuccessCallback(qrCode);
})["catch"](function (error) {
$this.__setStatus("ERROR", Html5QrcodeScanner.STATUS_WARNING);

$this.__setHeaderMessage(error, Html5QrcodeScanner.STATUS_WARNING);
Expand Down Expand Up @@ -1312,8 +1316,14 @@ var Html5QrcodeScanner = /*#__PURE__*/function () {
}

return;
}
} // Cleanup states


$this.__setStatus("IDLE");

$this.__resetHeaderMessage();

$this.__getFileScanInput().value = "";
$this.sectionSwapAllowed = false;

if ($this.currentScanType == Html5QrcodeScanner.SCAN_TYPE_CAMERA) {
Expand Down

0 comments on commit fabb8da

Please sign in to comment.