nativescript-barcodescanner
Advanced tools
Comparing version 2.7.5 to 2.7.6
@@ -5,2 +5,4 @@ import { BarcodeScannerView as BarcodeScannerBaseView, ScanOptions, ScanResult } from "./barcodescanner-common"; | ||
private _scanner; | ||
private _hasSupport; | ||
constructor(); | ||
createNativeView(): Object; | ||
@@ -7,0 +9,0 @@ initView(): void; |
@@ -9,7 +9,11 @@ "use strict"; | ||
function BarcodeScannerView() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
var _this = _super.call(this) || this; | ||
_this._hasSupport = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo) !== null; | ||
return _this; | ||
} | ||
BarcodeScannerView.prototype.createNativeView = function () { | ||
var v = _super.prototype.createNativeView.call(this); | ||
this.initView(); | ||
if (this._hasSupport) { | ||
this.initView(); | ||
} | ||
return v; | ||
@@ -47,3 +51,3 @@ }; | ||
_super.prototype.onLayout.call(this, left, top, right, bottom); | ||
if (this.ios) { | ||
if (this._hasSupport && this.ios) { | ||
this._reader.previewLayer.frame = this.ios.layer.bounds; | ||
@@ -50,0 +54,0 @@ } |
{ | ||
"name": "nativescript-barcodescanner", | ||
"version": "2.7.5", | ||
"version": "2.7.6", | ||
"description": "Scan QR/barcodes with your NativeScript app.", | ||
@@ -22,4 +22,6 @@ "main": "barcodescanner", | ||
"plugin.link": "npm link && cd ../demo && npm link nativescript-barcodescanner && cd ../src", | ||
"plugin.link.ng": "npm link && cd ../demo-ng && npm link nativescript-barcodescanner && cd ../src", | ||
"plugin.tscwatch": "npm run tsc -- -w", | ||
"demo.ios": "npm i && npm run tsc && cd ../demo && tns run ios --syncAllFiles", | ||
"demo.ng.ios": "npm i && npm run tsc && cd ../demo-ng && tns run ios --syncAllFiles", | ||
"demo.android": "npm i && npm run tsc && cd ../demo && tns run android --syncAllFiles", | ||
@@ -26,0 +28,0 @@ "demo.reset": "cd ../demo && rimraf platforms", |
@@ -48,3 +48,3 @@ # NativeScript BarcodeScanner | ||
## Embedding the scanner on an existing page (iOS) | ||
## Embedding the scanner (iOS) | ||
@@ -61,2 +61,4 @@ <img src="docs/ios_embedded_scanner.png" width="281px"/> | ||
Here's an example tag, showing all currently supported options. The property defaults are equal to the `scan` function. | ||
```xml | ||
@@ -75,3 +77,3 @@ <iOS> | ||
### Embedding in Angular | ||
Component: | ||
Component / Module: | ||
@@ -92,6 +94,8 @@ ```typescript | ||
preferFrontCamera="false" | ||
(scanResult)="onScanResult($event)" /> | ||
(scanResult)="onScanResult($event)"> | ||
</BarcodeScanner> | ||
``` | ||
See the 'demo-ng' for details. | ||
## iOS runtime permission reason | ||
@@ -315,2 +319,16 @@ You've probably seen a permission popup like this before (this plugin will trigger one as well, automatically): | ||
2. Remove the folder `platforms/android`. This triggers a complete rebuild | ||
3. run `tns run android` | ||
3. run `tns run android` | ||
## Dependencies / Related Projects | ||
This plugin wraps libaries for Android and iOS to make the barcode scanner easily accessible via a unified API. The Libraries used are: | ||
### iOS | ||
Custom Framework to access iOS APIs: https://github.com/EddyVerbruggen/ios-framework-barcodescanner | ||
### Android | ||
ZXing: https://github.com/zxing/zxing/releases | ||
As using that library as a direct dependency was not practical, there is a library-project that adopts the sources from ZXing and copiles them into a AAR for usage on android: https://github.com/EddyVerbruggen/barcodescanner-lib-aar/ |
1725409
1307
330