Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit cc27463

Browse files
author
Bart van den Burg
committed
expose raw barcode scan result object
1 parent 06bd6c3 commit cc27463

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/mlkit/barcodescanning/index.android.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ export class MLKitBarcodeScanner extends MLKitBarcodeScannerBase {
3838
const barcode = barcodes.get(i);
3939
result.barcodes.push({
4040
value: barcode.getRawValue(),
41-
format: BarcodeFormat[barcode.getFormat()]
41+
format: BarcodeFormat[barcode.getFormat()],
42+
android: barcode
4243
});
4344
}
4445

@@ -80,7 +81,8 @@ export function scanBarcodesOnDevice(options: MLKitScanBarcodesOnDeviceOptions):
8081
const barcode = barcodes.get(i);
8182
result.barcodes.push({
8283
value: barcode.getRawValue(),
83-
format: BarcodeFormat[barcode.getFormat()]
84+
format: BarcodeFormat[barcode.getFormat()],
85+
android: barcode
8486
});
8587
}
8688

src/mlkit/barcodescanning/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export interface MLKitScanBarcodesOnDeviceResult extends MLKitResult {
88
barcodes: Array<{
99
value: string;
1010
format: string;
11+
ios?: any;
12+
android?: any;
1113
}>;
1214
}
1315

src/mlkit/barcodescanning/index.ios.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ export class MLKitBarcodeScanner extends MLKitBarcodeScannerBase {
3131
const barcode: FIRVisionBarcode = barcodes.objectAtIndex(i);
3232
result.barcodes.push({
3333
value: barcode.rawValue,
34-
format: BarcodeFormat[barcode.format]
34+
format: BarcodeFormat[barcode.format],
35+
ios: barcode
3536
});
3637
}
3738

@@ -77,7 +78,8 @@ export function scanBarcodesOnDevice(options: MLKitScanBarcodesOnDeviceOptions):
7778
const barcode: FIRVisionBarcode = barcodes.objectAtIndex(i);
7879
result.barcodes.push({
7980
value: barcode.rawValue,
80-
format: BarcodeFormat[barcode.format]
81+
format: BarcodeFormat[barcode.format],
82+
ios: barcode
8183
});
8284
}
8385
resolve(result);

0 commit comments

Comments
 (0)