react-native-scanbot-barcode-scanner-sdk 3.3.0-alpha1 → 3.3.0-beta1
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/ScanbotBarcodeSdkModule.java +2 -1
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/RNScanbotBarcodeCameraComponent.java +0 -1
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/utils/JSONUtils.java +6 -10
- package/ios/Components/BarcodeCameraView/RNScanbotBarcodeCameraView.m +1 -2
- package/ios/ScanbotBarcodeSdk.m +2 -2
- package/ios/Utils/BarcodeMapping.h +54 -9
- package/ios/Utils/ObjectMapper.h +0 -1
- package/ios/Utils/ObjectMapper.m +0 -52
- package/package.json +1 -1
package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkModule.java
CHANGED
|
@@ -57,6 +57,7 @@ import io.scanbot.sdk.ui.view.barcode.batch.configuration.BatchBarcodeScannerCon
|
|
|
57
57
|
import io.scanbot.sdk.barcode.BarcodeFilter;
|
|
58
58
|
import io.scanbot.sdk.ui.view.barcode.configuration.BarcodeScannerAdditionalConfiguration;
|
|
59
59
|
import io.scanbot.sdk.ui.view.barcode.configuration.BarcodeScannerConfiguration;
|
|
60
|
+
import io.scanbot.sdk.ui.view.barcode.configuration.CommonBarcodeScannerConfiguration;
|
|
60
61
|
import io.scanbot.sdk.ui.view.base.configuration.CameraOrientationMode;
|
|
61
62
|
import kotlin.Unit;
|
|
62
63
|
|
|
@@ -265,7 +266,7 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
|
|
|
265
266
|
}
|
|
266
267
|
}
|
|
267
268
|
|
|
268
|
-
private void setCustomBarcodeScannerConfiguration(final ReadableMap options,
|
|
269
|
+
private void setCustomBarcodeScannerConfiguration(final ReadableMap options, CommonBarcodeScannerConfiguration configuration) {
|
|
269
270
|
CameraOrientationMode orientationMode = JSONUtils.extractCameraOrientationMode(options);
|
|
270
271
|
if (orientationMode != null) {
|
|
271
272
|
configuration.setOrientationLockMode(orientationMode);
|
|
@@ -131,7 +131,6 @@ public class RNScanbotBarcodeCameraComponent extends RNScanbotNativeComponent im
|
|
|
131
131
|
final FinderOverlayView finderOverlayView = barcodeCameraUi.getFinderOverlayView();
|
|
132
132
|
final ScanbotCameraXView cameraView = barcodeCameraUi.getCameraView();
|
|
133
133
|
|
|
134
|
-
finderOverlayView.setVisibility(configuration.shouldUseFinderView() ? View.VISIBLE : View.INVISIBLE);
|
|
135
134
|
finderOverlayView.setVisibility(configuration.shouldUseFinderView() ? View.VISIBLE : View.INVISIBLE);
|
|
136
135
|
finderOverlayView.setStrokeWidth(configuration.getFinderLineWidth());
|
|
137
136
|
finderOverlayView.setStrokeColor(configuration.getFinderLineColor());
|
|
@@ -333,7 +333,7 @@ public final class JSONUtils {
|
|
|
333
333
|
return jsonArray;
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
-
for (byte b: rawBytes) {
|
|
336
|
+
for (byte b : rawBytes) {
|
|
337
337
|
jsonArray.pushInt(b);
|
|
338
338
|
}
|
|
339
339
|
|
|
@@ -354,33 +354,29 @@ public final class JSONUtils {
|
|
|
354
354
|
}
|
|
355
355
|
|
|
356
356
|
BarcodeOverlayTextFormat textFormat = BarcodeOverlayTextFormat.CODE_AND_TYPE;
|
|
357
|
-
// TODO
|
|
358
|
-
// if (configuration.hasKey("textFormat")){
|
|
359
|
-
// overlayEnabled = configuration.getBoolean("textFormat");
|
|
360
|
-
// }
|
|
361
357
|
|
|
362
358
|
int polygonColor = Color.BLACK;
|
|
363
|
-
if (configuration.hasKey("polygonColor")){
|
|
359
|
+
if (configuration.hasKey("polygonColor")) {
|
|
364
360
|
polygonColor = Color.parseColor(configuration.getString("polygonColor"));
|
|
365
361
|
}
|
|
366
362
|
|
|
367
363
|
int textColor = Color.BLACK;
|
|
368
|
-
if (configuration.hasKey("textColor")){
|
|
364
|
+
if (configuration.hasKey("textColor")) {
|
|
369
365
|
textColor = Color.parseColor(configuration.getString("textColor"));
|
|
370
366
|
}
|
|
371
367
|
|
|
372
368
|
int textContainerColor = Color.BLACK;
|
|
373
|
-
if (configuration.hasKey("textContainerColor")){
|
|
369
|
+
if (configuration.hasKey("textContainerColor")) {
|
|
374
370
|
textContainerColor = Color.parseColor(configuration.getString("textContainerColor"));
|
|
375
371
|
}
|
|
376
372
|
|
|
377
373
|
Integer highlightedPolygonColor = null;
|
|
378
|
-
if (configuration.hasKey("highlightedPolygonColor")){
|
|
374
|
+
if (configuration.hasKey("highlightedPolygonColor")) {
|
|
379
375
|
highlightedPolygonColor = Color.parseColor(configuration.getString("highlightedPolygonColor"));
|
|
380
376
|
}
|
|
381
377
|
|
|
382
378
|
Integer highlightedTextColor = null;
|
|
383
|
-
if (configuration.hasKey("highlightedTextColor")){
|
|
379
|
+
if (configuration.hasKey("highlightedTextColor")) {
|
|
384
380
|
highlightedTextColor = Color.parseColor(configuration.getString("highlightedTextColor"));
|
|
385
381
|
}
|
|
386
382
|
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
}
|
|
117
117
|
configuration.viewFinderEnabled = self.shouldUseFinderView;
|
|
118
118
|
viewController.viewFinderConfiguration = configuration;
|
|
119
|
-
|
|
119
|
+
if (_cameraViewConfiguration.barcodeFormats) {
|
|
120
120
|
viewController.acceptedBarcodeTypes = _cameraViewConfiguration.barcodeFormats;
|
|
121
121
|
}
|
|
122
122
|
if (_cameraViewConfiguration.acceptedDocumentFormats) {
|
|
@@ -194,7 +194,6 @@
|
|
|
194
194
|
|
|
195
195
|
- (void)sendScanResults:(NSArray<SBSDKBarcodeScannerResult*>*) results onImage:(UIImage*)image {
|
|
196
196
|
if(!self.onBarcodeScannerResult) {
|
|
197
|
-
// hello
|
|
198
197
|
return;
|
|
199
198
|
}
|
|
200
199
|
|
package/ios/ScanbotBarcodeSdk.m
CHANGED
|
@@ -128,7 +128,7 @@ RCT_EXPORT_METHOD(startBarcodeScanner:(NSDictionary*)configuration
|
|
|
128
128
|
[ObjectMapper populateInstance:uiConfig fromDictionary:configuration];
|
|
129
129
|
[ObjectMapper populateInstance:behaviorConfig fromDictionary:configuration];
|
|
130
130
|
[ObjectMapper populateInstance:textConfig fromDictionary:configuration];
|
|
131
|
-
selectionOverlayConfig =
|
|
131
|
+
selectionOverlayConfig = extractSelectionOverlayConfig(configuration);
|
|
132
132
|
}
|
|
133
133
|
@catch (NSException* ex) {
|
|
134
134
|
reject(@"Property error", [ex reason], nil);
|
|
@@ -186,7 +186,7 @@ RCT_EXPORT_METHOD(startBatchBarcodeScanner:(NSDictionary*)configuration
|
|
|
186
186
|
[ObjectMapper populateInstance:uiConfig fromDictionary:configuration];
|
|
187
187
|
[ObjectMapper populateInstance:behaviorConfig fromDictionary:configuration];
|
|
188
188
|
[ObjectMapper populateInstance:textConfig fromDictionary:configuration];
|
|
189
|
-
selectionOverlayConfig =
|
|
189
|
+
selectionOverlayConfig = extractSelectionOverlayConfig(configuration);
|
|
190
190
|
}
|
|
191
191
|
@catch (NSException* ex) {
|
|
192
192
|
reject(@"Property error", [ex reason], nil);
|
|
@@ -63,7 +63,7 @@ static inline NSString* stringFromBarcodeType(SBSDKBarcodeType* type) {
|
|
|
63
63
|
if ([type.name isEqualToString:@"RSSExpanded"]) {
|
|
64
64
|
return @"RSS_EXPANDED";
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
|
|
67
67
|
NSString* result = [type.name uppercaseString];
|
|
68
68
|
result = [result stringByReplacingOccurrencesOfString:@"-" withString:@"_"];
|
|
69
69
|
result = [result stringByReplacingOccurrencesOfString:@" " withString:@"_"];
|
|
@@ -85,7 +85,7 @@ static inline NSArray<NSDictionary<NSString*, NSObject*>*>* jsonFromBarcodeResul
|
|
|
85
85
|
for (int i = 0; i < results.count; ++i) {
|
|
86
86
|
[jsonResults addObject:jsonFromBarcodeResult([results objectAtIndex:i])];
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
|
|
89
89
|
return [jsonResults copy];
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -94,13 +94,13 @@ static inline NSArray<NSDictionary<NSString*, NSObject*>*>* jsonFromMappedBarcod
|
|
|
94
94
|
for (int i = 0; i < results.count; ++i) {
|
|
95
95
|
[jsonResults addObject:jsonFromBarcodeResult([results objectAtIndex:i].barcode)];
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
|
|
98
98
|
return [jsonResults copy];
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
static inline SBSDKBarcodeMSIPlesseyChecksumAlgorithm extractPlesseyChecksumAlgorithmFromConfiguration(NSDictionary* configuration) {
|
|
102
102
|
NSString* algorithm = [configuration objectForKey:@"msiPlesseyChecksumAlgorithm"];
|
|
103
|
-
|
|
103
|
+
|
|
104
104
|
if (algorithm != nil) {
|
|
105
105
|
if ([algorithm isEqualToString:@"None"]) return SBSDKBarcodeMSIPlesseyChecksumAlgorithmNone;
|
|
106
106
|
if ([algorithm isEqualToString:@"Mod10"]) return SBSDKBarcodeMSIPlesseyChecksumAlgorithmMod10;
|
|
@@ -110,7 +110,7 @@ static inline SBSDKBarcodeMSIPlesseyChecksumAlgorithm extractPlesseyChecksumAlgo
|
|
|
110
110
|
if ([algorithm isEqualToString:@"Mod1110IBM"]) return SBSDKBarcodeMSIPlesseyChecksumAlgorithmMod1110IBM;
|
|
111
111
|
if ([algorithm isEqualToString:@"Mod1110NCR"]) return SBSDKBarcodeMSIPlesseyChecksumAlgorithmMod1110NCR;
|
|
112
112
|
}
|
|
113
|
-
|
|
113
|
+
|
|
114
114
|
return SBSDKBarcodeMSIPlesseyChecksumAlgorithmMod10;
|
|
115
115
|
}
|
|
116
116
|
|
|
@@ -133,18 +133,18 @@ static inline SBSDKUIBarcodeFilter* extractBarcodeFilter(NSDictionary* configura
|
|
|
133
133
|
|
|
134
134
|
static inline NSArray* filterBarcodeResults(NSArray<SBSDKBarcodeScannerResult *>* barcodeResults, SBSDKUIBarcodeFilter* filter) {
|
|
135
135
|
NSMutableArray<SBSDKBarcodeScannerResult *>* outResults = [[NSMutableArray alloc] init];
|
|
136
|
-
|
|
136
|
+
|
|
137
137
|
if (barcodeResults == nil) {
|
|
138
138
|
return outResults;
|
|
139
139
|
}
|
|
140
|
-
|
|
140
|
+
|
|
141
141
|
for (SBSDKBarcodeScannerResult* result in barcodeResults) {
|
|
142
142
|
if (![filter acceptsBarcode:result]) {
|
|
143
143
|
continue;
|
|
144
144
|
}
|
|
145
145
|
[outResults addObject:result];
|
|
146
146
|
}
|
|
147
|
-
|
|
147
|
+
|
|
148
148
|
return outResults;
|
|
149
149
|
}
|
|
150
150
|
|
|
@@ -221,7 +221,7 @@ static inline SBSDKBarcodeAdditionalParameters* extractAdditionalParameters(NSDi
|
|
|
221
221
|
additionalParameters.msiPlesseyChecksumAlgorithm = extractPlesseyChecksumAlgorithmFromConfiguration(configuration);
|
|
222
222
|
|
|
223
223
|
additionalParameters.codeDensity = extractBarcodeDensity(configuration);
|
|
224
|
-
|
|
224
|
+
|
|
225
225
|
return additionalParameters;
|
|
226
226
|
}
|
|
227
227
|
|
|
@@ -243,4 +243,49 @@ static inline SBSDKUICameraConfiguration* extractCameraConfiguration(NSDictionar
|
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
|
|
246
|
+
/**
|
|
247
|
+
Extracts the selection overlay configuration values from the JSON dictionary.
|
|
248
|
+
*/
|
|
249
|
+
static inline SBSDKUIBarcodeSelectionOverlayConfiguration* extractSelectionOverlayConfig(NSDictionary *dictionary) {
|
|
250
|
+
SBSDKUIBarcodeSelectionOverlayConfiguration *overlayConfig = [[SBSDKUIBarcodeSelectionOverlayConfiguration alloc] init];
|
|
251
|
+
NSDictionary *selectionOverlayDictionary = [dictionary objectForKey:@"overlayConfiguration"];
|
|
252
|
+
if (selectionOverlayDictionary != nil) {
|
|
253
|
+
NSNumber *overlayEnabled = [selectionOverlayDictionary objectForKey:@"overlayEnabled"];
|
|
254
|
+
if (overlayEnabled != nil) {
|
|
255
|
+
overlayConfig.overlayEnabled = overlayEnabled.boolValue;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
NSString *polygonColor = [selectionOverlayDictionary objectForKey:@"polygonColor"];
|
|
259
|
+
if (polygonColor != nil) {
|
|
260
|
+
overlayConfig.polygonColor = [UIColor colorFromHexString:polygonColor];
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
NSString *textColor = [selectionOverlayDictionary objectForKey:@"textColor"];
|
|
264
|
+
if (textColor != nil) {
|
|
265
|
+
overlayConfig.textColor = [UIColor colorFromHexString:textColor];
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
NSString *textContainerColor = [selectionOverlayDictionary objectForKey:@"textContainerColor"];
|
|
269
|
+
if (textContainerColor != nil) {
|
|
270
|
+
overlayConfig.textContainerColor = [UIColor colorFromHexString:textContainerColor];
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
NSString *highlightedPolygonColor = [selectionOverlayDictionary objectForKey:@"highlightedPolygonColor"];
|
|
274
|
+
if (highlightedPolygonColor != nil) {
|
|
275
|
+
overlayConfig.highlightedPolygonColor = [UIColor colorFromHexString:highlightedPolygonColor];
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
NSString *highlightedTextColor = [selectionOverlayDictionary objectForKey:@"highlightedTextColor"];
|
|
279
|
+
if (highlightedTextColor != nil) {
|
|
280
|
+
overlayConfig.highlightedTextColor = [UIColor colorFromHexString:highlightedTextColor];
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
NSString *highlightedTextContainerColor = [selectionOverlayDictionary objectForKey:@"highlightedTextContainerColor"];
|
|
284
|
+
if (highlightedTextContainerColor != nil) {
|
|
285
|
+
overlayConfig.highlightedTextContainerColor = [UIColor colorFromHexString:highlightedTextContainerColor];
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return overlayConfig;
|
|
289
|
+
}
|
|
290
|
+
|
|
246
291
|
#endif /* BarcodeMapping_h */
|
package/ios/Utils/ObjectMapper.h
CHANGED
|
@@ -22,6 +22,5 @@
|
|
|
22
22
|
+ (NSString *) normalizeJsonString:(NSString *)strValue;
|
|
23
23
|
+ (NSURL *) normalizeJsonFileURL:(NSString *)fileUrl;
|
|
24
24
|
+ (NSString *)normalizeJsonFileURLAsString:(NSString *)fileUrl;
|
|
25
|
-
+ (SBSDKUIBarcodeSelectionOverlayConfiguration *)extractSelectionOverlayConfig:(NSDictionary*)dictionary;
|
|
26
25
|
|
|
27
26
|
@end
|
package/ios/Utils/ObjectMapper.m
CHANGED
|
@@ -140,56 +140,4 @@ static NSDictionary<NSString*, NSDictionary<NSString*, NSNumber*>*>* _enumeratio
|
|
|
140
140
|
return url.absoluteString;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
/**
|
|
144
|
-
Extracts the selection overlay configuration values from the JSON dictionary.
|
|
145
|
-
*/
|
|
146
|
-
+ (SBSDKUIBarcodeSelectionOverlayConfiguration *) extractSelectionOverlayConfig:(NSDictionary*) dictionary {
|
|
147
|
-
SBSDKUIBarcodeSelectionOverlayConfiguration* overlayConfig = [[SBSDKUIBarcodeSelectionOverlayConfiguration alloc] init];
|
|
148
|
-
NSDictionary *selectionOverlayDictionary = [dictionary objectForKey: @"selectionOverlay"];
|
|
149
|
-
if (selectionOverlayDictionary != nil) {
|
|
150
|
-
|
|
151
|
-
NSNumber *overlayEnabled = [selectionOverlayDictionary objectForKey:@"overlayEnabled"];
|
|
152
|
-
if (overlayEnabled != nil) {
|
|
153
|
-
overlayConfig.overlayEnabled = overlayEnabled.boolValue;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// TODO: currently not available
|
|
157
|
-
// NSNumber *overlayTextFormat = [selectionOverlayDictionary objectForKey:@"overlayTextFormat"];
|
|
158
|
-
// if (overlayTextFormat != nil) {
|
|
159
|
-
// overlayConfig.overlayEnabled = overlayTextFormat;
|
|
160
|
-
// }
|
|
161
|
-
|
|
162
|
-
NSString *polygonColor = [selectionOverlayDictionary objectForKey:@"polygonColor"];
|
|
163
|
-
if (polygonColor != nil) {
|
|
164
|
-
overlayConfig.polygonColor = [UIColor colorFromHexString: polygonColor];
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
NSString *textColor = [selectionOverlayDictionary objectForKey:@"textColor"];
|
|
168
|
-
if (textColor != nil) {
|
|
169
|
-
overlayConfig.textColor = [UIColor colorFromHexString: textColor];
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
NSString *textContainerColor = [selectionOverlayDictionary objectForKey:@"textContainerColor"];
|
|
173
|
-
if (textContainerColor != nil) {
|
|
174
|
-
overlayConfig.textContainerColor = [UIColor colorFromHexString: textContainerColor];
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
NSString *highlightedPolygonColor = [selectionOverlayDictionary objectForKey:@"highlightedPolygonColor"];
|
|
178
|
-
if (highlightedPolygonColor != nil) {
|
|
179
|
-
overlayConfig.highlightedPolygonColor = [UIColor colorFromHexString: highlightedPolygonColor];
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
NSString *highlightedTextColor = [selectionOverlayDictionary objectForKey:@"highlightedTextColor"];
|
|
183
|
-
if (highlightedTextColor != nil) {
|
|
184
|
-
overlayConfig.highlightedTextColor = [UIColor colorFromHexString: highlightedTextColor];
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
NSString *highlightedTextContainerColor = [selectionOverlayDictionary objectForKey:@"highlightedTextContainerColor"];
|
|
188
|
-
if (highlightedTextContainerColor != nil) {
|
|
189
|
-
overlayConfig.highlightedTextContainerColor = [UIColor colorFromHexString: highlightedTextContainerColor];
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
return overlayConfig;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
143
|
@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.3.0-
|
|
4
|
+
"version": "3.3.0-beta1",
|
|
5
5
|
"description": "Scanbot Barcode Scanner SDK React Native Plugin for Android and iOS",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|