react-native-scanbot-barcode-scanner-sdk 3.1.0-beta9 → 3.1.0

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.
@@ -63,6 +63,11 @@ public final class ObjectMapper {
63
63
  continue;
64
64
  }
65
65
 
66
+ // The default FRONT camera module should be FRONT_MIRRORED on Android
67
+ if ("cameraModule".equals(prop) && "FRONT".equals(value)) {
68
+ value = "FRONT_MIRRORED";
69
+ }
70
+
66
71
  final String setterName = "set" + prop.substring(0, 1).toUpperCase() + prop.substring(1);
67
72
 
68
73
  if (methodMap.containsKey(setterName)) {
@@ -149,6 +149,11 @@ RCT_EXPORT_METHOD(startBarcodeScanner:(NSDictionary*)configuration
149
149
 
150
150
  SBSDKUIBarcodeScannerConfiguration* config = [[SBSDKUIBarcodeScannerConfiguration alloc] initWithUIConfiguration:uiConfig textConfiguration:textConfig behaviorConfiguration:behaviorConfig];
151
151
 
152
+ SBSDKUICameraConfiguration* cameraConfiguration = extractCameraConfiguration(configuration);
153
+ if (cameraConfiguration) {
154
+ config.cameraConfiguration.camera = cameraConfiguration.camera;
155
+ }
156
+
152
157
  bool shouldWaitForGeneratedImage = behaviorConfig.barcodeImageGenerationType != SBSDKBarcodeImageGenerationTypeNone;
153
158
  BarcodeScannerPromiseProxy* delegate = [[BarcodeScannerPromiseProxy alloc] initWithResolver: resolve
154
159
  shouldWaitForGeneratedImage: shouldWaitForGeneratedImage];
@@ -211,6 +216,11 @@ RCT_EXPORT_METHOD(startBatchBarcodeScanner:(NSDictionary*)configuration
211
216
  NSArray* machineCodeTypes = extractBarcodeTypesFromConfiguration(configuration);
212
217
  NSArray* acceptedDocumentTypes = extractBarcodeDocumentTypesFromConfiguration(configuration);
213
218
 
219
+ SBSDKUICameraConfiguration* cameraConfiguration = extractCameraConfiguration(configuration);
220
+ if (cameraConfiguration) {
221
+ config.cameraConfiguration.camera = cameraConfiguration.camera;
222
+ }
223
+
214
224
  BatchBarcodeScannerPromiseProxy* delegate = [[BatchBarcodeScannerPromiseProxy alloc] initWithResolver:resolve];
215
225
 
216
226
  SBSDKUIBarcodesBatchScannerViewController* viewController = NULL;
@@ -138,4 +138,21 @@ static inline SBSDKBarcodeMSIPlesseyChecksumAlgorithm extractPlesseyChecksumAlgo
138
138
  return SBSDKBarcodeMSIPlesseyChecksumAlgorithmMod10;
139
139
  }
140
140
 
141
+ static inline SBSDKUICameraConfiguration* extractCameraConfiguration(NSDictionary* configuration) {
142
+ SBSDKUICameraConfiguration* cameraConfiguration = [[SBSDKUICameraConfiguration alloc] init];
143
+
144
+ NSString* cameraModule = [configuration objectForKey:@"cameraModule"];
145
+ if(!cameraModule) {
146
+ return nil;
147
+ }
148
+
149
+ if ([cameraModule isEqualToString:@"FRONT"]) {
150
+ cameraConfiguration.camera = SBSDKCameraDevice.defaultFrontFacingCamera;
151
+ } else if ([cameraModule isEqualToString:@"BACK"]) {
152
+ cameraConfiguration.camera = SBSDKCameraDevice.defaultBackFacingCamera;
153
+ }
154
+
155
+ return cameraConfiguration;
156
+ }
157
+
141
158
  #endif /* BarcodeMapping_h */
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.1.0-beta9",
4
+ "version": "3.1.0",
5
5
  "description": "React Native plugin for the Scanbot Barcode Scanner SDK on Android and iOS",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -9,18 +9,19 @@ import {
9
9
  BarcodeFormat,
10
10
  BarcodeImageGenerationType,
11
11
  UIInterfaceOrientationMask,
12
- EngineMode
12
+ EngineMode,
13
+ CameraModule
13
14
  } from "./enum";
14
15
  import { MSIPlesseyChecksumAlgorithm } from "./enum";
15
16
 
16
17
  export interface BarcodeScannerConfiguration {
17
18
  /**
18
- * An optional array of barcode document formats that act as a detection filter.
19
+ * An optional array of barcode document formats that acts as a detection filter.
19
20
  * By default all supported document formats will be detected.
20
21
  */
21
22
  acceptedDocumentFormats?: BarcodeDocumentFormat[];
22
23
  /**
23
- * Allowed orientations for automatic interface rotations. *
24
+ * Allowed orientations for automatic interface rotations.
24
25
  */
25
26
  allowedInterfaceOrientations?: UIInterfaceOrientationMask;
26
27
  /**
@@ -40,11 +41,11 @@ export interface BarcodeScannerConfiguration {
40
41
  */
41
42
  finderLineColor?: string;
42
43
  /**
43
- * Width of finder frame border. Default is 2.
44
+ * Width of the finder frame border. Default is 2.
44
45
  */
45
46
  finderLineWidth?: number;
46
47
  /**
47
- * String being displayed as description.
48
+ * String being displayed as the description label.
48
49
  */
49
50
  finderTextHint?: string;
50
51
  /**
@@ -52,8 +53,8 @@ export interface BarcodeScannerConfiguration {
52
53
  */
53
54
  finderTextHintColor?: string;
54
55
  /**
55
- * Aspect ratio of finder frame (width \ height), which is used to build actual finder frame.
56
- * Default is 1 - it is a square frame, which is good for QR capturing.
56
+ * Aspect ratio of the finder frame (width \ height), which is used to build the actual finder frame.
57
+ * Default is 1 - which is a square frame (good for QR capturing).
57
58
  */
58
59
  finderAspectRatio?: FinderAspectRatio;
59
60
  /**
@@ -61,11 +62,11 @@ export interface BarcodeScannerConfiguration {
61
62
  */
62
63
  flashButtonTitle?: string;
63
64
  /**
64
- * Foreground color of the flash button when flash is off.
65
+ * Foreground color of the flash button when the flash is off.
65
66
  */
66
67
  flashButtonInactiveColor?: string;
67
68
  /**
68
- * Whether flash is toggled on or off.
69
+ * Whether the flash is toggled on or off.
69
70
  */
70
71
  flashEnabled?: boolean;
71
72
  /**
@@ -82,13 +83,13 @@ export interface BarcodeScannerConfiguration {
82
83
  maximumTextLength?: number,
83
84
  /**
84
85
  * Optional minimum required quiet zone on the barcode.
85
- * Measured in modules (the size of minimal bar on the barcode).
86
+ * Measured in modules (the size of narrowest bar in the barcode).
86
87
  * The default is 10.
87
88
  * NOTE: This feature works on ITF and MSI Plessey barcodes only.
88
89
  */
89
90
  minimum1DBarcodesQuietZone?: number
90
91
  /**
91
- * Whether scanner screen should make a sound on successful barcode or MRZ detection.
92
+ * Whether a sound should be played on successful barcode detection.
92
93
  */
93
94
  successBeepEnabled?: boolean;
94
95
  /**
@@ -100,12 +101,12 @@ export interface BarcodeScannerConfiguration {
100
101
  */
101
102
  topBarButtonsColor?: string;
102
103
  /**
103
- * Accepted barcode formats
104
+ * Accepted barcode formats.
104
105
  */
105
106
  barcodeFormats?: BarcodeFormat[];
106
107
  /**
107
- * Specifies the way of barcode images generation or disables this generation at all.
108
- * Use, if you want to receive a full sized image with barcodes. Defaults to NONE.
108
+ * Specifies the way a barcode image is generated or disables this generation altogether.
109
+ * Use if you want to receive a full sized image with barcodes. Defaults to NONE.
109
110
  */
110
111
  barcodeImageGenerationType?: BarcodeImageGenerationType;
111
112
  /**
@@ -120,31 +121,34 @@ export interface BarcodeScannerConfiguration {
120
121
  cameraZoomFactor?: number;
121
122
  /**
122
123
  * The engine mode of the barcode recognizer. Defaults to NEXT_GEN.
123
- * To use legacy recognizer, please specify LEGACY
124
+ * To use the legacy recognizer, please specify LEGACY.
124
125
  */
125
126
  engineMode?: EngineMode;
126
127
  /**
127
128
  * When set to `true`, the scanner assumes that the barcode can be a GS1 barcode.
128
- * Turn it off, if you don't want to see decoded FNC1 characters ("]C1" and ASCII char 29).
129
+ * Turn it off if you don't want to see decoded FNC1 characters ("]C1" and ASCII char 29).
129
130
  * The default value is `true`.
130
131
  * NOTE: Currently works for CODE128 barcodes only!
131
132
  */
132
133
  gs1DecodingEnabled?: boolean;
133
134
  /**
134
- * The checksum algorithms for MSI Plessey barcodes.
135
+ * The checksum algorithm for MSI Plessey barcodes.
135
136
  * The default value is [MSIPlesseyChecksumAlgorithm.Mod10].
136
137
  */
137
138
  msiPlesseyChecksumAlgorithm?: MSIPlesseyChecksumAlgorithm;
138
139
  /**
139
- * With this option enabled, the scanner removes checks digits for UPC, EAN and MSI Plessey codes.
140
+ * With this option enabled, the scanner removes check digits for UPC, EAN and MSI Plessey codes.
140
141
  * Has no effect if both single and double digit MSI Plessey checksums are enabled.
141
- * The default is `false`
142
+ * The default is `false`.
142
143
  */
143
144
  stripCheckDigits?: boolean;
144
-
145
145
  /**
146
- * If `true`, enabled the mode which slightly decreases the scanning quality and the energy consumption, and increases the scanning speed. If `false` - mode is disabled.
147
- * The default is `false`
146
+ * The preferred camera module (default: BACK).
147
+ */
148
+ cameraModule?: CameraModule;
149
+ /**
150
+ * If `true`, enables the mode which slightly decreases the scanning quality and the energy consumption, thus increasing the scanning speed.
151
+ * The default is `false`.
148
152
  * Android only.
149
153
  */
150
154
  lowPowerMode?: boolean;
@@ -152,16 +156,16 @@ export interface BarcodeScannerConfiguration {
152
156
 
153
157
  export interface BatchBarcodeScannerConfiguration {
154
158
  /**
155
- * An optional array of barcode document formats that act as a detection filter.
159
+ * An optional array of barcode document formats that acts as a detection filter.
156
160
  * By default all supported document formats will be detected.
157
161
  */
158
162
  acceptedDocumentFormats?: BarcodeDocumentFormat[];
159
163
  /**
160
- * Allowed orientations for automatic interface rotations. *
164
+ * Allowed orientations for automatic interface rotations.
161
165
  */
162
166
  allowedInterfaceOrientations?: UIInterfaceOrientationMask;
163
167
  /**
164
- * String used for displaying amount of scanned barcodes. Use %d for number formatting symbol.
168
+ * String used for displaying the numer of scanned barcodes. Use %d for number formatting symbol.
165
169
  */
166
170
  barcodesCountText?: string;
167
171
  /**
@@ -173,7 +177,7 @@ export interface BatchBarcodeScannerConfiguration {
173
177
  */
174
178
  cameraOverlayColor?: string;
175
179
  /**
176
- * Whether the cancel button is hidden or not. (iOS Only)
180
+ * Whether the cancel button is hidden or not. (iOS only).
177
181
  */
178
182
  cancelButtonHidden?: boolean;
179
183
  /**
@@ -206,12 +210,12 @@ export interface BatchBarcodeScannerConfiguration {
206
210
  */
207
211
  detailsPrimaryColor?: string;
208
212
  /**
209
- * String used to show process of fetching mapped data for barcodes.
213
+ * String used to show the process of fetching mapped data for barcodes.
210
214
  */
211
215
  fetchingStateText?: string;
212
216
  /**
213
- * Aspect ratio of finder frame (width \ height), which is used to build actual finder frame.
214
- * Default is 1 - it is a square frame, which is good for QR capturing.
217
+ * Aspect ratio of the finder frame (width \ height), which is used to build the actual finder frame.
218
+ * Default is 1 - which is a square frame (good for QR capturing).
215
219
  */
216
220
  finderAspectRatio?: FinderAspectRatio;
217
221
  /**
@@ -219,11 +223,11 @@ export interface BatchBarcodeScannerConfiguration {
219
223
  */
220
224
  finderLineColor?: string;
221
225
  /**
222
- * Width of finder frame border. Default is 2.
226
+ * Width of the finder frame border. Default is 2.
223
227
  */
224
228
  finderLineWidth?: number;
225
229
  /**
226
- * String being displayed as description.
230
+ * String being displayed as the description label.
227
231
  */
228
232
  finderTextHint?: string;
229
233
  /**
@@ -231,7 +235,7 @@ export interface BatchBarcodeScannerConfiguration {
231
235
  */
232
236
  finderTextHintColor?: string;
233
237
  /**
234
- * Whether flash is toggled on or off.
238
+ * Whether the flash is toggled on or off.
235
239
  */
236
240
  flashEnabled?: boolean;
237
241
  /**
@@ -243,7 +247,7 @@ export interface BatchBarcodeScannerConfiguration {
243
247
  */
244
248
  submitButtonTitle?: string;
245
249
  /**
246
- * Whether scanner screen should make a sound on successful barcode or MRZ detection.
250
+ * Whether a sound should be played on successful barcode detection.
247
251
  */
248
252
  successBeepEnabled?: boolean;
249
253
  /**
@@ -255,11 +259,11 @@ export interface BatchBarcodeScannerConfiguration {
255
259
  */
256
260
  topBarButtonsColor?: string;
257
261
  /**
258
- * Foreground color of the flash button when flash is off.
262
+ * Foreground color of the flash button when the flash is off.
259
263
  */
260
264
  topBarButtonsInactiveColor?: string;
261
265
  /**
262
- * Accepted barcode formats
266
+ * Accepted barcode formats.
263
267
  */
264
268
  barcodeFormats?: BarcodeFormat[];
265
269
  /**
@@ -281,42 +285,43 @@ export interface BatchBarcodeScannerConfiguration {
281
285
  maximumTextLength?: number;
282
286
  /**
283
287
  * Optional minimum required quiet zone on the barcode.
284
- * Measured in modules (the size of minimal bar on the barcode).
288
+ * Measured in modules (the size of narrowest bar in the barcode).
285
289
  * The default is 10.
286
290
  * NOTE: This feature works on ITF and MSI Plessey barcodes only.
287
291
  */
288
292
  minimum1DBarcodesQuietZone?: number;
289
-
290
293
  /**
291
294
  * The engine mode of the barcode recognizer. Defaults to NEXT_GEN.
292
- * To use legacy recognizer, please specify LEGACY
295
+ * To use the legacy recognizer, please specify LEGACY.
293
296
  */
294
297
  engineMode?: EngineMode;
295
298
 
296
299
  /**
297
300
  * When set to `true`, the scanner assumes that the barcode can be a GS1 barcode.
298
- * Turn it off, if you don't want to see decoded FNC1 characters ("]C1" and ASCII char 29).
301
+ * Turn it off if you don't want to see decoded FNC1 characters ("]C1" and ASCII char 29).
299
302
  * The default value is `true`.
300
303
  * NOTE: Currently works for CODE128 barcodes only!
301
304
  */
302
305
  gs1DecodingEnabled?: boolean;
303
306
 
304
307
  /**
305
- * The checksum algorithms for MSI Plessey barcodes.
308
+ * The checksum algorithm for MSI Plessey barcodes.
306
309
  * The default value is [MSIPlesseyChecksumAlgorithm.Mod10].
307
310
  */
308
311
  msiPlesseyChecksumAlgorithm?: MSIPlesseyChecksumAlgorithm;
309
-
310
312
  /**
311
- * With this option enabled, the scanner removes checks digits for UPC, EAN and MSI Plessey codes.
313
+ * With this option enabled, the scanner removes check digits for UPC, EAN and MSI Plessey codes.
312
314
  * Has no effect if both single and double digit MSI Plessey checksums are enabled.
313
- * The default is `false`
315
+ * The default is `false`.
314
316
  */
315
317
  stripCheckDigits?: boolean;
316
-
317
318
  /**
318
- * If `true`, enabled the mode which slightly decreases the scanning quality and the energy consumption, and increases the scanning speed. If `false` - mode is disabled.
319
- * The default is `false`
319
+ * The preferred camera module (default: BACK).
320
+ */
321
+ cameraModule?: CameraModule;
322
+ /**
323
+ * If `true`, enables the mode which slightly decreases the scanning quality and the energy consumption, thus increasing the scanning speed.
324
+ * The default is `false`.
320
325
  * Android only.
321
326
  */
322
327
  lowPowerMode?: boolean;
@@ -324,11 +329,11 @@ export interface BatchBarcodeScannerConfiguration {
324
329
 
325
330
  interface InternalBarcodeDetectionCommonParameters {
326
331
  /**
327
- * Accepted barcode formats
332
+ * Accepted barcode formats.
328
333
  */
329
334
  barcodeFormats?: BarcodeFormat[];
330
335
  /**
331
- * An optional array of barcode document formats that act as a detection filter.
336
+ * An optional array of barcode document formats that acts as a detection filter.
332
337
  * By default all supported document formats will be detected.
333
338
  */
334
339
  acceptedDocumentFormats?: BarcodeDocumentFormat[];
@@ -346,15 +351,15 @@ interface InternalBarcodeDetectionCommonParameters {
346
351
  maximumTextLength?: number;
347
352
  /**
348
353
  * Optional minimum required quiet zone on the barcode.
349
- * Measured in modules (the size of minimal bar on the barcode).
354
+ * Measured in modules (the size of narrowest bar in the barcode).
350
355
  * The default is 10.
351
356
  * NOTE: This feature works on ITF and MSI Plessey barcodes only.
352
357
  */
353
358
  minimum1DBarcodesQuietZone?: number;
354
359
  /**
355
- * With this option enabled, the scanner removes checks digits for UPC, EAN and MSI Plessey codes.
360
+ * With this option enabled, the scanner removes check digits for UPC, EAN and MSI Plessey codes.
356
361
  * Has no effect if both single and double digit MSI Plessey checksums are enabled.
357
- * The default is `false`
362
+ * The default is `false`.
358
363
  */
359
364
  stripCheckDigits?: boolean;
360
365
  }
@@ -362,7 +367,7 @@ interface InternalBarcodeDetectionCommonParameters {
362
367
  export interface DetectBarcodesOnImageArguments
363
368
  extends InternalBarcodeDetectionCommonParameters {
364
369
  /**
365
- * The input image file URI
370
+ * The input image file URI.
366
371
  */
367
372
  imageFileUri: string;
368
373
  }
package/src/enum.ts CHANGED
@@ -74,3 +74,5 @@ export type MSIPlesseyChecksumAlgorithm =
74
74
  "Mod1110IBM" |
75
75
  "Mod1110NCR"
76
76
  ;
77
+
78
+ export type CameraModule = 'FRONT' | 'BACK';