nativescript-barcodescanner
Advanced tools
Comparing version 1.3.5 to 1.3.6
@@ -13,3 +13,3 @@ var barcodescanner = require("./barcodescanner-common"); | ||
hasPermission = android.content.pm.PackageManager.PERMISSION_GRANTED == | ||
android.support.v4.content.ContextCompat.checkSelfPermission(appModule.android.currentContext, android.Manifest.permission.CAMERA); | ||
android.support.v4.content.ContextCompat.checkSelfPermission(appModule.android.currentContext, android.Manifest.permission.CAMERA); | ||
} | ||
@@ -81,3 +81,3 @@ return hasPermission; | ||
if (intent.resolveActivity(appModule.android.context.getPackageManager()) !== null) { | ||
if (intent.resolveActivity(com.tns.NativeScriptApplication.getInstance().getPackageManager()) !== null) { | ||
var previousResult = appModule.android.onActivityResult; | ||
@@ -104,3 +104,3 @@ appModule.android.onActivityResult = function (requestCode, resultCode, data) { | ||
}; | ||
// we need to cache and restore the context, otherwise the dialogs module will be broken (and possibly other things as well) | ||
@@ -107,0 +107,0 @@ barcodescanner.rememberedContext = appModule.android.currentContext; |
var barcodescanner = require("./barcodescanner-common"); | ||
var frame = require("ui/frame"); | ||
var utils = require("utils/utils"); | ||
barcodescanner.available = function () { | ||
return new Promise(function (resolve) { | ||
resolve(QRCodeReader.isAvailable()); | ||
// since this would also request permission... | ||
// resolve(QRCodeReader.isAvailable()); | ||
// ... and it's extremely likely to be 'true' anyway, I decided to hardcode this: | ||
resolve(true); | ||
}); | ||
}; | ||
// TODO consider giving camera PERMISSION beforehand: https://github.com/yannickl/QRCodeReaderViewController/issues/4, | ||
// TODO consider asking camera PERMISSION beforehand: https://github.com/yannickl/QRCodeReaderViewController/issues/4, | ||
// would fit well with the Android 6 implementation. | ||
@@ -23,3 +27,2 @@ barcodescanner.scan = function (arg) { | ||
var format = formats[f].trim(); | ||
console.log("---- format: " + format); | ||
if (format === "QR_CODE") types.push(AVMetadataObjectTypeQRCode); | ||
@@ -41,3 +44,2 @@ else if (format === "PDF_417") types.push(AVMetadataObjectTypePDF417Code); | ||
} | ||
@@ -91,7 +93,9 @@ var bs = QRCodeReaderViewController.readerWithCancelButtonTitleMetadataObjectTypes(closeButtonLabel, types); | ||
QRCodeReaderDelegateImpl.prototype.readerDidCancel = function (reader) { | ||
UIApplication.sharedApplication().keyWindow.rootViewController.dismissViewControllerAnimatedCompletion(true, null); | ||
var app = utils.ios.getter(UIApplication, UIApplication.sharedApplication); | ||
app.keyWindow.rootViewController.dismissViewControllerAnimatedCompletion(true, null); | ||
this._callback(reader); | ||
}; | ||
QRCodeReaderDelegateImpl.prototype.readerDidScanResultForType = function (reader, text, type) { | ||
UIApplication.sharedApplication().keyWindow.rootViewController.dismissViewControllerAnimatedCompletion(true, null); | ||
var app = utils.ios.getter(UIApplication, UIApplication.sharedApplication); | ||
app.keyWindow.rootViewController.dismissViewControllerAnimatedCompletion(true, null); | ||
this._callback(reader, text, type); | ||
@@ -98,0 +102,0 @@ }; |
{ | ||
"name": "nativescript-barcodescanner", | ||
"version": "1.3.5", | ||
"version": "1.3.6", | ||
"description": "Scan QR/barcodes with a {N} app.", | ||
@@ -8,4 +8,4 @@ "main": "barcodescanner.js", | ||
"platforms": { | ||
"android": "1.3.0", | ||
"ios": "1.2.3" | ||
"android": "2.3.0", | ||
"ios": "2.3.0" | ||
} | ||
@@ -12,0 +12,0 @@ }, |
@@ -27,2 +27,4 @@ # NativeScript BarcodeScanner | ||
## Installation | ||
Make sure you're using __NativeScript 2.3.0 or higher__. Run `npm install -g nativescript` if not. | ||
From the command prompt go to your app's root folder and execute: | ||
@@ -29,0 +31,0 @@ ``` |
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
1437211
324
115