nativescript-barcodescanner
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -76,6 +76,12 @@ "use strict"; | ||
try { | ||
if (!self.broadcastManager) { | ||
reject("You found a bug in the plugin, please report that calling stop() failed with this message."); | ||
return; | ||
} | ||
var stopIntent = new android.content.Intent("barcode-scanner-stop"); | ||
self.broadcastManager.sendBroadcast(stopIntent); | ||
self.broadcastManager.unregisterReceiver(self.onScanReceivedCallback); | ||
self.onScanReceivedCallback = undefined; | ||
if (self.onScanReceivedCallback) { | ||
self.broadcastManager.unregisterReceiver(self.onScanReceivedCallback); | ||
self.onScanReceivedCallback = undefined; | ||
} | ||
resolve(); | ||
@@ -111,7 +117,7 @@ } | ||
} | ||
if (!self.broadcastManager) { | ||
self.broadcastManager = android.support.v4.content.LocalBroadcastManager.getInstance(com.tns.NativeScriptApplication.getInstance()); | ||
} | ||
var isContinuous = typeof arg.continuousScanCallback === "function"; | ||
if (isContinuous) { | ||
if (!self.broadcastManager) { | ||
self.broadcastManager = android.support.v4.content.LocalBroadcastManager.getInstance(com.tns.NativeScriptApplication.getInstance()); | ||
} | ||
self.onContinuousScanResult = arg.continuousScanCallback; | ||
@@ -118,0 +124,0 @@ intent.putExtra(com.google.zxing.client.android.Intents.Scan.BULK_SCAN, true); |
import { ScanOptions } from "./barcodescanner.common"; | ||
import { ContentView } from "ui/content-view"; | ||
export declare class BarcodeScannerView extends ContentView { | ||
private _reader; | ||
private _scanner; | ||
private _ios; | ||
private _continuous; | ||
constructor(); | ||
ios: any; | ||
continuous: boolean; | ||
} | ||
export declare class BarcodeScanner { | ||
private _observer; | ||
private _observerActive; | ||
private _currentVolume; | ||
@@ -15,0 +6,0 @@ private _scanner; |
"use strict"; | ||
var content_view_1 = require("ui/content-view"); | ||
var utils = require("utils/utils"); | ||
var frame = require("ui/frame"); | ||
var BarcodeScannerView = (function (_super) { | ||
__extends(BarcodeScannerView, _super); | ||
function BarcodeScannerView() { | ||
_super.call(this); | ||
var closeButtonLabel = "bla"; | ||
var types = [AVMetadataObjectTypeUPCECode, AVMetadataObjectTypeCode39Code, AVMetadataObjectTypeCode39Mod43Code, | ||
AVMetadataObjectTypeEAN13Code, AVMetadataObjectTypeEAN8Code, AVMetadataObjectTypeCode93Code, AVMetadataObjectTypeCode128Code, | ||
AVMetadataObjectTypePDF417Code, AVMetadataObjectTypeQRCode, AVMetadataObjectTypeAztecCode]; | ||
this._reader = QRCodeReader.readerWithMetadataObjectTypes(types); | ||
var torch = false; | ||
var flip = false; | ||
var startScanningAtLoad = true; | ||
var isContinuous = false; | ||
var delegate = QRCodeReaderDelegateImpl.new().initWithCallback(isContinuous, function (reader, text, format) { | ||
delegate = undefined; | ||
}); | ||
console.log("--- ios: " + this._ios); | ||
this._ios = this._reader.previewLayer; | ||
this._reader.startScanning(); | ||
} | ||
Object.defineProperty(BarcodeScannerView.prototype, "ios", { | ||
get: function () { | ||
return this._ios; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(BarcodeScannerView.prototype, "continuous", { | ||
set: function (value) { | ||
this._continuous = value; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
return BarcodeScannerView; | ||
}(content_view_1.ContentView)); | ||
exports.BarcodeScannerView = BarcodeScannerView; | ||
var BarcodeScanner = (function () { | ||
@@ -56,7 +18,13 @@ function BarcodeScanner() { | ||
this._currentVolume = this._audioSession.outputVolume; | ||
this._audioSession.addObserverForKeyPathOptionsContext(this._observer, "outputVolume", 0, null); | ||
if (!this._observerActive) { | ||
this._audioSession.addObserverForKeyPathOptionsContext(this._observer, "outputVolume", 0, null); | ||
this._observerActive = true; | ||
} | ||
}; | ||
this._removeVolumeObserver = function () { | ||
try { | ||
this._audioSession.removeObserverForKeyPath(this._observer, "outputVolume"); | ||
if (this._observerActive) { | ||
this._observerActive = false; | ||
this._audioSession.removeObserverForKeyPath(this._observer, "outputVolume"); | ||
} | ||
} | ||
@@ -63,0 +31,0 @@ catch (ignore) { |
{ | ||
"name": "nativescript-barcodescanner", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Scan QR/barcodes with a {N} app.", | ||
@@ -5,0 +5,0 @@ "main": "barcodescanner.js", |
@@ -200,7 +200,7 @@ # NativeScript BarcodeScanner | ||
//These are re-exported for convenience (so you don't have to import from two places) | ||
export const barcodescanner = scanner; | ||
export const barcodescanner = new scanner.BarcodeScanner(); | ||
export type BarcodeScanner = scanner.BarcodeScanner; | ||
export type ScanOptions = scanner.ScanOptions; | ||
export type IosScanOptions = scanner.ScanOptions.IOS; | ||
export type AndroidScanOptions = scanner.ScanOptions.Android; | ||
export type IosScanOptions = scanner.IOS; | ||
export type AndroidScanOptions = scanner.Android; | ||
``` | ||
@@ -245,2 +245,2 @@ 1. Register the provider with your module | ||
* __1.5.0__ Auto-permission handling. Use the volume up/down buttons to toggle the torch. | ||
* __1.4.0__ Bulk scanning. | ||
* __1.4.0__ Bulk scanning. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1625097
31
245
534