mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 22:25:24 +00:00
Added BRC_BW_FORMAT_UNSUPPORTED to not let PKBarcodeFormatCode128 to be used as backward barcode format
This commit is contained in:
16
src/pass.js
16
src/pass.js
@@ -411,7 +411,16 @@ class Pass {
|
||||
}, []);
|
||||
|
||||
if (valid.length) {
|
||||
this._props["barcode"] = valid[0];
|
||||
// With this check, we want to avoid that
|
||||
// PKBarcodeFormatCode128 gets chosen automatically
|
||||
// if it is the first. If true, we'll get 1
|
||||
// (so not the first index)
|
||||
let barcodeFirstValidIndex = Number(valid[0].format === "PKBarcodeFormatCode128");
|
||||
|
||||
if (valid.length > 1) {
|
||||
this._props["barcode"] = valid[barcodeFirstValidIndex];
|
||||
}
|
||||
|
||||
this._props["barcodes"] = valid;
|
||||
}
|
||||
|
||||
@@ -469,6 +478,11 @@ class Pass {
|
||||
return this;
|
||||
}
|
||||
|
||||
if (format === "PKBarcodeFormatCode128") {
|
||||
barcodeDebug(formatMessage("BRC_BW_FORMAT_UNSUPPORTED"));
|
||||
return this;
|
||||
}
|
||||
|
||||
// Checking which object among barcodes has the same format of the specified one.
|
||||
let index = this._props["barcodes"].findIndex(b => b.format.toLowerCase().includes(format.toLowerCase()));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user