Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nativescript-barcodescanner

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nativescript-barcodescanner - npm Package Compare versions

Comparing version 2.5.1 to 2.5.2

platforms/android/barcodescanner-release-2.1.6.aar

4

barcodescanner.android.d.ts

@@ -1,2 +0,2 @@

import { ScanOptions } from "./barcodescanner.common";
import { ScanOptions, ScanResult } from "./barcodescanner.common";
export declare class BarcodeScanner {

@@ -13,3 +13,3 @@ private broadcastManager;

stop(): Promise<any>;
scan(arg: ScanOptions): Promise<any>;
scan(arg: ScanOptions): Promise<ScanResult>;
}

@@ -141,6 +141,7 @@ "use strict";

this.uniquelyScannedCodes.push("[" + text + "][" + format + "]");
_onContinuousScanResult({
var result = {
format: format,
text: text
});
};
_onContinuousScanResult(result);
}

@@ -166,6 +167,7 @@ }

var text = data.intent.getStringExtra(com.google.zxing.client.android.Intents.Scan.RESULT);
resolve({
var result = {
format: format,
text: text
});
};
resolve(result);
}

@@ -179,5 +181,2 @@ else {

appModule.android.foregroundActivity.startActivityForResult(intent, SCANNER_REQUEST_CODE);
if (isContinuous) {
resolve();
}
}

@@ -184,0 +183,0 @@ else {

@@ -0,4 +1,8 @@

export interface ScanResult {
text: string;
format: string;
}
export interface CommonScanOptions {
formats?: string;
continuousScanCallback?: Function;
continuousScanCallback?: (scanResult: ScanResult) => void;
reportDuplicates?: boolean;

@@ -41,3 +45,3 @@ preferFrontCamera?: boolean;

stop(): Promise<any>;
scan(arg: ScanOptions): Promise<any>;
scan(arg: ScanOptions): Promise<ScanResult>;
}

@@ -1,2 +0,2 @@

import { ScanOptions } from "./barcodescanner.common";
import { ScanOptions, ScanResult } from "./barcodescanner.common";
export declare class BarcodeScanner {

@@ -18,3 +18,3 @@ private _observer;

stop(): Promise<any>;
scan(arg: ScanOptions): Promise<any>;
scan(arg: ScanOptions): Promise<ScanResult>;
}

@@ -140,3 +140,3 @@ "use strict";

self._scanner.modalPresentationStyle = 2;
var delegate_1 = QRCodeReaderDelegateImpl.new().initWithCallback(arg.beepOnScan, isContinuous_1, arg.reportDuplicates, function (reader, text, format) {
var delegate_1 = QRCodeReaderDelegateImpl.new().initWithCallback(arg.beepOnScan !== false, isContinuous_1, arg.reportDuplicates, function (reader, text, format) {
if (text === undefined) {

@@ -182,5 +182,2 @@ self._removeVolumeObserver();

}
if (isContinuous_1) {
resolve();
}
}

@@ -199,3 +196,5 @@ catch (ex) {

function QRCodeReaderDelegateImpl() {
return _super !== null && _super.apply(this, arguments) || this;
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._lastScanResultTs = 0;
return _this;
}

@@ -225,2 +224,3 @@ QRCodeReaderDelegateImpl.new = function () {

QRCodeReaderDelegateImpl.prototype.readerDidScanResultForType = function (reader, text, type) {
var validResult = false;
if (this._isContinuous) {

@@ -230,3 +230,7 @@ if (!this._scannedArray) {

}
if (this._reportDuplicates || this._scannedArray.indexOf("[" + text + "][" + type + "]") === -1) {
var newResult = this._scannedArray.indexOf("[" + text + "][" + type + "]") === -1;
var now = new Date().getTime();
if (newResult || (this._reportDuplicates && now - this._lastScanResultTs > 2000)) {
validResult = true;
this._lastScanResultTs = now;
this._scannedArray.push("[" + text + "][" + type + "]");

@@ -237,2 +241,3 @@ this._callback(reader, text, type);

else {
validResult = true;
var app_2 = utils.ios.getter(UIApplication, UIApplication.sharedApplication);

@@ -242,3 +247,3 @@ app_2.keyWindow.rootViewController.dismissViewControllerAnimatedCompletion(true, null);

}
if (this._player) {
if (validResult && this._player) {
this._player.play();

@@ -245,0 +250,0 @@ }

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

@@ -64,7 +64,7 @@ "main": "barcodescanner",

"devDependencies": {
"tns-core-modules": "^2.5.1",
"tns-platform-declarations": "^2.5.0",
"typescript": "~2.1.0",
"tns-core-modules": "^3.0.0",
"tns-platform-declarations": "^3.0.0",
"typescript": "~2.3.0",
"tslint": "^5.0.0"
}
}

@@ -248,1 +248,16 @@ # NativeScript BarcodeScanner

```
#### Webpack usage
If you run into an error when Webpacking, open `app,module.ts` and add this:
```typescript
import { BarcodeScanner } from "nativescript-barcodescanner";
export function createBarcodeScanner() {
return new BarcodeScanner();
}
providers: [
{provide: BarcodeScanner, useFactory: (createBarcodeScanner)}
]
```
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc