Socket
Socket
Sign inDemoInstall

nativescript-barcodescanner

Package Overview
Dependencies
0
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.1 to 1.3.2

11

barcodescanner.android.js

@@ -70,8 +70,8 @@ var barcodescanner = require("./barcodescanner-common");

}
if (arg.formats) {
intent.putExtra(com.google.zxing.client.android.Intents.Scan.FORMATS, arg.formats);
// intent.putExtra(com.google.zxing.client.android.Intents.Scan.MODE, com.google.zxing.client.android.Intents.Scan.QR_CODE_MODE);
}
}
// TODO pass in 'formats', can also be done easily for iOS
// intent.putExtra(com.google.zxing.client.android.Intents.Scan.SCAN_FORMATS, "QR_CODE");
// intent.putExtra(com.google.zxing.client.android.Intents.Scan.MODE, com.google.zxing.client.android.Intents.Scan.QR_CODE_MODE);
// rectangle size can be controlled as well (but don't bother as of yet)

@@ -84,2 +84,3 @@ // intent.putExtra(com.google.zxing.client.android.Intents.Scan.WIDTH, 200);

appModule.android.onActivityResult = function (requestCode, resultCode, data) {
console.log("---- barcode result!");
if (barcodescanner.rememberedContext !== null) {

@@ -93,3 +94,5 @@ appModule.android.currentContext = barcodescanner.rememberedContext;

resolve({
// format : data.getStringExtra("SCAN_RESULT_FORMAT"),
format : data.getStringExtra(com.google.zxing.client.android.Intents.Scan.RESULT_FORMAT),
// text : data.getStringExtra("SCAN_RESULT")
text : data.getStringExtra(com.google.zxing.client.android.Intents.Scan.RESULT)

@@ -96,0 +99,0 @@ });

@@ -7,2 +7,8 @@ declare module "nativescript-barcodescanner" {

/**
* A comma sep. string of barcode types: "QR_CODE,PDF_417"
* Default: empty, so all types of codes can be scanned.
*/
formats?: string;
/**
* The label of the button used to close the scanner.

@@ -9,0 +15,0 @@ * Default: "Close".

@@ -15,7 +15,28 @@ var barcodescanner = require("./barcodescanner-common");

try {
arg = arg || {};
var closeButtonLabel = arg.cancelLabel || "Close";
var types = [AVMetadataObjectTypeUPCECode, AVMetadataObjectTypeCode39Code, AVMetadataObjectTypeCode39Mod43Code,
AVMetadataObjectTypeEAN13Code, AVMetadataObjectTypeEAN8Code, AVMetadataObjectTypeCode93Code, AVMetadataObjectTypeCode128Code,
AVMetadataObjectTypePDF417Code, AVMetadataObjectTypeQRCode, AVMetadataObjectTypeAztecCode];
var types = [];
if (arg.formats) {
var formats = arg.formats.split(",");
for (var f in formats) {
var format = formats[f].trim();
console.log("---- format: " + format);
if (format === "QR_CODE") types.push(AVMetadataObjectTypeQRCode);
else if (format === "PDF_417") types.push(AVMetadataObjectTypePDF417Code);
else if (format === "AZTEC") types.push(AVMetadataObjectTypeAztecCode);
else if (format === "UPC_E") types.push(AVMetadataObjectTypeUPCECode);
else if (format === "CODE_39") types.push(AVMetadataObjectTypeCode39Code);
else if (format === "CODE_39_MOD_43") types.push(AVMetadataObjectTypeCode39Mod43Code);
else if (format === "CODE_93") types.push(AVMetadataObjectTypeCode93Code);
else if (format === "CODE_128") types.push(AVMetadataObjectTypeCode128Code);
else if (format === "EAN_8") types.push(AVMetadataObjectTypeEAN8Code);
else if (format === "EAN_13") types.push(AVMetadataObjectTypeEAN13Code);
}
} else {
types = [AVMetadataObjectTypeUPCECode, AVMetadataObjectTypeCode39Code, AVMetadataObjectTypeCode39Mod43Code,
AVMetadataObjectTypeEAN13Code, AVMetadataObjectTypeEAN8Code, AVMetadataObjectTypeCode93Code, AVMetadataObjectTypeCode128Code,
AVMetadataObjectTypePDF417Code, AVMetadataObjectTypeQRCode, AVMetadataObjectTypeAztecCode];
}

@@ -22,0 +43,0 @@ var bs = QRCodeReaderViewController.readerWithCancelButtonTitleMetadataObjectTypes(closeButtonLabel, types);

{
"name": "nativescript-barcodescanner",
"version": "1.3.1",
"version": "1.3.2",
"description": "Scan QR/barcodes with a {N} app.",

@@ -5,0 +5,0 @@ "main": "barcodescanner.js",

@@ -14,11 +14,11 @@ # NativeScript BarcodeScanner

### iOS and Android
* Code39
* Code93
* Code128
* EAN8
* EAN13
* QR
* CODE_39
* CODE_93
* CODE_128
* EAN_8
* EAN_13
* QR_CODE
* UPC_E
* Aztec
* PDF417
* AZTEC
* PDF_417

@@ -28,4 +28,5 @@ ### Android only

* CODABAR
* MAXICODE
* ITF
* RSS14
* RSS_14
* UPC_A

@@ -40,2 +41,3 @@

barcodescanner.scan({
formats: "QR_CODE,PDF_417", // Pass in of you want to restrict scanning to certain types
cancelLabel: "Stop scanning", // iOS only, default 'Close'

@@ -42,0 +44,0 @@ message: "Go scan something", // Android only, default is 'Place a barcode inside the viewfinder rectangle to scan it.'

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc