nativescript-barcodescanner
Advanced tools
Comparing version 2.2.1 to 2.3.2
@@ -122,2 +122,9 @@ "use strict"; | ||
} | ||
if (arg.torchOn === true) { | ||
intent.putExtra(com.google.zxing.client.android.Intents.Scan.TORCH_ON, true); | ||
} | ||
if (arg.resultDisplayDuration !== undefined) { | ||
intent.putExtra(com.google.zxing.client.android.Intents.Scan.RESULT_DISPLAY_DURATION_MS, "" + arg.resultDisplayDuration); | ||
} | ||
intent.putExtra(com.google.zxing.client.android.Intents.Scan.SAVE_HISTORY, false); | ||
if (!self.broadcastManager) { | ||
@@ -124,0 +131,0 @@ self.broadcastManager = android.support.v4.content.LocalBroadcastManager.getInstance(com.tns.NativeScriptApplication.getInstance()); |
@@ -8,2 +8,3 @@ export interface CommonScanOptions { | ||
showTorchButton?: boolean; | ||
torchOn?: boolean; | ||
} | ||
@@ -17,2 +18,3 @@ export interface IOS extends CommonScanOptions { | ||
orientation?: string; | ||
resultDisplayDuration?: number; | ||
} | ||
@@ -23,1 +25,19 @@ export interface ScanOptions extends IOS, Android { | ||
} | ||
export declare class BarcodeScanner { | ||
private _observer; | ||
private _observerActive; | ||
private _currentVolume; | ||
private _scanner; | ||
constructor(); | ||
private _hasCameraPermission; | ||
private _hasDeniedCameraPermission; | ||
private _addVolumeObserver; | ||
private _removeVolumeObserver; | ||
private _enableTorch; | ||
private _disableTorch; | ||
available(): Promise<boolean>; | ||
hasCameraPermission(): Promise<boolean>; | ||
requestCameraPermission(): Promise<boolean>; | ||
stop(): Promise<any>; | ||
scan(arg: ScanOptions): Promise<any>; | ||
} |
@@ -74,4 +74,4 @@ "use strict"; | ||
try { | ||
var app = utils.ios.getter(UIApplication, UIApplication.sharedApplication); | ||
app.keyWindow.rootViewController.dismissViewControllerAnimatedCompletion(true, null); | ||
var app_1 = utils.ios.getter(UIApplication, UIApplication.sharedApplication); | ||
app_1.keyWindow.rootViewController.dismissViewControllerAnimatedCompletion(true, null); | ||
self._removeVolumeObserver(); | ||
@@ -87,2 +87,3 @@ resolve(); | ||
BarcodeScanner.prototype.scan = function (arg) { | ||
var _this = this; | ||
var self = this; | ||
@@ -173,3 +174,7 @@ return new Promise(function (resolve, reject) { | ||
if (vc) { | ||
vc.presentViewControllerAnimatedCompletion(self._scanner, true, null); | ||
vc.presentViewControllerAnimatedCompletion(self._scanner, true, function () { | ||
if (arg.torchOn) { | ||
_this._enableTorch(); | ||
} | ||
}); | ||
} | ||
@@ -222,4 +227,4 @@ } | ||
else { | ||
var app = utils.ios.getter(UIApplication, UIApplication.sharedApplication); | ||
app.keyWindow.rootViewController.dismissViewControllerAnimatedCompletion(true, null); | ||
var app_2 = utils.ios.getter(UIApplication, UIApplication.sharedApplication); | ||
app_2.keyWindow.rootViewController.dismissViewControllerAnimatedCompletion(true, null); | ||
this._callback(reader, text, type); | ||
@@ -226,0 +231,0 @@ } |
# Change Log | ||
## [2.3.2](https://github.com/EddyVerbruggen/nativescript-barcodescanner/tree/2.3.2) (2016-12-22) | ||
[Full Changelog](https://github.com/EddyVerbruggen/nativescript-barcodescanner/compare/2.2.1...2.3.2) | ||
**Implemented enhancements:** | ||
- Allow starting the scanner with the torch switched ON [\#67](https://github.com/EddyVerbruggen/nativescript-barcodescanner/issues/67) | ||
- Hide the scan result to be display after scanned [\#65](https://github.com/EddyVerbruggen/nativescript-barcodescanner/issues/65) | ||
- @ng-tools/webpack compatibility [\#66](https://github.com/EddyVerbruggen/nativescript-barcodescanner/pull/66) ([hdeshev](https://github.com/hdeshev)) | ||
**Closed issues:** | ||
- zxing again / still [\#64](https://github.com/EddyVerbruggen/nativescript-barcodescanner/issues/64) | ||
- Does not work on android [\#22](https://github.com/EddyVerbruggen/nativescript-barcodescanner/issues/22) | ||
## [2.2.1](https://github.com/EddyVerbruggen/nativescript-barcodescanner/tree/2.2.1) (2016-12-20) | ||
@@ -4,0 +18,0 @@ [Full Changelog](https://github.com/EddyVerbruggen/nativescript-barcodescanner/compare/2.2.0...2.2.1) |
@@ -1,8 +0,1 @@ | ||
/** | ||
* iOS and Android apis should match. | ||
* It doesn't matter if you export `.ios` or `.android`, either one but only one. | ||
*/ | ||
export * from './barcodescanner.ios'; | ||
// Export any shared classes, constants, etc. | ||
export * from './barcodescanner.common'; | ||
export * from "./barcodescanner.common"; |
{ | ||
"name": "nativescript-barcodescanner", | ||
"version": "2.2.1", | ||
"version": "2.3.2", | ||
"description": "Scan QR/barcodes with a {N} app.", | ||
"main": "barcodescanner", | ||
"typings": "index.d.ts", | ||
"nativescript": { | ||
@@ -64,7 +63,4 @@ "platforms": { | ||
"tns-platform-declarations": "^2.3.0", | ||
"typescript": "^1.8.0" | ||
}, | ||
"dependencies": { | ||
"nativescript-theme-core": "^0.1.2" | ||
"typescript": "~2.0.10" | ||
} | ||
} |
@@ -60,2 +60,4 @@ # NativeScript BarcodeScanner | ||
#### TypeScript | ||
This plugin was created and tested with TypeScript 2+, so please update your project if needed. | ||
```js | ||
@@ -72,2 +74,4 @@ import {BarcodeScanner} from "nativescript-barcodescanner"; | ||
showTorchButton: true, // default false | ||
torchOn: false, // launch with the flashlight on (default false) | ||
resultDisplayDuration: 500, // Android only, default 1500 (ms), set to 0 to disable echoing the scanned text | ||
orientation: orientation, // Android only, default undefined (sensor-driven orientation), other options: portrait|landscape | ||
@@ -100,2 +104,4 @@ openSettingsIfPermissionWasPreviouslyDenied: true // On iOS you can send the user to the settings app if access was previously denied | ||
showTorchButton: true, // default false | ||
torchOn: false, // launch with the flashlight on (default false) | ||
resultDisplayDuration: 500, // Android only, default 1500 (ms), set to 0 to disable echoing the scanned text | ||
orientation: "landscape", // Android only, optionally lock the orientation to either "portrait" or "landscape" | ||
@@ -102,0 +108,0 @@ openSettingsIfPermissionWasPreviouslyDenied: true // On iOS you can send the user to the settings app if access was previously denied |
@@ -0,12 +1,5 @@ | ||
/// <reference path="./node_modules/tns-core-modules/lib.core.d.ts" /> Needed for autocompletion and compilation. | ||
/// <reference path="./node_modules/tns-core-modules/tns-core-modules.d.ts" /> Needed for autocompletion and compilation. | ||
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" /> | ||
/// <reference path="./node_modules/tns-platform-declarations/ios/ios.d.ts" /> | ||
/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/android17.d.ts" /> | ||
/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/ios/ios.d.ts" /> | ||
/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/org.nativescript.widgets.d.ts" /> | ||
/// <reference path='./node_modules/typescript/lib/lib.core.d.ts'/> | ||
declare type FormData = any; | ||
declare var FormData; | ||
declare type Blob = any; | ||
declare var Blob; |
@@ -9,11 +9,8 @@ { | ||
"declaration": true, | ||
"skipLibCheck": true, | ||
"noLib": true | ||
}, | ||
"files": [ | ||
"node_modules/typescript/lib/lib.core.d.ts", | ||
"manual_typings/base.d.ts", | ||
"node_modules/tns-core-modules/tns-core-modules.d.ts", | ||
"node_modules/tns-platform-declarations/tns-core-modules/android17.d.ts", | ||
"node_modules/tns-platform-declarations/tns-core-modules/ios/ios.d.ts", | ||
"node_modules/tns-platform-declarations/tns-core-modules/org.nativescript.widgets.d.ts", | ||
"references.d.ts", | ||
"barcodescanner.common.ts", | ||
@@ -28,2 +25,2 @@ "barcodescanner.android.ts", | ||
] | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
1638274
0
554
231
27
- Removednativescript-theme-core@^0.1.2
- Removednativescript-theme-core@0.1.5(transitive)