vision-camera-dynamsoft-barcode-reader
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -7,10 +7,7 @@ "use strict"; | ||
exports.decode = decode; | ||
exports.decodeBase64 = decodeBase64; | ||
exports.initLicense = initLicense; | ||
exports.initRuntimeSettingsFromString = initRuntimeSettingsFromString; | ||
exports.decodeBase64 = decodeBase64; | ||
var _reactNative = require("react-native"); | ||
var _reactNativeVisionCamera = require("react-native-vision-camera"); | ||
const LINKING_ERROR = `The package 'vision-camera-dynamsoft-barcode-reader' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({ | ||
@@ -24,11 +21,8 @@ ios: "- You have run 'pod install'\n", | ||
} | ||
}); | ||
const plugin = _reactNativeVisionCamera.VisionCameraProxy.initFrameProcessorPlugin('decode'); | ||
const plugin = _reactNativeVisionCamera.VisionCameraProxy.initFrameProcessorPlugin('decode'); | ||
/** | ||
* Detect barcodes from the camera preview | ||
*/ | ||
function decode(frame, config) { | ||
@@ -38,22 +32,16 @@ 'worklet'; | ||
if (plugin == null) throw new Error('Failed to load Frame Processor Plugin "decode"!'); | ||
if (config) { | ||
let record = {}; | ||
if (config.isFront != undefined && config.isFront != null) { | ||
record["isFront"] = config.isFront; | ||
} | ||
if (config.rotateImage != undefined && config.rotateImage != null) { | ||
record["rotateImage"] = config.rotateImage; | ||
} | ||
if (config.template) { | ||
record["template"] = config.template; | ||
} | ||
if (config.license) { | ||
record["license"] = config.license; | ||
} | ||
return plugin.call(frame, record); | ||
@@ -64,3 +52,2 @@ } else { | ||
} | ||
/** | ||
@@ -72,15 +59,13 @@ * Init the license of Dynamsoft Barcode Reader | ||
} | ||
/** | ||
* Init the runtime settings from a JSON template | ||
*/ | ||
function initRuntimeSettingsFromString(template) { | ||
return VisionCameraDynamsoftBarcodeReader.initRuntimeSettingsFromString(template); | ||
} | ||
/** | ||
* Detect barcodes from base64 | ||
*/ | ||
function decodeBase64(base64) { | ||
@@ -87,0 +72,0 @@ return VisionCameraDynamsoftBarcodeReader.decodeBase64(base64); |
@@ -11,9 +11,8 @@ import { NativeModules, Platform } from 'react-native'; | ||
} | ||
}); | ||
const plugin = VisionCameraProxy.initFrameProcessorPlugin('decode'); | ||
/** | ||
* Detect barcodes from the camera preview | ||
*/ | ||
export function decode(frame, config) { | ||
@@ -23,22 +22,16 @@ 'worklet'; | ||
if (plugin == null) throw new Error('Failed to load Frame Processor Plugin "decode"!'); | ||
if (config) { | ||
let record = {}; | ||
if (config.isFront != undefined && config.isFront != null) { | ||
record["isFront"] = config.isFront; | ||
} | ||
if (config.rotateImage != undefined && config.rotateImage != null) { | ||
record["rotateImage"] = config.rotateImage; | ||
} | ||
if (config.template) { | ||
record["template"] = config.template; | ||
} | ||
if (config.license) { | ||
record["license"] = config.license; | ||
} | ||
return plugin.call(frame, record); | ||
@@ -49,3 +42,2 @@ } else { | ||
} | ||
/** | ||
@@ -57,13 +49,13 @@ * Init the license of Dynamsoft Barcode Reader | ||
} | ||
/** | ||
* Init the runtime settings from a JSON template | ||
*/ | ||
export function initRuntimeSettingsFromString(template) { | ||
return VisionCameraDynamsoftBarcodeReader.initRuntimeSettingsFromString(template); | ||
} | ||
/** | ||
* Detect barcodes from base64 | ||
*/ | ||
export function decodeBase64(base64) { | ||
@@ -70,0 +62,0 @@ return VisionCameraDynamsoftBarcodeReader.decodeBase64(base64); |
@@ -5,3 +5,3 @@ import { Frame } from 'react-native-vision-camera'; | ||
*/ | ||
export declare function decode(frame: Frame, config?: DBRConfig): TextResult[] | undefined; | ||
export declare function decode(frame: Frame, config?: DBRConfig): Record<string, TextResult> | undefined; | ||
export interface TextResult { | ||
@@ -8,0 +8,0 @@ barcodeText: string; |
{ | ||
"name": "vision-camera-dynamsoft-barcode-reader", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"private": false, | ||
@@ -75,3 +75,3 @@ "description": "React Native Vision Camera Frame Processor Plugin of Dynamsoft Barcode Reader", | ||
"react-native-builder-bob": "^0.18.0", | ||
"react-native-vision-camera": "^3.8.2", | ||
"react-native-vision-camera": "3.9.0", | ||
"react-native-worklets-core": "^0.2.4", | ||
@@ -78,0 +78,0 @@ "release-it": "^16.1.3", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
74172