nativescript-barcodescanner
Advanced tools
Comparing version 2.5.5 to 2.6.0
@@ -154,3 +154,4 @@ "use strict"; | ||
if (intent.resolveActivity(com.tns.NativeScriptApplication.getInstance().getPackageManager()) !== null) { | ||
appModule.android.on('activityResult', function (data) { | ||
var onScanResult_1 = function (data) { | ||
console.log(">> activity result: @ " + new Date().getTime()); | ||
if (data.requestCode === SCANNER_REQUEST_CODE) { | ||
@@ -178,4 +179,7 @@ self.onPermissionGranted = null; | ||
} | ||
arg.closeCallback && arg.closeCallback(); | ||
appModule.android.off('activityResult', onScanResult_1); | ||
} | ||
}); | ||
}; | ||
appModule.android.on('activityResult', onScanResult_1); | ||
appModule.android.foregroundActivity.startActivityForResult(intent, SCANNER_REQUEST_CODE); | ||
@@ -182,0 +186,0 @@ } |
@@ -8,2 +8,3 @@ export interface ScanResult { | ||
continuousScanCallback?: (scanResult: ScanResult) => void; | ||
closeCallback?: () => void; | ||
reportDuplicates?: boolean; | ||
@@ -10,0 +11,0 @@ preferFrontCamera?: boolean; |
@@ -145,2 +145,3 @@ "use strict"; | ||
self._removeVolumeObserver(); | ||
arg.closeCallback && arg.closeCallback(); | ||
reject("Scan aborted"); | ||
@@ -158,2 +159,3 @@ } | ||
self._removeVolumeObserver(); | ||
arg.closeCallback && arg.closeCallback(); | ||
resolve(result); | ||
@@ -160,0 +162,0 @@ } |
# Change Log | ||
## [2.6.0](https://github.com/EddyVerbruggen/nativescript-barcodescanner/tree/2.6.0) (2017-06-28) | ||
[Full Changelog](https://github.com/EddyVerbruggen/nativescript-barcodescanner/milestone/20?closed=1) | ||
## [2.5.5](https://github.com/EddyVerbruggen/nativescript-barcodescanner/tree/2.5.5) (2017-06-13) | ||
@@ -4,0 +8,0 @@ [Full Changelog](https://github.com/EddyVerbruggen/nativescript-barcodescanner/milestone/19?closed=1) |
{ | ||
"name": "nativescript-barcodescanner", | ||
"version": "2.5.5", | ||
"version": "2.6.0", | ||
"description": "Scan QR/barcodes with a {N} app.", | ||
@@ -20,3 +20,3 @@ "main": "barcodescanner", | ||
"setup": "npm i && cd demo && npm i && cd .. && npm run build && cd demo && tns plugin add .. && cd ..", | ||
"test": "npm run tslint && npm run tslint.demo && cd demo && tns build ios && tns build android", | ||
"test": "npm run tslint && npm run tslint.demo", | ||
"tslint": "tslint *.ts", | ||
@@ -23,0 +23,0 @@ "tslint.demo": "tslint demo/app/*.ts" |
@@ -75,4 +75,4 @@ # NativeScript BarcodeScanner | ||
```js | ||
import {BarcodeScanner} from "nativescript-barcodescanner"; | ||
```typescript | ||
import { BarcodeScanner } from "nativescript-barcodescanner"; | ||
let barcodescanner = new BarcodeScanner(); | ||
@@ -90,2 +90,3 @@ | ||
torchOn: false, // launch with the flashlight on (default false) | ||
closeCallback: () => { console.log("Scanner closed")}, // invoked when the scanner was closed (success or abort) | ||
resultDisplayDuration: 500, // Android only, default 1500 (ms), set to 0 to disable echoing the scanned text | ||
@@ -122,2 +123,3 @@ orientation: orientation, // Android only, default undefined (sensor-driven orientation), other options: portrait|landscape | ||
torchOn: false, // launch with the flashlight on (default false) | ||
closeCallback: function () { console.log("Scanner closed"); }, // invoked when the scanner was closed (success or abort) | ||
resultDisplayDuration: 500, // Android only, default 1500 (ms), set to 0 to disable echoing the scanned text | ||
@@ -156,6 +158,7 @@ orientation: "landscape", // Android only, optionally lock the orientation to either "portrait" or "landscape" | ||
console.log(result.format + ": " + result.text + " (count: " + count + ")"); | ||
if (count == 3) { | ||
if (count === 3) { | ||
barcodescanner.stop(); | ||
} | ||
}, | ||
closeCallback: function () { console.log("Scanner closed"); }, // invoked when the scanner was closed | ||
reportDuplicates: false // which is the default | ||
@@ -220,3 +223,3 @@ }).then( | ||
1. Register the provider with your module | ||
```ts | ||
```typescript | ||
//app.module.ts | ||
@@ -236,7 +239,6 @@ import { NgModule, ValueProvider } from '@angular/core'; | ||
1. Inject it into your component | ||
```ts | ||
//my-component.ts | ||
```typescript | ||
// my-component.ts | ||
import { Component, Inject } from '@angular/core'; | ||
import { BarcodeScanner } from 'nativescript-barcodescanner'; | ||
//other imports | ||
@@ -256,3 +258,3 @@ @Component({ ... }) | ||
#### Webpack usage | ||
If you run into an error when Webpacking, open `app,module.ts` and add this: | ||
If you run into an error when Webpacking, open `app.module.ts` and add this: | ||
@@ -267,4 +269,4 @@ ```typescript | ||
providers: [ | ||
{provide: BarcodeScanner, useFactory: (createBarcodeScanner)} | ||
{ provide: BarcodeScanner, useFactory: (createBarcodeScanner) } | ||
] | ||
``` |
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
1663596
591
264