react-native-scanbot-barcode-scanner-sdk 3.2.1-beta2 → 3.2.1-beta5
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/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/JSONUtils.java +21 -0
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ObjectMapper.java +22 -6
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ReactBarcodeExtensionsFilter.java +61 -0
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkModule.java +52 -69
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/barcode/ScanbotBarcodeDetectorAdditionalConfigBuilder.java +36 -0
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/barcode/ScanbotBarcodeDetectorConfigBuilder.java +45 -0
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewFragment.java +23 -28
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewManager.java +1 -1
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/filters/ReactBarcodeExtensionsFilter.java +59 -0
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/utils/BitmapHelper.java +30 -0
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/utils/JSONUtils.java +286 -0
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/utils/LogUtils.java +40 -0
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/utils/ResponseUtils.java +41 -0
- package/ios/ScanbotBarcodeSdk.m +41 -49
- package/ios/Utils/BarcodeMapping.h +68 -13
- package/ios/Utils/ReactBarcodeExtensionsFilter.h +22 -0
- package/ios/Utils/ReactBarcodeExtensionsFilter.m +55 -0
- package/package.json +1 -1
- package/src/configuration.ts +10 -5
- package/src/enum.ts +5 -0
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/BarcodeExtensionsFilter.java +0 -24
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ReactBarcodeExtensionsFilter.m
|
|
3
|
+
// RNScanbotBarcodeSDK
|
|
4
|
+
//
|
|
5
|
+
// Created by Marco Saia on 13.07.22.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import "ReactBarcodeExtensionsFilter.h"
|
|
9
|
+
|
|
10
|
+
@implementation ReactBarcodeExtensionsFilter {
|
|
11
|
+
BarcodeFilterType mFilterType;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
-(id)init:(BarcodeFilterType)filterType
|
|
15
|
+
{
|
|
16
|
+
if(self = [super init]) {
|
|
17
|
+
mFilterType = filterType;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return self;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
- (BOOL)acceptsBarcode:(nonnull SBSDKBarcodeScannerResult *)barcode {
|
|
24
|
+
if (![super acceptsBarcode: barcode]) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
NSString* extension = barcode.metadata[SBSDKBarcodeMetadataEANUPCExtensionKey];
|
|
29
|
+
if (extension == nil || [extension length] == 0) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
switch (mFilterType) {
|
|
34
|
+
case ReactBarcodeExtensionsFilterWithExtension:
|
|
35
|
+
return true;
|
|
36
|
+
case ReactBarcodeExtensionsFilterWithEAN2Extension:
|
|
37
|
+
return trim(extension).length == 2;
|
|
38
|
+
case ReactBarcodeExtensionsFilterWithEAN5Extension:
|
|
39
|
+
return trim(extension).length == 5;
|
|
40
|
+
default:
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
- (BOOL)shouldAdd:(nonnull SBSDKBarcodeScannerResult *)barcode
|
|
46
|
+
toBarcodes:(nonnull NSArray<SBSDKBarcodeScannerResult *>*)codes
|
|
47
|
+
{
|
|
48
|
+
return [super shouldAdd:barcode toBarcodes:codes];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static inline NSString* trim(NSString* text) {
|
|
52
|
+
return [text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@end
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-scanbot-barcode-scanner-sdk",
|
|
3
3
|
"title": "Scanbot Barcode Scanner SDK for React Native",
|
|
4
|
-
"version": "3.2.1-
|
|
4
|
+
"version": "3.2.1-beta5",
|
|
5
5
|
"description": "Scanbot Barcode Scanner SDK React Native Plugin for Android and iOS",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
package/src/configuration.ts
CHANGED
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
BarcodeImageGenerationType,
|
|
11
11
|
UIInterfaceOrientationMask,
|
|
12
12
|
EngineMode,
|
|
13
|
-
CameraModule
|
|
13
|
+
CameraModule,
|
|
14
|
+
BarcodeFilter
|
|
14
15
|
} from "./enum";
|
|
15
16
|
import { MSIPlesseyChecksumAlgorithm } from "./enum";
|
|
16
17
|
|
|
@@ -89,9 +90,9 @@ export interface BarcodeScannerConfiguration {
|
|
|
89
90
|
*/
|
|
90
91
|
minimum1DBarcodesQuietZone?: number
|
|
91
92
|
/**
|
|
92
|
-
*
|
|
93
|
+
* Use a filter to determine which type of barcode can be detected; see `BarcodeFilter`
|
|
93
94
|
*/
|
|
94
|
-
|
|
95
|
+
barcodeFilter?: BarcodeFilter;
|
|
95
96
|
/**
|
|
96
97
|
* Whether a sound should be played on successful barcode detection.
|
|
97
98
|
*/
|
|
@@ -301,9 +302,9 @@ export interface BatchBarcodeScannerConfiguration {
|
|
|
301
302
|
*/
|
|
302
303
|
minimum1DBarcodesQuietZone?: number;
|
|
303
304
|
/**
|
|
304
|
-
*
|
|
305
|
+
* Use a filter to determine which type of barcode can be detected; see `BarcodeFilter`
|
|
305
306
|
*/
|
|
306
|
-
|
|
307
|
+
barcodeFilter?: BarcodeFilter;
|
|
307
308
|
/**
|
|
308
309
|
* The engine mode of the barcode recognizer. Defaults to NEXT_GEN.
|
|
309
310
|
* To use the legacy recognizer, please specify LEGACY.
|
|
@@ -355,6 +356,10 @@ interface InternalBarcodeDetectionCommonParameters {
|
|
|
355
356
|
* By default all supported document formats will be detected.
|
|
356
357
|
*/
|
|
357
358
|
acceptedDocumentFormats?: BarcodeDocumentFormat[];
|
|
359
|
+
/**
|
|
360
|
+
* Use a filter to determine which type of barcode can be detected; see `BarcodeFilter`
|
|
361
|
+
*/
|
|
362
|
+
barcodeFilter?: BarcodeFilter;
|
|
358
363
|
/**
|
|
359
364
|
* Optional minimum required text length of the detected barcode.
|
|
360
365
|
* The default is 0 (setting is turned off).
|
package/src/enum.ts
CHANGED
package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/BarcodeExtensionsFilter.java
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
package io.scanbot.barcodesdk.plugin.reactnative;
|
|
2
|
-
|
|
3
|
-
import androidx.annotation.NonNull;
|
|
4
|
-
|
|
5
|
-
import java.util.List;
|
|
6
|
-
|
|
7
|
-
import io.scanbot.sdk.barcode.entity.BarcodeItem;
|
|
8
|
-
import io.scanbot.sdk.barcode.entity.BarcodeMetadataKey;
|
|
9
|
-
import io.scanbot.sdk.ui.view.barcode.configuration.IBarcodeFilter;
|
|
10
|
-
|
|
11
|
-
public class BarcodeExtensionsFilter implements IBarcodeFilter {
|
|
12
|
-
@Override
|
|
13
|
-
public boolean acceptsBarcode(@NonNull BarcodeItem barcodeItem) {
|
|
14
|
-
return barcodeItem.getMetadata().containsKey(BarcodeMetadataKey.UpcEanExtension);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
@Override
|
|
18
|
-
public boolean shouldAdd(@NonNull BarcodeItem barcodeItem, @NonNull List<BarcodeItem> list) {
|
|
19
|
-
if (this.acceptsBarcode(barcodeItem)) {
|
|
20
|
-
return !list.contains(barcodeItem);
|
|
21
|
-
}
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
}
|