Socket
Socket
Sign inDemoInstall

nativescript-barcodescanner

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nativescript-barcodescanner - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

19

barcodescanner.android.js
var barcodescanner = require("./barcodescanner-common");
var appModule = require("application");
var context = appModule.android.context;

@@ -8,2 +7,4 @@ var SCANNER_REQUEST_CODE = 444;

barcodescanner.rememberedContext = null;
barcodescanner._cameraPermissionGranted = function () {

@@ -13,3 +14,3 @@ var hasPermission = android.os.Build.VERSION.SDK_INT < 23; // Android M. (6.0)

hasPermission = android.content.pm.PackageManager.PERMISSION_GRANTED ==
android.support.v4.content.ContextCompat.checkSelfPermission(appModule.android.foregroundActivity, android.Manifest.permission.CAMERA);
android.support.v4.content.ContextCompat.checkSelfPermission(appModule.android.currentContext, android.Manifest.permission.CAMERA);
}

@@ -30,3 +31,3 @@ return hasPermission;

android.support.v4.app.ActivityCompat.requestPermissions(
appModule.android.foregroundActivity,
appModule.android.currentContext,
[android.Manifest.permission.CAMERA],

@@ -54,3 +55,3 @@ CAMERA_PERMISSION_REQUEST_CODE);

// limit searching for a valid Intent to this package only
intent.setPackage(context.getPackageName());
intent.setPackage(appModule.android.context.getPackageName());

@@ -73,2 +74,6 @@ if (arg !== null) {

appModule.android.onActivityResult = function (requestCode, resultCode, data) {
if (barcodescanner.rememberedContext !== null) {
appModule.android.currentContext = barcodescanner.rememberedContext;
barcodescanner.rememberedContext = null;
}
appModule.android.onActivityResult = previousResult;

@@ -86,4 +91,6 @@ if (requestCode === SCANNER_REQUEST_CODE) {

};
appModule.android.foregroundActivity.startActivityForResult(intent, SCANNER_REQUEST_CODE);
// we need to cache and restore the context, otherwise the dialogs module will be broken (and possibly other things as well)
barcodescanner.rememberedContext = appModule.android.currentContext;
appModule.android.currentContext.startActivityForResult(intent, SCANNER_REQUEST_CODE);
} else {

@@ -90,0 +97,0 @@ // this is next to impossible

{
"name": "nativescript-barcodescanner",
"version": "1.2.1",
"version": "1.2.2",
"description": "Scan QR/barcodes with a {N} app.",

@@ -5,0 +5,0 @@ "main": "barcodescanner.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc