barkoder-nativescript 1.6.5 → 1.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/barkoder-nativescript.android.ts +307 -3
- package/barkoder-nativescript.common.ts +6 -2
- package/barkoder-nativescript.ios.ts +304 -15
- package/package.json +1 -1
- package/platforms/android/barkoder.aar +0 -0
- package/platforms/ios/Barkoder.xcframework/Info.plist +5 -5
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/Barkoder +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/Headers/iBarkoder.h +25 -3
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/Info.plist +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/default.metallib +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/n2_384x256_int8.mlmodelc/analytics/coremldata.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/n2_384x256_int8.mlmodelc/coremldata.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/{int8_384x256_small2.mlmodelc → n2_384x256_int8.mlmodelc}/metadata.json +18 -29
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/{int8_384x256_small2.mlmodelc → n2_384x256_int8.mlmodelc}/model.espresso.net +1960 -2558
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/{int8_384x256_small2.mlmodelc → n2_384x256_int8.mlmodelc}/model.espresso.shape +775 -950
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/n2_384x256_int8.mlmodelc/model.espresso.weights +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/n2_512x384_int8.mlmodelc/analytics/coremldata.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/n2_512x384_int8.mlmodelc/coremldata.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/n2_512x384_int8.mlmodelc/metadata.json +77 -0
- package/platforms/ios/Barkoder.xcframework/{ios-arm64_x86_64-simulator/Barkoder.framework/int8_384x256_small2.mlmodelc → ios-arm64/Barkoder.framework/n2_512x384_int8.mlmodelc}/model.espresso.net +1960 -2558
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/n2_512x384_int8.mlmodelc/model.espresso.shape +1740 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/n2_512x384_int8.mlmodelc/model.espresso.weights +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/Barkoder +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/Headers/iBarkoder.h +25 -3
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/Info.plist +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/_CodeSignature/CodeResources +98 -65
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/default.metallib +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/n2_384x256_int8.mlmodelc/analytics/coremldata.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/n2_384x256_int8.mlmodelc/coremldata.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/{int8_384x256_small2.mlmodelc → n2_384x256_int8.mlmodelc}/metadata.json +18 -29
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/n2_384x256_int8.mlmodelc/model/coremldata.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/n2_384x256_int8.mlmodelc/model.espresso.net +5331 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/{int8_384x256_small2.mlmodelc → n2_384x256_int8.mlmodelc}/model.espresso.shape +775 -950
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/n2_384x256_int8.mlmodelc/model.espresso.weights +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/n2_384x256_int8.mlmodelc/neural_network_optionals/coremldata.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/n2_512x384_int8.mlmodelc/analytics/coremldata.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/n2_512x384_int8.mlmodelc/coremldata.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/n2_512x384_int8.mlmodelc/metadata.json +77 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/n2_512x384_int8.mlmodelc/model/coremldata.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/n2_512x384_int8.mlmodelc/model.espresso.net +5331 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/n2_512x384_int8.mlmodelc/model.espresso.shape +1740 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/n2_512x384_int8.mlmodelc/model.espresso.weights +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/n2_512x384_int8.mlmodelc/neural_network_optionals/coremldata.bin +0 -0
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64/BarkoderSDK.framework/BarkoderSDK +0 -0
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64/BarkoderSDK.framework/Headers/BarkoderSDK-Swift.h +105 -1
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64/BarkoderSDK.framework/Info.plist +0 -0
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64/BarkoderSDK.framework/Modules/BarkoderSDK.swiftmodule/arm64-apple-ios.abi.json +1847 -646
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64/BarkoderSDK.framework/Modules/BarkoderSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +49 -2
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64/BarkoderSDK.framework/Modules/BarkoderSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64/BarkoderSDK.framework/Modules/BarkoderSDK.swiftmodule/arm64-apple-ios.swiftinterface +49 -2
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64/BarkoderSDK.framework/templates.json +19 -16
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64_x86_64-simulator/BarkoderSDK.framework/BarkoderSDK +0 -0
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64_x86_64-simulator/BarkoderSDK.framework/Headers/BarkoderSDK-Swift.h +210 -2
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64_x86_64-simulator/BarkoderSDK.framework/Info.plist +0 -0
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64_x86_64-simulator/BarkoderSDK.framework/Modules/BarkoderSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +1847 -646
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64_x86_64-simulator/BarkoderSDK.framework/Modules/BarkoderSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +49 -2
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64_x86_64-simulator/BarkoderSDK.framework/Modules/BarkoderSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64_x86_64-simulator/BarkoderSDK.framework/Modules/BarkoderSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +49 -2
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64_x86_64-simulator/BarkoderSDK.framework/Modules/BarkoderSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +1847 -646
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64_x86_64-simulator/BarkoderSDK.framework/Modules/BarkoderSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +49 -2
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64_x86_64-simulator/BarkoderSDK.framework/Modules/BarkoderSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64_x86_64-simulator/BarkoderSDK.framework/Modules/BarkoderSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +49 -2
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64_x86_64-simulator/BarkoderSDK.framework/_CodeSignature/CodeResources +25 -25
- package/platforms/ios/BarkoderSDK.xcframework/ios-arm64_x86_64-simulator/BarkoderSDK.framework/templates.json +19 -16
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/float16_512x384.mlmodelc/analytics/coremldata.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/float16_512x384.mlmodelc/coremldata.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/float16_512x384.mlmodelc/metadata.json +0 -88
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/float16_512x384.mlmodelc/model.mil +0 -753
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/float16_512x384.mlmodelc/weights/weight.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/int8_384x256_small2.mlmodelc/analytics/coremldata.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/int8_384x256_small2.mlmodelc/coremldata.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/int8_384x256_small2.mlmodelc/model.espresso.weights +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/float16_512x384.mlmodelc/analytics/coremldata.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/float16_512x384.mlmodelc/coremldata.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/float16_512x384.mlmodelc/metadata.json +0 -88
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/float16_512x384.mlmodelc/model.mil +0 -753
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/float16_512x384.mlmodelc/weights/weight.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/int8_384x256_small2.mlmodelc/analytics/coremldata.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/int8_384x256_small2.mlmodelc/coremldata.bin +0 -0
- package/platforms/ios/Barkoder.xcframework/ios-arm64_x86_64-simulator/Barkoder.framework/int8_384x256_small2.mlmodelc/model.espresso.weights +0 -0
- /package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/{int8_384x256_small2.mlmodelc → n2_384x256_int8.mlmodelc}/model/coremldata.bin +0 -0
- /package/platforms/ios/Barkoder.xcframework/ios-arm64/Barkoder.framework/{int8_384x256_small2.mlmodelc → n2_384x256_int8.mlmodelc}/neural_network_optionals/coremldata.bin +0 -0
- /package/platforms/ios/Barkoder.xcframework/{ios-arm64_x86_64-simulator/Barkoder.framework/int8_384x256_small2.mlmodelc → ios-arm64/Barkoder.framework/n2_512x384_int8.mlmodelc}/model/coremldata.bin +0 -0
- /package/platforms/ios/Barkoder.xcframework/{ios-arm64_x86_64-simulator/Barkoder.framework/int8_384x256_small2.mlmodelc → ios-arm64/Barkoder.framework/n2_512x384_int8.mlmodelc}/neural_network_optionals/coremldata.bin +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { BarkoderConstants } from "./barkoder-nativescript.common";
|
|
2
|
-
import { View } from "@nativescript/core";
|
|
2
|
+
import { Color, View } from "@nativescript/core";
|
|
3
3
|
import { ios } from "@nativescript/core/application";
|
|
4
4
|
import { ImageSource } from '@nativescript/core';
|
|
5
|
+
import { Utils } from '@nativescript/core';
|
|
5
6
|
|
|
6
7
|
export class BarkoderViewIOS extends View {
|
|
7
8
|
public bkdView: any;
|
|
@@ -94,6 +95,10 @@ export class BarkoderViewIOS extends View {
|
|
|
94
95
|
this.bkdView.setFlash(enabled);
|
|
95
96
|
}
|
|
96
97
|
|
|
98
|
+
captureImage(): void {
|
|
99
|
+
this.bkdView.captureImage();
|
|
100
|
+
}
|
|
101
|
+
|
|
97
102
|
/**
|
|
98
103
|
* Retrieves the maximum available zoom factor for the device's camera
|
|
99
104
|
*/
|
|
@@ -465,6 +470,9 @@ export class BarkoderViewIOS extends View {
|
|
|
465
470
|
case BarkoderConstants.FormattingType.AAMVA:
|
|
466
471
|
this.bkdView.config.decoderConfig.formatting = 3;
|
|
467
472
|
break;
|
|
473
|
+
case BarkoderConstants.FormattingType.SADL:
|
|
474
|
+
this.bkdView.config.decoderConfig.formatting = 4;
|
|
475
|
+
break;
|
|
468
476
|
}
|
|
469
477
|
}
|
|
470
478
|
|
|
@@ -613,6 +621,30 @@ export class BarkoderViewIOS extends View {
|
|
|
613
621
|
return this.bkdView.config.decoderConfig.japanasePost.enabled;
|
|
614
622
|
case BarkoderConstants.DecoderType.MaxiCode:
|
|
615
623
|
return this.bkdView.config.decoderConfig.maxiCode.enabled;
|
|
624
|
+
case BarkoderConstants.DecoderType.OCRText:
|
|
625
|
+
return this.bkdView.config.decoderConfig.ocrText.enabled;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
getSadlImageFromExtra(extra: any): ImageSource | null {
|
|
630
|
+
if (!extra) {
|
|
631
|
+
return null;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
try {
|
|
635
|
+
const uiImage = BarkoderHelper.sadlImage(extra);
|
|
636
|
+
|
|
637
|
+
if (!uiImage) {
|
|
638
|
+
return null;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
const imageSource = new ImageSource();
|
|
642
|
+
imageSource.setNativeSource(uiImage); // ✅ assign UIImage directly
|
|
643
|
+
return imageSource;
|
|
644
|
+
|
|
645
|
+
} catch (e) {
|
|
646
|
+
console.error('iOS SADL image failed:', e);
|
|
647
|
+
return null;
|
|
616
648
|
}
|
|
617
649
|
}
|
|
618
650
|
|
|
@@ -660,6 +692,7 @@ export class BarkoderViewIOS extends View {
|
|
|
660
692
|
this.bkdView.config.decoderConfig.kix.enabled = false;
|
|
661
693
|
this.bkdView.config.decoderConfig.japanesePost.enabled = false;
|
|
662
694
|
this.bkdView.config.decoderConfig.maxiCode.enabled = false;
|
|
695
|
+
this.bkdView.config.decoderConfig.ocrText.enabled = false;
|
|
663
696
|
decoders.forEach((dt: BarkoderConstants.DecoderType) => {
|
|
664
697
|
switch (dt) {
|
|
665
698
|
case BarkoderConstants.DecoderType.Aztec:
|
|
@@ -779,6 +812,9 @@ export class BarkoderViewIOS extends View {
|
|
|
779
812
|
case BarkoderConstants.DecoderType.MaxiCode:
|
|
780
813
|
this.bkdView.config.decoderConfig.maxiCode.enabled = true;
|
|
781
814
|
break;
|
|
815
|
+
case BarkoderConstants.DecoderType.OCRText:
|
|
816
|
+
this.bkdView.config.decoderConfig.ocrText.enabled = true;
|
|
817
|
+
break;
|
|
782
818
|
default:
|
|
783
819
|
break;
|
|
784
820
|
}
|
|
@@ -1312,6 +1348,10 @@ export class BarkoderViewIOS extends View {
|
|
|
1312
1348
|
this.bkdView.config.decoderConfig.setcustomOptionValue(string, mode)
|
|
1313
1349
|
}
|
|
1314
1350
|
|
|
1351
|
+
setCustomOptionGlobal(string: string, mode: number): void {
|
|
1352
|
+
this.bkdView.config.decoderConfig.setcustomOptionValue(string, mode)
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1315
1355
|
setLicenseKey(licenseKey: string): void {
|
|
1316
1356
|
const config = new BarkoderConfig({
|
|
1317
1357
|
licenseKey: licenseKey,
|
|
@@ -1483,6 +1523,236 @@ export class BarkoderViewIOS extends View {
|
|
|
1483
1523
|
setResultDisappearanceDelayMs(ms : number) : void {
|
|
1484
1524
|
this.bkdView.config.arConfig.resultDisappearanceDelayMs = ms
|
|
1485
1525
|
}
|
|
1526
|
+
|
|
1527
|
+
|
|
1528
|
+
|
|
1529
|
+
|
|
1530
|
+
configureFlashButton(
|
|
1531
|
+
visible: boolean,
|
|
1532
|
+
position: number[], // [xDp, yDp]
|
|
1533
|
+
iconSize: number,
|
|
1534
|
+
tintColor: string | Color | null,
|
|
1535
|
+
backgroundColor: string | Color | null,
|
|
1536
|
+
cornerRadius: number,
|
|
1537
|
+
padding: number,
|
|
1538
|
+
useCustomIcon: boolean,
|
|
1539
|
+
flashOnIconBase64: string,
|
|
1540
|
+
flashOffIconBase64: string
|
|
1541
|
+
): void {
|
|
1542
|
+
if (!this.bkdView) {
|
|
1543
|
+
return;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
// ✅ Null-safe conversion of tintColor
|
|
1547
|
+
const nativeTintColor = tintColor != null
|
|
1548
|
+
? (tintColor instanceof Color
|
|
1549
|
+
? tintColor
|
|
1550
|
+
: new Color(tintColor as string)).ios
|
|
1551
|
+
: null;
|
|
1552
|
+
|
|
1553
|
+
// ✅ Null-safe conversion of backgroundColor
|
|
1554
|
+
const nativeBackgroundColor = backgroundColor != null
|
|
1555
|
+
? (backgroundColor instanceof Color
|
|
1556
|
+
? backgroundColor
|
|
1557
|
+
: new Color(backgroundColor as string)).ios
|
|
1558
|
+
: null;
|
|
1559
|
+
|
|
1560
|
+
// 2. Convert Position (JS number[] -> native CGPoint structure, wrapped in NSValue)
|
|
1561
|
+
const cgPoint: CGPoint = { x: position[0], y: position[1] };
|
|
1562
|
+
const nativePosition = NSValue.valueWithCGPoint(cgPoint);
|
|
1563
|
+
|
|
1564
|
+
// 3. Convert Base64 Strings to native UIImage
|
|
1565
|
+
let nativeFlashOnImage: UIImage = null;
|
|
1566
|
+
let nativeFlashOffImage: UIImage = null;
|
|
1567
|
+
|
|
1568
|
+
if (useCustomIcon) {
|
|
1569
|
+
nativeFlashOnImage = this.decodeBase64ToImage(flashOnIconBase64);
|
|
1570
|
+
nativeFlashOffImage = this.decodeBase64ToImage(flashOffIconBase64);
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
// 4. Call the native Swift/ObjC method
|
|
1574
|
+
this.bkdView.configureFlashButtonWithVisiblePositionIconSizeTintColorBackgroundColorCornerRadiusPaddingUseCustomIconCustomIconFlashOnCustomIconFlashOff(
|
|
1575
|
+
visible,
|
|
1576
|
+
nativePosition,
|
|
1577
|
+
iconSize,
|
|
1578
|
+
nativeTintColor,
|
|
1579
|
+
nativeBackgroundColor,
|
|
1580
|
+
cornerRadius,
|
|
1581
|
+
padding,
|
|
1582
|
+
useCustomIcon,
|
|
1583
|
+
nativeFlashOnImage,
|
|
1584
|
+
nativeFlashOffImage
|
|
1585
|
+
);
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
|
|
1589
|
+
// --- Helper Method Definition (iOS equivalent of decodeBase64ToBitmap) ---
|
|
1590
|
+
|
|
1591
|
+
|
|
1592
|
+
configureCloseButton(
|
|
1593
|
+
visible: boolean,
|
|
1594
|
+
position: number[],
|
|
1595
|
+
iconSize: number,
|
|
1596
|
+
tintColor: string | Color | null,
|
|
1597
|
+
backgroundColor: string | Color | null,
|
|
1598
|
+
cornerRadius: number,
|
|
1599
|
+
padding: number,
|
|
1600
|
+
useCustomIcon: boolean,
|
|
1601
|
+
customIcon: string,
|
|
1602
|
+
onClose?: () => void
|
|
1603
|
+
): void {
|
|
1604
|
+
if (!this.bkdView) {
|
|
1605
|
+
return;
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
// ✅ Safely handle nullable tintColor
|
|
1609
|
+
const nativeTintColor = tintColor != null
|
|
1610
|
+
? (tintColor instanceof Color
|
|
1611
|
+
? tintColor
|
|
1612
|
+
: new Color(tintColor as string)).ios
|
|
1613
|
+
: null;
|
|
1614
|
+
|
|
1615
|
+
// ✅ Safely handle nullable backgroundColor
|
|
1616
|
+
const nativeBackgroundColor = backgroundColor != null
|
|
1617
|
+
? (backgroundColor instanceof Color
|
|
1618
|
+
? backgroundColor
|
|
1619
|
+
: new Color(backgroundColor as string)).ios
|
|
1620
|
+
: null;
|
|
1621
|
+
|
|
1622
|
+
const cgPoint: CGPoint = { x: position[0], y: position[1] };
|
|
1623
|
+
const nativePosition = NSValue.valueWithCGPoint(cgPoint);
|
|
1624
|
+
|
|
1625
|
+
let customIconImage: UIImage = null;
|
|
1626
|
+
if (useCustomIcon) {
|
|
1627
|
+
customIconImage = this.decodeBase64ToImage(customIcon);
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
const nativeOnClose = onClose ? () => {
|
|
1631
|
+
onClose();
|
|
1632
|
+
} : null;
|
|
1633
|
+
|
|
1634
|
+
this.bkdView.configureCloseButtonWithVisiblePositionIconSizeTintColorBackgroundColorCornerRadiusPaddingUseCustomIconCustomIconOnClose(
|
|
1635
|
+
visible,
|
|
1636
|
+
nativePosition,
|
|
1637
|
+
iconSize,
|
|
1638
|
+
nativeTintColor,
|
|
1639
|
+
nativeBackgroundColor,
|
|
1640
|
+
cornerRadius,
|
|
1641
|
+
padding,
|
|
1642
|
+
useCustomIcon,
|
|
1643
|
+
customIconImage,
|
|
1644
|
+
nativeOnClose
|
|
1645
|
+
);
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
|
|
1649
|
+
|
|
1650
|
+
|
|
1651
|
+
|
|
1652
|
+
configureZoomButton(
|
|
1653
|
+
visible: boolean,
|
|
1654
|
+
position: number[], // [xDp, yDp]
|
|
1655
|
+
iconSize: number,
|
|
1656
|
+
tintColor: string | Color | null,
|
|
1657
|
+
backgroundColor: string | Color | null,
|
|
1658
|
+
cornerRadius: number,
|
|
1659
|
+
padding: number,
|
|
1660
|
+
useCustomIcon: boolean,
|
|
1661
|
+
zoomInIconBase64: string,
|
|
1662
|
+
zoomOutIconBase64: string,
|
|
1663
|
+
zoomedInFactor: number,
|
|
1664
|
+
zoomedOutFactor: number
|
|
1665
|
+
): void {
|
|
1666
|
+
if (!this.bkdView) {
|
|
1667
|
+
return;
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
// ✅ 1. Null-safe conversion of tintColor
|
|
1671
|
+
const nativeTintColor = tintColor != null
|
|
1672
|
+
? (tintColor instanceof Color
|
|
1673
|
+
? tintColor
|
|
1674
|
+
: new Color(tintColor as string)).ios
|
|
1675
|
+
: null;
|
|
1676
|
+
|
|
1677
|
+
// ✅ 2. Null-safe conversion of backgroundColor
|
|
1678
|
+
const nativeBackgroundColor = backgroundColor != null
|
|
1679
|
+
? (backgroundColor instanceof Color
|
|
1680
|
+
? backgroundColor
|
|
1681
|
+
: new Color(backgroundColor as string)).ios
|
|
1682
|
+
: null;
|
|
1683
|
+
|
|
1684
|
+
// 3. Convert Position (JS number[] -> native CGPoint, wrapped in NSValue)
|
|
1685
|
+
const cgPoint: CGPoint = { x: position[0], y: position[1] };
|
|
1686
|
+
const nativePosition = NSValue.valueWithCGPoint(cgPoint);
|
|
1687
|
+
|
|
1688
|
+
// 4. Convert Base64 Strings to native UIImage
|
|
1689
|
+
let nativeZoomInImage: UIImage = null;
|
|
1690
|
+
let nativeZoomOutImage: UIImage = null;
|
|
1691
|
+
|
|
1692
|
+
if (useCustomIcon) {
|
|
1693
|
+
nativeZoomInImage = this.decodeBase64ToImage(zoomInIconBase64);
|
|
1694
|
+
nativeZoomOutImage = this.decodeBase64ToImage(zoomOutIconBase64);
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
// 5. Call the native iOS method
|
|
1698
|
+
this.bkdView.configureZoomButtonWithVisiblePositionIconSizeTintColorBackgroundColorCornerRadiusPaddingUseCustomIconCustomIconZoomedInCustomIconZoomedOutZoomedInFactorZoomedOutFactor(
|
|
1699
|
+
visible,
|
|
1700
|
+
nativePosition,
|
|
1701
|
+
iconSize,
|
|
1702
|
+
nativeTintColor,
|
|
1703
|
+
nativeBackgroundColor,
|
|
1704
|
+
cornerRadius,
|
|
1705
|
+
padding,
|
|
1706
|
+
useCustomIcon,
|
|
1707
|
+
nativeZoomInImage,
|
|
1708
|
+
nativeZoomOutImage,
|
|
1709
|
+
zoomedInFactor,
|
|
1710
|
+
zoomedOutFactor
|
|
1711
|
+
);
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
|
|
1715
|
+
// --- Required Helper Method (Must be defined in your class) ---
|
|
1716
|
+
|
|
1717
|
+
/**
|
|
1718
|
+
* Decodes a Base64 string into a native UIImage object.
|
|
1719
|
+
* This is the iOS equivalent of decodeBase64ToBitmap used in Android.
|
|
1720
|
+
*/
|
|
1721
|
+
private decodeBase64ToImage(base64String: string): UIImage {
|
|
1722
|
+
if (!base64String) {
|
|
1723
|
+
return null;
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
// Remove potential header (e.g., "data:image/png;base64,")
|
|
1727
|
+
const cleanString = base64String.replace(/^data:image\/(png|jpeg);base64,/, '');
|
|
1728
|
+
|
|
1729
|
+
// Convert Base64 string to NSData
|
|
1730
|
+
const nsData = NSData.alloc().initWithBase64EncodedStringOptions(
|
|
1731
|
+
cleanString,
|
|
1732
|
+
NSDataBase64DecodingOptions.NSDataBase64DecodingIgnoreUnknownCharacters
|
|
1733
|
+
);
|
|
1734
|
+
|
|
1735
|
+
if (nsData) {
|
|
1736
|
+
// Convert NSData to UIImage
|
|
1737
|
+
return UIImage.imageWithData(nsData);
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
return null;
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
|
|
1744
|
+
|
|
1745
|
+
setARResultLimit(resultLimit: number): void {
|
|
1746
|
+
this.bkdView.config.arConfig.resultLimit = resultLimit
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
setARContinueScanningOnLimit(enabled: boolean): void {
|
|
1750
|
+
this.bkdView.config.arConfig.continueScanningOnLimit = enabled
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
setAREmitResultsAtSessionEndOnly(enabled: boolean): void {
|
|
1754
|
+
this.bkdView.config.arConfig.emitResultsAtSessionEndOnly = enabled
|
|
1755
|
+
}
|
|
1486
1756
|
|
|
1487
1757
|
getResultDisappearanceDelayMs(): any {
|
|
1488
1758
|
return this.bkdView.config.arConfig.resultDisappearanceDelayMs
|
|
@@ -1586,32 +1856,51 @@ export class BarkoderViewWraper extends UIResponder
|
|
|
1586
1856
|
imgSrc.setNativeSource(uiImage);
|
|
1587
1857
|
jsThumbnails.push(imgSrc);
|
|
1588
1858
|
}
|
|
1589
|
-
}
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
const jsResults: any[] = [];
|
|
1862
|
+
|
|
1863
|
+
if (decoderResults instanceof NSArray) {
|
|
1864
|
+
for (let i = 0; i < decoderResults.count; i++) {
|
|
1865
|
+
const result = decoderResults.objectAtIndex(i);
|
|
1866
|
+
jsResults.push(this._convertResult(result));
|
|
1594
1867
|
}
|
|
1595
1868
|
}
|
|
1596
1869
|
|
|
1597
|
-
// Convert
|
|
1870
|
+
// Convert image
|
|
1598
1871
|
let convertedImage: ImageSource | null = null;
|
|
1599
|
-
|
|
1600
1872
|
if (image) {
|
|
1601
1873
|
convertedImage = new ImageSource();
|
|
1602
1874
|
convertedImage.setNativeSource(image);
|
|
1603
|
-
} else if (jsThumbnails.length > 0) {
|
|
1604
|
-
console.warn('⚠️ resultImage is null, using first thumbnail as fallback.');
|
|
1605
|
-
convertedImage = jsThumbnails[0];
|
|
1606
|
-
} else {
|
|
1607
|
-
console.warn('⚠️ resultImage and thumbnails are both missing.');
|
|
1608
1875
|
}
|
|
1609
1876
|
|
|
1610
|
-
//
|
|
1611
|
-
this.callback.scanningFinished(
|
|
1877
|
+
// Fire JS callback
|
|
1878
|
+
this.callback.scanningFinished(jsResults, jsThumbnails, convertedImage);
|
|
1612
1879
|
}
|
|
1613
1880
|
|
|
1614
1881
|
static new(): BarkoderViewWraper {
|
|
1615
1882
|
return super.new.call(this);
|
|
1616
1883
|
}
|
|
1884
|
+
|
|
1885
|
+
private _convertResult(result: any): any {
|
|
1886
|
+
const extras: { key: string; value: string }[] = [];
|
|
1887
|
+
|
|
1888
|
+
if (result.extra && result.extra.allKeys) {
|
|
1889
|
+
const keys = result.extra.allKeys;
|
|
1890
|
+
for (let i = 0; i < keys.count; i++) {
|
|
1891
|
+
const key = keys.objectAtIndex(i);
|
|
1892
|
+
const value = result.extra.objectForKey(key);
|
|
1893
|
+
extras.push({
|
|
1894
|
+
key: key.toString(),
|
|
1895
|
+
value: value?.toString?.() ?? '',
|
|
1896
|
+
});
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
return {
|
|
1901
|
+
textualData: result.textualData,
|
|
1902
|
+
extra: extras,
|
|
1903
|
+
// add other fields if needed (e.g., barcodeType, location, etc.)
|
|
1904
|
+
};
|
|
1905
|
+
}
|
|
1617
1906
|
}
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -8,32 +8,32 @@
|
|
|
8
8
|
<key>BinaryPath</key>
|
|
9
9
|
<string>Barkoder.framework/Barkoder</string>
|
|
10
10
|
<key>LibraryIdentifier</key>
|
|
11
|
-
<string>ios-
|
|
11
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
12
12
|
<key>LibraryPath</key>
|
|
13
13
|
<string>Barkoder.framework</string>
|
|
14
14
|
<key>SupportedArchitectures</key>
|
|
15
15
|
<array>
|
|
16
16
|
<string>arm64</string>
|
|
17
|
+
<string>x86_64</string>
|
|
17
18
|
</array>
|
|
18
19
|
<key>SupportedPlatform</key>
|
|
19
20
|
<string>ios</string>
|
|
21
|
+
<key>SupportedPlatformVariant</key>
|
|
22
|
+
<string>simulator</string>
|
|
20
23
|
</dict>
|
|
21
24
|
<dict>
|
|
22
25
|
<key>BinaryPath</key>
|
|
23
26
|
<string>Barkoder.framework/Barkoder</string>
|
|
24
27
|
<key>LibraryIdentifier</key>
|
|
25
|
-
<string>ios-
|
|
28
|
+
<string>ios-arm64</string>
|
|
26
29
|
<key>LibraryPath</key>
|
|
27
30
|
<string>Barkoder.framework</string>
|
|
28
31
|
<key>SupportedArchitectures</key>
|
|
29
32
|
<array>
|
|
30
33
|
<string>arm64</string>
|
|
31
|
-
<string>x86_64</string>
|
|
32
34
|
</array>
|
|
33
35
|
<key>SupportedPlatform</key>
|
|
34
36
|
<string>ios</string>
|
|
35
|
-
<key>SupportedPlatformVariant</key>
|
|
36
|
-
<string>simulator</string>
|
|
37
37
|
</dict>
|
|
38
38
|
</array>
|
|
39
39
|
<key>CFBundlePackageType</key>
|
|
Binary file
|
|
@@ -74,7 +74,8 @@ typedef enum {
|
|
|
74
74
|
RoyalMail,
|
|
75
75
|
KIX,
|
|
76
76
|
JapanesePost,
|
|
77
|
-
MaxiCode
|
|
77
|
+
MaxiCode,
|
|
78
|
+
OCRText
|
|
78
79
|
|
|
79
80
|
} DecoderType;
|
|
80
81
|
|
|
@@ -449,6 +450,13 @@ typedef enum {
|
|
|
449
450
|
- (id)initWithDecoderType:(DecoderType)decoderType;
|
|
450
451
|
@end
|
|
451
452
|
|
|
453
|
+
//==========================================================================
|
|
454
|
+
// OCR Text Config
|
|
455
|
+
//==========================================================================
|
|
456
|
+
@interface OCRTextConfig : SpecificConfig
|
|
457
|
+
- (id)initWithDecoderType:(DecoderType)decoderType;
|
|
458
|
+
@end
|
|
459
|
+
|
|
452
460
|
//==========================================================================
|
|
453
461
|
// Config
|
|
454
462
|
//==========================================================================
|
|
@@ -483,11 +491,14 @@ typedef enum {
|
|
|
483
491
|
//==========================================================================
|
|
484
492
|
// Config
|
|
485
493
|
//==========================================================================
|
|
486
|
-
|
|
494
|
+
//@interface Config : NSObject
|
|
495
|
+
@interface Config : NSObject <NSCopying>
|
|
487
496
|
+(ConfigResponse*)configWithLicenseKey:(NSString*)key licenseCheckHandler:(void (^_Nullable)(LicenseCheckResult * _Nonnull result))callback;
|
|
488
497
|
|
|
489
498
|
+(int) setGlobalOption: (GlobalOption) option value: (int) value;
|
|
490
499
|
+(int) getGlobalOption: (GlobalOption) option;
|
|
500
|
+
+(void)setcustomOptionGlobal: (NSString *_Nonnull)option value:(int) value;
|
|
501
|
+
+(NSDictionary<NSString*, NSString*>* _Nonnull)getLicenseInfo;
|
|
491
502
|
|
|
492
503
|
@property (nonatomic, readonly, retain) AztecConfig* _Nonnull aztec;
|
|
493
504
|
@property (nonatomic, readonly, retain) AztecCompactConfig* _Nonnull aztecCompact;
|
|
@@ -530,6 +541,7 @@ typedef enum {
|
|
|
530
541
|
@property (nonatomic, readonly, retain) MaxiCodeConfig* _Nonnull maxiCode;
|
|
531
542
|
|
|
532
543
|
@property (nonatomic, readonly, retain) IDDocumentConfig* _Nonnull idDocument;
|
|
544
|
+
@property (nonatomic, readonly, retain) OCRTextConfig* _Nonnull ocrText;
|
|
533
545
|
|
|
534
546
|
@property (nonatomic, readwrite) DecodingSpeed decodingSpeed;
|
|
535
547
|
@property (nonatomic, readwrite) NSString * _Nonnull encodingCharacterSet;
|
|
@@ -692,7 +704,17 @@ UIImage
|
|
|
692
704
|
+ (UIImage *)UIImageFromLocation:(UIImage *)source points:(CGPoint[4])points marginPercent:(float)marginPercent;
|
|
693
705
|
#endif
|
|
694
706
|
|
|
695
|
-
|
|
707
|
+
#if TARGET_OS_OSX
|
|
708
|
+
+ (NSImage *)WarpUIImageFromLocation:(NSImage *)source
|
|
709
|
+
#else
|
|
710
|
+
+ (UIImage *)WarpUIImageFromLocation:(UIImage *)source
|
|
711
|
+
#endif
|
|
712
|
+
points:(CGPoint[4])points // TL, TR, BR, BL (top-left origin)
|
|
713
|
+
size:(CGSize)size // if any dim is 0 → auto-size
|
|
714
|
+
aspectRatio:(CGFloat)aspectRatio // if >0 used for auto/derived dimension(s)
|
|
715
|
+
rotationShift:(NSInteger)rotationShift
|
|
716
|
+
margin:(CGFloat)margin
|
|
717
|
+
forceLandscape:(BOOL)forceLandscape;
|
|
696
718
|
|
|
697
719
|
|
|
698
720
|
@end
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"shortDescription" : "
|
|
3
|
+
"shortDescription" : "barKoder model for oriented object detection.",
|
|
4
4
|
"metadataOutputVersion" : "3.0",
|
|
5
5
|
"outputSchema" : [
|
|
6
6
|
{
|
|
@@ -10,18 +10,17 @@
|
|
|
10
10
|
"formattedType" : "MultiArray (Float32)",
|
|
11
11
|
"shortDescription" : "",
|
|
12
12
|
"shape" : "[]",
|
|
13
|
-
"name" : "
|
|
13
|
+
"name" : "var_1253",
|
|
14
14
|
"type" : "MultiArray"
|
|
15
15
|
}
|
|
16
16
|
],
|
|
17
|
-
"version" : "
|
|
17
|
+
"version" : "2.0",
|
|
18
18
|
"modelParameters" : [
|
|
19
19
|
|
|
20
20
|
],
|
|
21
|
-
"author" : "
|
|
21
|
+
"author" : "barKoder Exporter",
|
|
22
22
|
"specificationVersion" : 4,
|
|
23
|
-
"storagePrecision" : "
|
|
24
|
-
"license" : "AGPL-3.0 License (https:\/\/ultralytics.com\/license)",
|
|
23
|
+
"storagePrecision" : "Int8",
|
|
25
24
|
"computePrecision" : "Float16",
|
|
26
25
|
"stateSchema" : [
|
|
27
26
|
|
|
@@ -53,35 +52,25 @@
|
|
|
53
52
|
}
|
|
54
53
|
],
|
|
55
54
|
"userDefinedMetadata" : {
|
|
56
|
-
"com.github.apple.coremltools.
|
|
57
|
-
"
|
|
58
|
-
"com.github.apple.coremltools.version" : "6.2",
|
|
59
|
-
"docs" : "https:\/\/docs.ultralytics.com",
|
|
60
|
-
"task" : "obb",
|
|
55
|
+
"com.github.apple.coremltools.source_dialect" : "TorchScript",
|
|
56
|
+
"names" : "{0: 'id_mrz_image', 1: 'mrz_2', 2: 'mrz_3', 3: 'id_mrz', 4: 'id_image', 5: 'face', 6: 'vin', 7: 'signature'}",
|
|
61
57
|
"imgsz" : "[256, 384]",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"names" : "{0: 'id_mrz_image', 1: 'mrz_2', 2: 'mrz_3', 3: 'id_mrz', 4: 'id_image', 5: 'face', 6: 'vin', 7: 'signature'}"
|
|
58
|
+
"com.github.apple.coremltools.source" : "torch==1.13.1+cu117",
|
|
59
|
+
"com.github.apple.coremltools.version" : "8.3.0"
|
|
65
60
|
},
|
|
66
|
-
"generatedClassName" : "
|
|
61
|
+
"generatedClassName" : "n2_384x256_int8",
|
|
67
62
|
"neuralNetworkLayerTypeHistogram" : {
|
|
68
63
|
"Concat" : 16,
|
|
69
|
-
"
|
|
70
|
-
"
|
|
64
|
+
"Transpose" : 1,
|
|
65
|
+
"Multiply" : 60,
|
|
66
|
+
"ReshapeStatic" : 3,
|
|
67
|
+
"Add" : 7,
|
|
71
68
|
"PoolingINVALID" : 3,
|
|
69
|
+
"SplitND" : 8,
|
|
72
70
|
"UpsampleINVALID" : 2,
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"Transpose" : 1,
|
|
77
|
-
"Cos" : 1,
|
|
78
|
-
"SplitND" : 11,
|
|
79
|
-
"Softmax" : 1,
|
|
80
|
-
"MultiplyBroadcastable" : 1,
|
|
81
|
-
"Multiply" : 65,
|
|
82
|
-
"Add" : 10,
|
|
83
|
-
"ConcatND" : 5,
|
|
84
|
-
"ActivationLinear" : 3
|
|
71
|
+
"Convolution" : 72,
|
|
72
|
+
"ActivationSigmoid" : 66,
|
|
73
|
+
"ConcatND" : 1
|
|
85
74
|
},
|
|
86
75
|
"method" : "predict"
|
|
87
76
|
}
|