react-native-scanbot-barcode-scanner-sdk 3.1.0-beta8 → 3.2.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.
Files changed (31) hide show
  1. package/Libraries.txt +1 -1
  2. package/RNScanbotBarcodeSDK.podspec +1 -1
  3. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  4. package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
  5. package/android/.settings/org.eclipse.buildship.core.prefs +1 -1
  6. package/android/build.gradle +1 -1
  7. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ObjectMapper.java +5 -0
  8. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkConfiguration.java +1 -1
  9. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkModule.java +40 -55
  10. package/android/src/main/res/drawable/ic_baseline_arrow_back_24.xml +10 -0
  11. package/ios/ScanbotBarcodeSdk.m +10 -0
  12. package/ios/Utils/BarcodeMapping.h +17 -0
  13. package/package.json +1 -1
  14. package/src/configuration.ts +69 -49
  15. package/src/enum.ts +2 -0
  16. package/android/.gradle/6.8/executionHistory/executionHistory.bin +0 -0
  17. package/android/.gradle/6.8/executionHistory/executionHistory.lock +0 -0
  18. package/android/.gradle/6.8/fileChanges/last-build.bin +0 -0
  19. package/android/.gradle/6.8/fileHashes/fileHashes.bin +0 -0
  20. package/android/.gradle/6.8/fileHashes/fileHashes.lock +0 -0
  21. package/android/.gradle/6.8/gc.properties +0 -0
  22. package/android/.gradle/7.0-rc-1/dependencies-accessors/dependencies-accessors.lock +0 -0
  23. package/android/.gradle/7.0-rc-1/dependencies-accessors/gc.properties +0 -0
  24. package/android/.gradle/7.0-rc-1/fileChanges/last-build.bin +0 -0
  25. package/android/.gradle/7.0-rc-1/fileHashes/fileHashes.lock +0 -0
  26. package/android/.gradle/7.0-rc-1/gc.properties +0 -0
  27. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  28. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  29. package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  30. package/android/gradlew +0 -185
  31. package/android/gradlew.bat +0 -89
package/Libraries.txt CHANGED
@@ -2,7 +2,7 @@ Open Source libraries used in the Scanbot Barcode SDK for React Native version 3
2
2
 
3
3
  ------------------------------------------------------------------------------------------------------------------------
4
4
 
5
- Open Source libraries used in the Scanbot Barcode Scanner SDK for iOS version 3.1.0:
5
+ Open Source libraries used in the Scanbot Barcode Scanner SDK for iOS version 3.1.1:
6
6
 
7
7
  BOOST C++ Libraries
8
8
 
@@ -2,7 +2,7 @@ require "json"
2
2
 
3
3
  package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
4
 
5
- ScanbotBarcodeScannerSDKVersion = '3.1.0'
5
+ ScanbotBarcodeScannerSDKVersion = '3.2.1'
6
6
 
7
7
  package = JSON.parse(File.read(File.join(__dir__, "package.json")))
8
8
 
@@ -1,2 +1,2 @@
1
- #Tue Jan 18 13:44:53 CET 2022
2
- gradle.version=6.8
1
+ #Mon Jan 31 14:23:43 CET 2022
2
+ gradle.version=7.1.1
@@ -1,7 +1,7 @@
1
1
  arguments=
2
2
  auto.sync=false
3
3
  build.scans.enabled=false
4
- connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(7.0-rc-1))
4
+ connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(7.1.1))
5
5
  connection.project.dir=
6
6
  eclipse.preferences.version=1
7
7
  gradle.user.home=
@@ -15,7 +15,7 @@ def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3'
15
15
  def DEFAULT_MIN_SDK_VERSION = 21
16
16
  def DEFAULT_TARGET_SDK_VERSION = 29
17
17
 
18
- def sdkVersion = '3.1.0'
18
+ def sdkVersion = '3.2.1'
19
19
 
20
20
  def safeExtGet(prop, fallback) {
21
21
  rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
@@ -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)) {
@@ -69,4 +69,4 @@ public class ScanbotBarcodeSdkConfiguration {
69
69
  public void setEnableNativeLogging(boolean enableNativeLogging) {
70
70
  this.enableNativeLogging = enableNativeLogging;
71
71
  }
72
- }
72
+ }
@@ -10,6 +10,7 @@ import android.content.Intent;
10
10
  import android.graphics.Bitmap;
11
11
  import android.net.Uri;
12
12
  import android.provider.MediaStore;
13
+
13
14
  import com.facebook.react.bridge.ActivityEventListener;
14
15
  import com.facebook.react.bridge.Arguments;
15
16
  import com.facebook.react.bridge.Promise;
@@ -20,8 +21,10 @@ import com.facebook.react.bridge.ReactMethod;
20
21
  import com.facebook.react.bridge.ReadableMap;
21
22
  import com.facebook.react.bridge.WritableArray;
22
23
  import com.facebook.react.bridge.WritableMap;
24
+
23
25
  import org.jetbrains.annotations.Contract;
24
26
  import org.jetbrains.annotations.NotNull;
27
+
25
28
  import java.io.File;
26
29
  import java.io.IOException;
27
30
  import java.util.ArrayList;
@@ -29,6 +32,7 @@ import java.util.HashMap;
29
32
  import java.util.Map;
30
33
  import java.util.concurrent.ExecutorService;
31
34
  import java.util.concurrent.Executors;
35
+
32
36
  import io.scanbot.sap.SdkLicenseInfo;
33
37
  import io.scanbot.sdk.barcode.ScanbotBarcodeDetector;
34
38
  import io.scanbot.sdk.barcode.entity.BarcodeDocumentFormat;
@@ -47,6 +51,7 @@ import io.scanbot.sdk.ui.view.barcode.configuration.BarcodeScannerConfiguration;
47
51
  import io.scanbot.sdk.ui.view.base.configuration.CameraOrientationMode;
48
52
  import kotlin.Unit;
49
53
  import kotlin.jvm.functions.Function1;
54
+
50
55
  import android.app.Activity;
51
56
 
52
57
 
@@ -132,8 +137,7 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
132
137
  } else {
133
138
  ResponseUtils.errorMessageJson(descriptionFromLicenseStatus(licenseInfo.getStatus()), promise);
134
139
  }
135
- }
136
- catch (Exception ex) {
140
+ } catch (Exception ex) {
137
141
  promise.reject(ex);
138
142
  }
139
143
  }
@@ -153,8 +157,7 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
153
157
  result.putString("licenseStatus", licenseInfo.getStatus().name());
154
158
  result.putString("licenseStatusMessage", descriptionFromLicenseStatus(licenseInfo.getStatus()));
155
159
  promise.resolve(result);
156
- }
157
- catch (Exception ex) {
160
+ } catch (Exception ex) {
158
161
  promise.reject(ex);
159
162
  }
160
163
  }
@@ -237,35 +240,13 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
237
240
 
238
241
  safeMap(options, configuration, promise);
239
242
 
240
- CameraOrientationMode orientationMode = JSONUtils.extractCameraOrientationMode(options);
241
- if (orientationMode != null) {
242
- configuration.setOrientationLockMode(orientationMode);
243
- }
244
-
245
- final ArrayList<BarcodeFormat> formats = JSONUtils.extractBarcodeFormats(options);
246
- if (!formats.isEmpty()) {
247
- configuration.setBarcodeFormatsFilter(formats);
248
- }
249
-
250
- final ArrayList<BarcodeDocumentFormat> documentFormats = JSONUtils.extractBarcodeDocumentFormats(options);
251
- if (!documentFormats.isEmpty()) {
252
- configuration.setAcceptedDocumentFormats(documentFormats);
253
- }
254
-
255
- final BarcodeScannerAdditionalConfiguration additionalConfiguration =
256
- JSONUtils.extractBarcodeScannerAdditionalConfiguration(options);
257
- if (additionalConfiguration != null) {
258
- configuration.setAdditionalDetectionParameters(additionalConfiguration);
259
- }
260
-
261
- configuration.setEngineMode(JSONUtils.extractEngineMode(options));
243
+ this.setCustomBarcodeScannerConfiguration(options, configuration);
262
244
 
263
245
  final Intent intent = BarcodeScannerActivity.newIntent(this.getReactApplicationContext(), configuration);
264
246
  activityCallbackPromise = promise;
265
247
  context.addActivityEventListener(this);
266
248
  context.startActivityForResult(intent, REQUEST_SB_BARCODE_SCANNER, null);
267
- }
268
- catch (final Exception e) {
249
+ } catch (final Exception e) {
269
250
  promise.reject("Error starting barcode scanner.", e);
270
251
  }
271
252
  }
@@ -286,31 +267,7 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
286
267
 
287
268
  ObjectMapper.map(configuration, nativeConfig);
288
269
 
289
- // Additional Parameters
290
- final BarcodeScannerAdditionalConfiguration additionalConfiguration =
291
- JSONUtils.extractBarcodeScannerAdditionalConfiguration(configuration);
292
- if(additionalConfiguration != null) {
293
- nativeConfig.setAdditionalDetectionParameters(additionalConfiguration);
294
- }
295
-
296
- CameraOrientationMode orientationMode = JSONUtils.extractCameraOrientationMode(configuration);
297
- if (orientationMode != null) {
298
- nativeConfig.setOrientationLockMode(orientationMode);
299
- }
300
-
301
- // Barcode Format Filters
302
- ArrayList<BarcodeFormat> formats = JSONUtils.extractBarcodeFormats(configuration);
303
- if (!formats.isEmpty()) {
304
- nativeConfig.setBarcodeFormatsFilter(formats);
305
- }
306
-
307
- // Document Format Filters
308
- ArrayList<BarcodeDocumentFormat> documentFormats = JSONUtils.extractBarcodeDocumentFormats(configuration);
309
- if (!documentFormats.isEmpty()) {
310
- nativeConfig.setAcceptedDocumentFormats(documentFormats);
311
- }
312
-
313
- nativeConfig.setEngineMode(JSONUtils.extractEngineMode(configuration));
270
+ this.setCustomBarcodeScannerConfiguration(configuration, nativeConfig);
314
271
 
315
272
  Intent startIntent = BatchBarcodeScannerActivity.newIntent(context, nativeConfig, null);
316
273
 
@@ -322,6 +279,35 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
322
279
  }
323
280
  }
324
281
 
282
+ private void setCustomBarcodeScannerConfiguration(final ReadableMap options, BarcodeScannerConfiguration configuration) {
283
+ CameraOrientationMode orientationMode = JSONUtils.extractCameraOrientationMode(options);
284
+ if (orientationMode != null) {
285
+ configuration.setOrientationLockMode(orientationMode);
286
+ }
287
+
288
+ final ArrayList<BarcodeFormat> formats = JSONUtils.extractBarcodeFormats(options);
289
+ if (!formats.isEmpty()) {
290
+ configuration.setBarcodeFormatsFilter(formats);
291
+ }
292
+
293
+ final ArrayList<BarcodeDocumentFormat> documentFormats = JSONUtils.extractBarcodeDocumentFormats(options);
294
+ if (!documentFormats.isEmpty()) {
295
+ configuration.setAcceptedDocumentFormats(documentFormats);
296
+ }
297
+
298
+ final BarcodeScannerAdditionalConfiguration additionalConfiguration =
299
+ JSONUtils.extractBarcodeScannerAdditionalConfiguration(options);
300
+ if (additionalConfiguration != null) {
301
+ configuration.setAdditionalDetectionParameters(additionalConfiguration);
302
+ }
303
+
304
+ configuration.setEngineMode(JSONUtils.extractEngineMode(options));
305
+
306
+ if (options.hasKey("replaceCancelButtonWithIcon") && options.getBoolean("replaceCancelButtonWithIcon")) {
307
+ configuration.setCancelButtonIcon(R.drawable.ic_baseline_arrow_back_24);
308
+ }
309
+ }
310
+
325
311
  @ReactMethod
326
312
  public void closeBatchBarcodeScanner(final Promise promise) {
327
313
  final ReactContext context = getReactApplicationContext();
@@ -345,8 +331,7 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
345
331
  debugLog("Cleaning plugin storage folder ...");
346
332
  StorageUtils.cleanupPluginStorageDirectory(getReactApplicationContext());
347
333
  ResponseUtils.successMessageJson("Cleanup successfully done.", promise);
348
- }
349
- catch (final Exception e) {
334
+ } catch (final Exception e) {
350
335
  ResponseUtils.errorMessageJson(e.getLocalizedMessage(), promise);
351
336
  }
352
337
  }
@@ -0,0 +1,10 @@
1
+ <vector xmlns:android="http://schemas.android.com/apk/res/android"
2
+ android:width="24dp"
3
+ android:height="24dp"
4
+ android:viewportWidth="24"
5
+ android:viewportHeight="24"
6
+ android:tint="?attr/colorControlNormal">
7
+ <path
8
+ android:fillColor="@android:color/white"
9
+ android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
10
+ </vector>
@@ -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-beta8",
4
+ "version": "3.2.0-beta1",
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,47 +121,57 @@ 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
- * 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.
146
- * 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`.
147
152
  * Android only.
148
153
  */
149
154
  lowPowerMode?: boolean;
155
+ /**
156
+ * If `true`, replaces the cancel button in the top bar with a back arrow icon
157
+ * The default is `false`.
158
+ * Android only.
159
+ */
160
+ replaceCancelButtonWithIcon?: boolean;
150
161
  }
151
162
 
152
163
  export interface BatchBarcodeScannerConfiguration {
153
164
  /**
154
- * An optional array of barcode document formats that act as a detection filter.
165
+ * An optional array of barcode document formats that acts as a detection filter.
155
166
  * By default all supported document formats will be detected.
156
167
  */
157
168
  acceptedDocumentFormats?: BarcodeDocumentFormat[];
158
169
  /**
159
- * Allowed orientations for automatic interface rotations. *
170
+ * Allowed orientations for automatic interface rotations.
160
171
  */
161
172
  allowedInterfaceOrientations?: UIInterfaceOrientationMask;
162
173
  /**
163
- * String used for displaying amount of scanned barcodes. Use %d for number formatting symbol.
174
+ * String used for displaying the numer of scanned barcodes. Use %d for number formatting symbol.
164
175
  */
165
176
  barcodesCountText?: string;
166
177
  /**
@@ -172,7 +183,7 @@ export interface BatchBarcodeScannerConfiguration {
172
183
  */
173
184
  cameraOverlayColor?: string;
174
185
  /**
175
- * Whether the cancel button is hidden or not. (iOS Only)
186
+ * Whether the cancel button is hidden or not. (iOS only).
176
187
  */
177
188
  cancelButtonHidden?: boolean;
178
189
  /**
@@ -205,12 +216,12 @@ export interface BatchBarcodeScannerConfiguration {
205
216
  */
206
217
  detailsPrimaryColor?: string;
207
218
  /**
208
- * String used to show process of fetching mapped data for barcodes.
219
+ * String used to show the process of fetching mapped data for barcodes.
209
220
  */
210
221
  fetchingStateText?: string;
211
222
  /**
212
- * Aspect ratio of finder frame (width \ height), which is used to build actual finder frame.
213
- * Default is 1 - it is a square frame, which is good for QR capturing.
223
+ * Aspect ratio of the finder frame (width \ height), which is used to build the actual finder frame.
224
+ * Default is 1 - which is a square frame (good for QR capturing).
214
225
  */
215
226
  finderAspectRatio?: FinderAspectRatio;
216
227
  /**
@@ -218,11 +229,11 @@ export interface BatchBarcodeScannerConfiguration {
218
229
  */
219
230
  finderLineColor?: string;
220
231
  /**
221
- * Width of finder frame border. Default is 2.
232
+ * Width of the finder frame border. Default is 2.
222
233
  */
223
234
  finderLineWidth?: number;
224
235
  /**
225
- * String being displayed as description.
236
+ * String being displayed as the description label.
226
237
  */
227
238
  finderTextHint?: string;
228
239
  /**
@@ -230,7 +241,7 @@ export interface BatchBarcodeScannerConfiguration {
230
241
  */
231
242
  finderTextHintColor?: string;
232
243
  /**
233
- * Whether flash is toggled on or off.
244
+ * Whether the flash is toggled on or off.
234
245
  */
235
246
  flashEnabled?: boolean;
236
247
  /**
@@ -242,7 +253,7 @@ export interface BatchBarcodeScannerConfiguration {
242
253
  */
243
254
  submitButtonTitle?: string;
244
255
  /**
245
- * Whether scanner screen should make a sound on successful barcode or MRZ detection.
256
+ * Whether a sound should be played on successful barcode detection.
246
257
  */
247
258
  successBeepEnabled?: boolean;
248
259
  /**
@@ -254,11 +265,11 @@ export interface BatchBarcodeScannerConfiguration {
254
265
  */
255
266
  topBarButtonsColor?: string;
256
267
  /**
257
- * Foreground color of the flash button when flash is off.
268
+ * Foreground color of the flash button when the flash is off.
258
269
  */
259
270
  topBarButtonsInactiveColor?: string;
260
271
  /**
261
- * Accepted barcode formats
272
+ * Accepted barcode formats.
262
273
  */
263
274
  barcodeFormats?: BarcodeFormat[];
264
275
  /**
@@ -280,52 +291,61 @@ export interface BatchBarcodeScannerConfiguration {
280
291
  maximumTextLength?: number;
281
292
  /**
282
293
  * Optional minimum required quiet zone on the barcode.
283
- * Measured in modules (the size of minimal bar on the barcode).
294
+ * Measured in modules (the size of narrowest bar in the barcode).
284
295
  * The default is 10.
285
296
  * NOTE: This feature works on ITF and MSI Plessey barcodes only.
286
297
  */
287
298
  minimum1DBarcodesQuietZone?: number;
288
299
  /**
289
300
  * The engine mode of the barcode recognizer. Defaults to NEXT_GEN.
290
- * To use legacy recognizer, please specify LEGACY
301
+ * To use the legacy recognizer, please specify LEGACY.
291
302
  */
292
303
  engineMode?: EngineMode;
293
304
 
294
305
  /**
295
306
  * When set to `true`, the scanner assumes that the barcode can be a GS1 barcode.
296
- * Turn it off, if you don't want to see decoded FNC1 characters ("]C1" and ASCII char 29).
307
+ * Turn it off if you don't want to see decoded FNC1 characters ("]C1" and ASCII char 29).
297
308
  * The default value is `true`.
298
309
  * NOTE: Currently works for CODE128 barcodes only!
299
310
  */
300
311
  gs1DecodingEnabled?: boolean;
301
312
 
302
313
  /**
303
- * The checksum algorithms for MSI Plessey barcodes.
314
+ * The checksum algorithm for MSI Plessey barcodes.
304
315
  * The default value is [MSIPlesseyChecksumAlgorithm.Mod10].
305
316
  */
306
317
  msiPlesseyChecksumAlgorithm?: MSIPlesseyChecksumAlgorithm;
307
-
308
318
  /**
309
- * With this option enabled, the scanner removes checks digits for UPC, EAN and MSI Plessey codes.
319
+ * With this option enabled, the scanner removes check digits for UPC, EAN and MSI Plessey codes.
310
320
  * Has no effect if both single and double digit MSI Plessey checksums are enabled.
311
- * The default is `false`
321
+ * The default is `false`.
312
322
  */
313
323
  stripCheckDigits?: boolean;
314
324
  /**
315
- * 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.
316
- * The default is `false`
325
+ * The preferred camera module (default: BACK).
326
+ */
327
+ cameraModule?: CameraModule;
328
+ /**
329
+ * If `true`, enables the mode which slightly decreases the scanning quality and the energy consumption, thus increasing the scanning speed.
330
+ * The default is `false`.
317
331
  * Android only.
318
332
  */
319
333
  lowPowerMode?: boolean;
334
+ /**
335
+ * If `true`, replaces the cancel button in the top bar with a back arrow icon
336
+ * The default is `false`.
337
+ * Android only.
338
+ */
339
+ replaceCancelButtonWithIcon?: boolean;
320
340
  }
321
341
 
322
342
  interface InternalBarcodeDetectionCommonParameters {
323
343
  /**
324
- * Accepted barcode formats
344
+ * Accepted barcode formats.
325
345
  */
326
346
  barcodeFormats?: BarcodeFormat[];
327
347
  /**
328
- * An optional array of barcode document formats that act as a detection filter.
348
+ * An optional array of barcode document formats that acts as a detection filter.
329
349
  * By default all supported document formats will be detected.
330
350
  */
331
351
  acceptedDocumentFormats?: BarcodeDocumentFormat[];
@@ -343,15 +363,15 @@ interface InternalBarcodeDetectionCommonParameters {
343
363
  maximumTextLength?: number;
344
364
  /**
345
365
  * Optional minimum required quiet zone on the barcode.
346
- * Measured in modules (the size of minimal bar on the barcode).
366
+ * Measured in modules (the size of narrowest bar in the barcode).
347
367
  * The default is 10.
348
368
  * NOTE: This feature works on ITF and MSI Plessey barcodes only.
349
369
  */
350
370
  minimum1DBarcodesQuietZone?: number;
351
371
  /**
352
- * With this option enabled, the scanner removes checks digits for UPC, EAN and MSI Plessey codes.
372
+ * With this option enabled, the scanner removes check digits for UPC, EAN and MSI Plessey codes.
353
373
  * Has no effect if both single and double digit MSI Plessey checksums are enabled.
354
- * The default is `false`
374
+ * The default is `false`.
355
375
  */
356
376
  stripCheckDigits?: boolean;
357
377
  }
@@ -359,7 +379,7 @@ interface InternalBarcodeDetectionCommonParameters {
359
379
  export interface DetectBarcodesOnImageArguments
360
380
  extends InternalBarcodeDetectionCommonParameters {
361
381
  /**
362
- * The input image file URI
382
+ * The input image file URI.
363
383
  */
364
384
  imageFileUri: string;
365
385
  }
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';
File without changes
File without changes
@@ -1,5 +0,0 @@
1
- distributionBase=GRADLE_USER_HOME
2
- distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
4
- zipStoreBase=GRADLE_USER_HOME
5
- zipStorePath=wrapper/dists
package/android/gradlew DELETED
@@ -1,185 +0,0 @@
1
- #!/usr/bin/env sh
2
-
3
- #
4
- # Copyright 2015 the original author or authors.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # https://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- ##############################################################################
20
- ##
21
- ## Gradle start up script for UN*X
22
- ##
23
- ##############################################################################
24
-
25
- # Attempt to set APP_HOME
26
- # Resolve links: $0 may be a link
27
- PRG="$0"
28
- # Need this for relative symlinks.
29
- while [ -h "$PRG" ] ; do
30
- ls=`ls -ld "$PRG"`
31
- link=`expr "$ls" : '.*-> \(.*\)$'`
32
- if expr "$link" : '/.*' > /dev/null; then
33
- PRG="$link"
34
- else
35
- PRG=`dirname "$PRG"`"/$link"
36
- fi
37
- done
38
- SAVED="`pwd`"
39
- cd "`dirname \"$PRG\"`/" >/dev/null
40
- APP_HOME="`pwd -P`"
41
- cd "$SAVED" >/dev/null
42
-
43
- APP_NAME="Gradle"
44
- APP_BASE_NAME=`basename "$0"`
45
-
46
- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47
- DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48
-
49
- # Use the maximum available, or set MAX_FD != -1 to use that value.
50
- MAX_FD="maximum"
51
-
52
- warn () {
53
- echo "$*"
54
- }
55
-
56
- die () {
57
- echo
58
- echo "$*"
59
- echo
60
- exit 1
61
- }
62
-
63
- # OS specific support (must be 'true' or 'false').
64
- cygwin=false
65
- msys=false
66
- darwin=false
67
- nonstop=false
68
- case "`uname`" in
69
- CYGWIN* )
70
- cygwin=true
71
- ;;
72
- Darwin* )
73
- darwin=true
74
- ;;
75
- MINGW* )
76
- msys=true
77
- ;;
78
- NONSTOP* )
79
- nonstop=true
80
- ;;
81
- esac
82
-
83
- CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84
-
85
-
86
- # Determine the Java command to use to start the JVM.
87
- if [ -n "$JAVA_HOME" ] ; then
88
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89
- # IBM's JDK on AIX uses strange locations for the executables
90
- JAVACMD="$JAVA_HOME/jre/sh/java"
91
- else
92
- JAVACMD="$JAVA_HOME/bin/java"
93
- fi
94
- if [ ! -x "$JAVACMD" ] ; then
95
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96
-
97
- Please set the JAVA_HOME variable in your environment to match the
98
- location of your Java installation."
99
- fi
100
- else
101
- JAVACMD="java"
102
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103
-
104
- Please set the JAVA_HOME variable in your environment to match the
105
- location of your Java installation."
106
- fi
107
-
108
- # Increase the maximum file descriptors if we can.
109
- if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110
- MAX_FD_LIMIT=`ulimit -H -n`
111
- if [ $? -eq 0 ] ; then
112
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113
- MAX_FD="$MAX_FD_LIMIT"
114
- fi
115
- ulimit -n $MAX_FD
116
- if [ $? -ne 0 ] ; then
117
- warn "Could not set maximum file descriptor limit: $MAX_FD"
118
- fi
119
- else
120
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121
- fi
122
- fi
123
-
124
- # For Darwin, add options to specify how the application appears in the dock
125
- if $darwin; then
126
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127
- fi
128
-
129
- # For Cygwin or MSYS, switch paths to Windows format before running java
130
- if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133
-
134
- JAVACMD=`cygpath --unix "$JAVACMD"`
135
-
136
- # We build the pattern for arguments to be converted via cygpath
137
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138
- SEP=""
139
- for dir in $ROOTDIRSRAW ; do
140
- ROOTDIRS="$ROOTDIRS$SEP$dir"
141
- SEP="|"
142
- done
143
- OURCYGPATTERN="(^($ROOTDIRS))"
144
- # Add a user-defined pattern to the cygpath arguments
145
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147
- fi
148
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
149
- i=0
150
- for arg in "$@" ; do
151
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153
-
154
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156
- else
157
- eval `echo args$i`="\"$arg\""
158
- fi
159
- i=`expr $i + 1`
160
- done
161
- case $i in
162
- 0) set -- ;;
163
- 1) set -- "$args0" ;;
164
- 2) set -- "$args0" "$args1" ;;
165
- 3) set -- "$args0" "$args1" "$args2" ;;
166
- 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167
- 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168
- 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169
- 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170
- 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171
- 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172
- esac
173
- fi
174
-
175
- # Escape application args
176
- save () {
177
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178
- echo " "
179
- }
180
- APP_ARGS=`save "$@"`
181
-
182
- # Collect all arguments for the java command, following the shell quoting and substitution rules
183
- eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184
-
185
- exec "$JAVACMD" "$@"
@@ -1,89 +0,0 @@
1
- @rem
2
- @rem Copyright 2015 the original author or authors.
3
- @rem
4
- @rem Licensed under the Apache License, Version 2.0 (the "License");
5
- @rem you may not use this file except in compliance with the License.
6
- @rem You may obtain a copy of the License at
7
- @rem
8
- @rem https://www.apache.org/licenses/LICENSE-2.0
9
- @rem
10
- @rem Unless required by applicable law or agreed to in writing, software
11
- @rem distributed under the License is distributed on an "AS IS" BASIS,
12
- @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- @rem See the License for the specific language governing permissions and
14
- @rem limitations under the License.
15
- @rem
16
-
17
- @if "%DEBUG%" == "" @echo off
18
- @rem ##########################################################################
19
- @rem
20
- @rem Gradle startup script for Windows
21
- @rem
22
- @rem ##########################################################################
23
-
24
- @rem Set local scope for the variables with windows NT shell
25
- if "%OS%"=="Windows_NT" setlocal
26
-
27
- set DIRNAME=%~dp0
28
- if "%DIRNAME%" == "" set DIRNAME=.
29
- set APP_BASE_NAME=%~n0
30
- set APP_HOME=%DIRNAME%
31
-
32
- @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33
- for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34
-
35
- @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36
- set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37
-
38
- @rem Find java.exe
39
- if defined JAVA_HOME goto findJavaFromJavaHome
40
-
41
- set JAVA_EXE=java.exe
42
- %JAVA_EXE% -version >NUL 2>&1
43
- if "%ERRORLEVEL%" == "0" goto execute
44
-
45
- echo.
46
- echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47
- echo.
48
- echo Please set the JAVA_HOME variable in your environment to match the
49
- echo location of your Java installation.
50
-
51
- goto fail
52
-
53
- :findJavaFromJavaHome
54
- set JAVA_HOME=%JAVA_HOME:"=%
55
- set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56
-
57
- if exist "%JAVA_EXE%" goto execute
58
-
59
- echo.
60
- echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61
- echo.
62
- echo Please set the JAVA_HOME variable in your environment to match the
63
- echo location of your Java installation.
64
-
65
- goto fail
66
-
67
- :execute
68
- @rem Setup the command line
69
-
70
- set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71
-
72
-
73
- @rem Execute Gradle
74
- "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75
-
76
- :end
77
- @rem End local scope for the variables with windows NT shell
78
- if "%ERRORLEVEL%"=="0" goto mainEnd
79
-
80
- :fail
81
- rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82
- rem the _cmd.exe /c_ return code!
83
- if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84
- exit /b 1
85
-
86
- :mainEnd
87
- if "%OS%"=="Windows_NT" endlocal
88
-
89
- :omega