nativescript-barcodescanner
Advanced tools
Comparing version 4.0.1 to 4.1.0
@@ -48,4 +48,4 @@ import { ContentView, Property } from "@nativescript/core"; | ||
hasCameraPermission(): Promise<boolean>; | ||
requestCameraPermission(): Promise<boolean>; | ||
stop(): Promise<any>; | ||
requestCameraPermission(): Promise<void>; | ||
stop(): Promise<void>; | ||
scan(arg: ScanOptions): Promise<ScanResult>; | ||
@@ -52,0 +52,0 @@ } |
@@ -12,5 +12,5 @@ import { ScanOptions, ScanResult } from "./barcodescanner-common"; | ||
hasCameraPermission(): Promise<boolean>; | ||
requestCameraPermission(): Promise<boolean>; | ||
stop(): Promise<any>; | ||
requestCameraPermission(): Promise<void>; | ||
stop(): Promise<void>; | ||
scan(arg: ScanOptions): Promise<ScanResult>; | ||
} |
@@ -158,2 +158,3 @@ import { AndroidApplication, Application, Utils } from "@nativescript/core"; | ||
} | ||
resolve(null); | ||
} | ||
@@ -160,0 +161,0 @@ else { |
@@ -33,4 +33,4 @@ import { BarcodeScannerView as BarcodeScannerBaseView, ScanOptions, ScanResult } from "./barcodescanner-common"; | ||
hasCameraPermission(): Promise<boolean>; | ||
requestCameraPermission(): Promise<boolean>; | ||
stop(): Promise<any>; | ||
requestCameraPermission(): Promise<void>; | ||
stop(): Promise<void>; | ||
scan(arg: ScanOptions): Promise<ScanResult>; | ||
@@ -37,0 +37,0 @@ private isPresentingModally; |
@@ -0,1 +1,2 @@ | ||
import { Frame } from "@nativescript/core"; | ||
import { BarcodeScannerView as BarcodeScannerBaseView } from "./barcodescanner-common"; | ||
@@ -243,6 +244,5 @@ export class BarcodeScannerView extends BarcodeScannerBaseView { | ||
isPresentingModally() { | ||
let frame = require("tns-core-modules/ui/frame"); | ||
let viewController; | ||
let topMostFrame = frame.topmost(); | ||
if (frame.topmost()) { | ||
const topMostFrame = Frame.topmost(); | ||
if (topMostFrame) { | ||
viewController = topMostFrame.currentPage && topMostFrame.currentPage.ios; | ||
@@ -268,5 +268,4 @@ if (viewController) { | ||
getViewControllerToPresentFrom(presentInRootViewController) { | ||
let frame = require("tns-core-modules/ui/frame"); | ||
let viewController; | ||
let topMostFrame = frame.topmost(); | ||
const topMostFrame = Frame.topmost(); | ||
if (topMostFrame && presentInRootViewController !== true) { | ||
@@ -384,9 +383,2 @@ viewController = topMostFrame.currentPage && topMostFrame.currentPage.ios; | ||
this._beepOnScan = beepOnScan; | ||
if (this._beepOnScan) { | ||
var barcodeBundlePath = NSBundle.bundleWithIdentifier("com.telerik.BarcodeScannerFramework").bundlePath; | ||
this._player = new AVAudioPlayer({ contentsOfURL: NSURL.fileURLWithPath(barcodeBundlePath + "/beep.caf") }); | ||
this._player.numberOfLoops = 1; | ||
this._player.volume = 0.7; // this is not the actual volume, as that really depends on the device volume | ||
this._player.prepareToPlay(); | ||
} | ||
}; | ||
@@ -399,3 +391,2 @@ QRCodeReaderDelegateImpl.prototype.readerDidCancel = function (reader) { | ||
var validResult = false; | ||
console.log(1); | ||
var barcodeFormat = getBarcodeFormat(type); | ||
@@ -407,16 +398,11 @@ var value = result; | ||
} | ||
console.log(2); | ||
if (this._isContinuous) { | ||
console.log(6); | ||
if (!this._scannedArray) { | ||
this._scannedArray = Array(); | ||
} | ||
console.log(7); | ||
// don't report duplicates unless explicitly requested | ||
var newResult = this._scannedArray.indexOf("[" + value + "][" + barcodeFormat + "]") === -1; | ||
console.log(8); | ||
if (newResult || this._reportDuplicates) { | ||
var now = new Date().getTime(); | ||
// prevent flooding the callback | ||
console.log(9); | ||
if (now - this._lastScanResultTs < 1700) { | ||
@@ -427,7 +413,4 @@ return; | ||
validResult = true; | ||
console.log(10); | ||
this._scannedArray.push("[" + value + "][" + barcodeFormat + "]"); | ||
console.log(11); | ||
this._callback(value, barcodeFormat); | ||
console.log(12); | ||
} | ||
@@ -437,11 +420,12 @@ } | ||
validResult = true; | ||
console.log(3); | ||
this._owner.get().close(); | ||
console.log(4); | ||
console.log(this._callback); | ||
this._callback(value, barcodeFormat); | ||
console.log(5); | ||
} | ||
if (validResult && this._player) { | ||
this._player.play(); | ||
if (validResult && this._beepOnScan) { | ||
// tone | ||
AudioServicesPlaySystemSound(1200); | ||
// weak-boom (taptic feedback) | ||
setTimeout(function () { | ||
AudioServicesPlaySystemSound(1519); | ||
}); | ||
} | ||
@@ -448,0 +432,0 @@ }; |
{ | ||
"name": "nativescript-barcodescanner", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"description": "Scan QR/barcodes with your NativeScript app.", | ||
@@ -70,6 +70,6 @@ "main": "barcodescanner", | ||
"devDependencies": { | ||
"@nativescript/core": "^7.0.0", | ||
"@nativescript/types": "^7.0.0", | ||
"@nativescript/webpack": "~3.0.0", | ||
"typescript": "~3.9.7", | ||
"@nativescript/core": "^8.0.0", | ||
"@nativescript/types": "^8.0.0", | ||
"@nativescript/webpack": "^3.0.0", | ||
"typescript": "~4.0.7", | ||
"prompt": "^1.0.0", | ||
@@ -76,0 +76,0 @@ "rimraf": "^2.6.3", |
@@ -18,3 +18,3 @@ # NativeScript BarcodeScanner | ||
> ⚠️ If you app crashes with the 4.x version on iOS, try setting `beepOnScan` to `false`. And please open an issue if so. | ||
> ⚠️ With 4.1.0+ you can use `beepOnScan` on iOS again (it used to crash in older 4.x versions). | ||
@@ -21,0 +21,0 @@ ## Want a quick demo? |
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
1675967
23
809