Skip to content

Commit 9adcbe3

Browse files
committed
fix: fix the checking of isFront and rotateImage
1 parent da1c599 commit 9adcbe3

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

android/src/main/java/com/visioncameradynamsoftbarcodereader/VisionCameraDBRPlugin.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,16 @@ public Object callback(@NonNull Frame frame, @Nullable Map<String, Object> argum
3939
Boolean isFront = false;
4040
Boolean rotateImage = true;
4141
if (arguments != null ){
42+
//for (String key:
43+
// arguments.keySet()) {
44+
// Log.d("DBR",key);
45+
//}
4246
if (arguments.containsKey("isFront")){
43-
if (((String) arguments.get("isFront")).equals("true")){
44-
isFront = true;
45-
}
47+
isFront = (Boolean) arguments.get("isFront");
4648
}
4749
if (arguments.containsKey("rotateImage")){
48-
if (((String) arguments.get("rotateImage")).equals("false")){
49-
rotateImage = false;
50-
}
50+
rotateImage = (Boolean) arguments.get("rotateImage");
51+
//Log.d("DBR","rot: "+rotateImage);
5152
}
5253
initLicense(arguments);
5354
updateRuntimeSettingsWithTemplate(arguments);

example/src/components/BarcodeScanner.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const BarcodeScanner: React.FC<props> = (props: props) => {
1717
const frameProcessor = useFrameProcessor(frame => {
1818
'worklet'
1919
const config:DBRConfig = {
20+
rotateImage:false,
2021
template:"{\"ImageParameter\":{\"BarcodeFormatIds\":[\"BF_ALL\"],\"Description\":\"\",\"Name\":\"Settings\"},\"Version\":\"3.0\"}"
2122
};
2223
const results = decode(frame,config);

src/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ export function decode(frame: Frame,config?:DBRConfig):TextResult[]|undefined {
2929
if (plugin == null) throw new Error('Failed to load Frame Processor Plugin "decode"!')
3030
if (config) {
3131
let record:Record<string,any> = {};
32-
if (config.isFront) {
33-
record["isFront"] = config.isFront.toString();
32+
if (config.isFront != undefined && config.isFront != null) {
33+
record["isFront"] = config.isFront;
3434
}
35-
if (config.rotateImage) {
36-
record["rotateImage"] = config.rotateImage.toString();
35+
if (config.rotateImage != undefined && config.rotateImage != null) {
36+
record["rotateImage"] = config.rotateImage;
3737
}
3838
if (config.template) {
3939
record["template"] = config.template;

0 commit comments

Comments
 (0)