Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

[WinJS][Win10] Fixes "formats" in options passed to BarcodeReader.scan() being ignored #524

Merged
merged 2 commits into from
Sep 6, 2017

Conversation

LSBOSS
Copy link
Contributor

@LSBOSS LSBOSS commented Aug 11, 2017

This change enables Windows 10 UWP builds to recognize the "formats" options passed to BarcodeReader.scan() to limit the types of codes detected by the underlying ZXing Barcode Reader, which by default tries to detect everything it supports.

…ed by WinJS implementation targeting Windows 10
Copy link
Member

@macdonst macdonst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LSBOSS can you make these small changes?

@@ -157,6 +157,21 @@ BarcodeReader.prototype.init = function (capture, width, height) {
this._height = height;
this._zxingReader = new ZXing.BarcodeReader();
this._zxingReader.tryHarder = true;

const formatsList = BarcodeReader.scanCallArgs.args.length > 0 && BarcodeReader.scanCallArgs.args[0].formats;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this to var

var possibleFormats = formatsList
.split(",")
.map(format => {
for (let index in BARCODE_FORMAT) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change let to var

@macdonst macdonst merged commit 1f016d9 into phonegap:master Sep 6, 2017
Mischa1610 added a commit to sovanta/phonegap-plugin-barcodescanner-custom-ui that referenced this pull request Oct 19, 2017
* phonegap/master:
  [readme] updating PhoneGap Build instructions
  [WinJS][Win10] Fixes "formats" in options passed to BarcodeReader.scan() being ignored  (phonegap#524)
@lock
Copy link

lock bot commented Jun 7, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants