react-native-scanbot-barcode-scanner-sdk 3.1.0 → 3.2.0-beta3

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 (29) hide show
  1. package/RNScanbotBarcodeSDK.podspec +1 -1
  2. package/android/.gradle/{7.0-rc-1 → 6.2}/fileChanges/last-build.bin +0 -0
  3. package/android/.gradle/6.2/fileHashes/fileHashes.lock +0 -0
  4. package/android/.gradle/{7.0-rc-1/dependencies-accessors → 6.2}/gc.properties +0 -0
  5. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  6. package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
  7. package/android/.gradle/checksums/checksums.lock +0 -0
  8. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  9. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  10. package/android/build.gradle +1 -1
  11. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkModule.java +40 -55
  12. package/android/src/main/res/drawable/ic_baseline_arrow_back_24.xml +10 -0
  13. package/ios/.DS_Store +0 -0
  14. package/ios/ScanbotBarcodeSdk.xcodeproj/xcuserdata/mayankpatil.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  15. package/ios/ScanbotBarcodeSdk.xcworkspace/xcuserdata/mayankpatil.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  16. package/ios/Utils/BarcodeMapping.h +2 -1
  17. package/package.json +1 -1
  18. package/src/configuration.ts +12 -0
  19. package/src/enum.ts +3 -2
  20. package/android/.gradle/7.0-rc-1/dependencies-accessors/dependencies-accessors.lock +0 -0
  21. package/android/.gradle/7.0-rc-1/fileHashes/fileHashes.lock +0 -0
  22. package/android/.gradle/7.0-rc-1/gc.properties +0 -0
  23. package/android/.gradle/7.1.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  24. package/android/.gradle/7.1.1/dependencies-accessors/gc.properties +0 -0
  25. package/android/.gradle/7.1.1/fileChanges/last-build.bin +0 -0
  26. package/android/.gradle/7.1.1/fileHashes/fileHashes.lock +0 -0
  27. package/android/.gradle/7.1.1/gc.properties +0 -0
  28. package/android/.gradle/configuration-cache/gc.properties +0 -0
  29. package/android/local.properties +0 -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.1'
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
- #Mon Jan 31 14:23:43 CET 2022
2
- gradle.version=7.1.1
1
+ #Mon May 23 15:11:17 CEST 2022
2
+ gradle.version=6.2
@@ -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
@@ -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>
package/ios/.DS_Store ADDED
Binary file
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>SchemeUserState</key>
6
+ <dict>
7
+ <key>ScanbotBarcodeSdk.xcscheme_^#shared#^_</key>
8
+ <dict>
9
+ <key>orderHint</key>
10
+ <integer>0</integer>
11
+ </dict>
12
+ </dict>
13
+ </dict>
14
+ </plist>
@@ -32,11 +32,12 @@ static inline SBSDKBarcodeDocumentType* barcodeDocumentTypeFromString(NSString*
32
32
  if ([string isEqualToString:@"AAMVA"]) return SBSDKBarcodeDocumentTypeAAMVA;
33
33
  if ([string isEqualToString:@"ID_CARD_PDF_417"]) return SBSDKBarcodeDocumentTypeIDCardPDF417;
34
34
  if ([string isEqualToString:@"SEPA"]) return SBSDKBarcodeDocumentTypeSEPA;
35
- if ([string isEqualToString:@"DISABILITY_CERTIFICATE"]) return SBSDKBarcodeDocumentTypeDisabilityCertificate;
35
+ if ([string isEqualToString:@"MEDICAL_CERTIFICATE"]) return SBSDKBarcodeDocumentTypeMedicalCertificate;
36
36
  if ([string isEqualToString:@"BOARDING_PASS"]) return SBSDKBarcodeDocumentTypeBoardingPass;
37
37
  if ([string isEqualToString:@"DE_MEDICAL_PLAN"]) return SBSDKBarcodeDocumentTypeMedicalPlan;
38
38
  if ([string isEqualToString:@"VCARD"]) return SBSDKBarcodeDocumentTypeVCard;
39
39
  if ([string isEqualToString:@"SWISS_QR"]) return SBSDKBarcodeDocumentTypeSwissQR;
40
+ if ([string isEqualToString:@"GS1"]) return SBSDKBarcodeDocumentTypeGS1;
40
41
  return nil;
41
42
  }
42
43
 
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",
4
+ "version": "3.2.0-beta3",
5
5
  "description": "React Native plugin for the Scanbot Barcode Scanner SDK on Android and iOS",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -152,6 +152,12 @@ export interface BarcodeScannerConfiguration {
152
152
  * Android only.
153
153
  */
154
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;
155
161
  }
156
162
 
157
163
  export interface BatchBarcodeScannerConfiguration {
@@ -325,6 +331,12 @@ export interface BatchBarcodeScannerConfiguration {
325
331
  * Android only.
326
332
  */
327
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;
328
340
  }
329
341
 
330
342
  interface InternalBarcodeDetectionCommonParameters {
package/src/enum.ts CHANGED
@@ -38,11 +38,12 @@ export type BarcodeDocumentFormat =
38
38
  "AAMVA" |
39
39
  "BOARDING_PASS" |
40
40
  "DE_MEDICAL_PLAN" |
41
- "DISABILITY_CERTIFICATE" |
41
+ "MEDICAL_CERTIFICATE" |
42
42
  "ID_CARD_PDF_417" |
43
43
  "SEPA" |
44
44
  "SWISS_QR" |
45
- "VCARD";
45
+ "VCARD" |
46
+ "GS1" ;
46
47
 
47
48
  export type BarcodeFormat =
48
49
  "AZTEC" |
File without changes
File without changes
File without changes
@@ -1,8 +0,0 @@
1
- ## This file must *NOT* be checked into Version Control Systems,
2
- # as it contains information specific to your local configuration.
3
- #
4
- # Location of the SDK. This is only used by Gradle.
5
- # For customization when using a Version Control System, please read the
6
- # header note.
7
- #Tue Jan 18 13:44:25 CET 2022
8
- sdk.dir=/Users/rutkaybiyik/Library/Android/sdk