react-native-scanbot-barcode-scanner-sdk 3.7.0 → 3.7.1-beta.2

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 (170) hide show
  1. package/RNScanbotBarcodeSDK.podspec +12 -9
  2. package/android/build.gradle +31 -27
  3. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  4. package/android/src/main/AndroidManifest.xml +1 -2
  5. package/android/src/main/java/com/reactlibrary/ScanbotBarcodeSdkModule.java +5 -12
  6. package/android/src/main/java/com/reactlibrary/ScanbotBarcodeSdkPackage.java +2 -2
  7. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ObjectMapper.java +24 -17
  8. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkConfiguration.java +5 -2
  9. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkModule.java +92 -84
  10. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkPackage.java +1 -2
  11. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/StorageUtils.java +5 -69
  12. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/barcode/ScanbotBarcodeDetectorAdditionalConfigBuilder.java +1 -1
  13. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/barcode/ScanbotBarcodeDetectorConfigBuilder.java +1 -1
  14. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraView.java +9 -15
  15. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewConfiguration.java +6 -5
  16. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/base/communication/ScanbotEventEmitter.java +5 -3
  17. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/base/communication/ScanbotEventReceiver.java +15 -4
  18. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/utils/JSONUtils.java +29 -40
  19. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/utils/LogUtils.java +4 -1
  20. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/utils/ResponseUtils.java +2 -10
  21. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/utils/ScanbotViewUtils.java +0 -17
  22. package/android/src/new-architecture/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewManager.java +127 -0
  23. package/android/src/{main/java → old-architecture}/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewManager.java +1 -1
  24. package/index.js +1 -1
  25. package/ios/Categories/SBSDKPolygon+JSON.h +1 -1
  26. package/ios/Categories/SBSDKPolygon+JSON.m +1 -1
  27. package/ios/Categories/UIColor+JSON.h +1 -1
  28. package/ios/Categories/UIColor+JSON.m +1 -1
  29. package/ios/Components/BarcodeCameraView/NewArchitecture/RTNScanbotBarcodeCameraView.h +45 -0
  30. package/ios/Components/BarcodeCameraView/NewArchitecture/RTNScanbotBarcodeCameraView.mm +364 -0
  31. package/ios/Components/BarcodeCameraView/NewArchitecture/RTNScanbotBarcodeCameraViewManager.mm +71 -0
  32. package/ios/Components/BarcodeCameraView/{RNScanbotBarcodeCameraView.h → OldArchitecture/RNScanbotBarcodeCameraView.h} +9 -4
  33. package/ios/Components/BarcodeCameraView/{RNScanbotBarcodeCameraView.m → OldArchitecture/RNScanbotBarcodeCameraView.mm} +24 -34
  34. package/ios/Components/BarcodeCameraView/{RNScanbotBarcodeCameraViewManager.h → OldArchitecture/RNScanbotBarcodeCameraViewManager.h} +7 -1
  35. package/ios/Components/BarcodeCameraView/{RNScanbotBarcodeCameraViewManager.m → OldArchitecture/RNScanbotBarcodeCameraViewManager.mm} +25 -6
  36. package/ios/ScanbotBarcodeSDKConfiguration.h +1 -1
  37. package/ios/ScanbotBarcodeSDKConfiguration.m +1 -1
  38. package/ios/ScanbotBarcodeSdk.h +2 -2
  39. package/ios/ScanbotBarcodeSdk.m +24 -23
  40. package/ios/SharedConfiguration.h +1 -1
  41. package/ios/SharedConfiguration.m +1 -1
  42. package/ios/Utils/BarcodeMapping.h +40 -33
  43. package/ios/Utils/HashUtils.h +1 -1
  44. package/ios/Utils/JSONMappings.h +1 -1
  45. package/ios/Utils/LoggingUtils.h +1 -1
  46. package/ios/Utils/ObjectMapper.h +1 -1
  47. package/ios/Utils/ObjectMapper.m +1 -1
  48. package/ios/Utils/ReactBarcodeExtensionsFilter.h +1 -1
  49. package/ios/Utils/ScanbotStorageUtils.h +1 -1
  50. package/ios/Utils/ScanbotStorageUtils.m +1 -1
  51. package/js/RTNScanbotBarcodeCameraViewNativeComponent.tsx +209 -0
  52. package/package.json +22 -2
  53. package/src/components/barcode-camera-view/scanbot-barcode-camera-view-types.tsx +8 -1
  54. package/src/components/barcode-camera-view/scanbot-barcode-camera-view.tsx +46 -12
  55. package/src/components/barcode-camera-view/scanbot-native-barcode-camera-view.tsx +7 -5
  56. package/src/configuration.ts +4 -1
  57. package/src/enum.ts +1 -1
  58. package/android/.gradle/6.1.1/executionHistory/executionHistory.bin +0 -0
  59. package/android/.gradle/6.1.1/executionHistory/executionHistory.lock +0 -0
  60. package/android/.gradle/6.1.1/fileChanges/last-build.bin +0 -0
  61. package/android/.gradle/6.1.1/fileHashes/fileHashes.bin +0 -0
  62. package/android/.gradle/6.1.1/fileHashes/fileHashes.lock +0 -0
  63. package/android/.gradle/6.1.1/gc.properties +0 -0
  64. package/android/.gradle/6.2/executionHistory/executionHistory.lock +0 -0
  65. package/android/.gradle/6.2/fileChanges/last-build.bin +0 -0
  66. package/android/.gradle/6.2/fileHashes/fileHashes.lock +0 -0
  67. package/android/.gradle/6.2/gc.properties +0 -0
  68. package/android/.gradle/6.8/executionHistory/executionHistory.lock +0 -0
  69. package/android/.gradle/6.8/fileChanges/last-build.bin +0 -0
  70. package/android/.gradle/6.8/fileHashes/fileHashes.lock +0 -0
  71. package/android/.gradle/6.8/gc.properties +0 -0
  72. package/android/.gradle/7.0-rc-1/dependencies-accessors/dependencies-accessors.lock +0 -0
  73. package/android/.gradle/7.0-rc-1/dependencies-accessors/gc.properties +0 -0
  74. package/android/.gradle/7.0-rc-1/fileChanges/last-build.bin +0 -0
  75. package/android/.gradle/7.0-rc-1/fileHashes/fileHashes.lock +0 -0
  76. package/android/.gradle/7.0-rc-1/gc.properties +0 -0
  77. package/android/.gradle/7.1.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  78. package/android/.gradle/7.1.1/dependencies-accessors/gc.properties +0 -0
  79. package/android/.gradle/7.1.1/executionHistory/executionHistory.lock +0 -0
  80. package/android/.gradle/7.1.1/fileChanges/last-build.bin +0 -0
  81. package/android/.gradle/7.1.1/fileHashes/fileHashes.lock +0 -0
  82. package/android/.gradle/7.1.1/gc.properties +0 -0
  83. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  84. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  85. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  86. package/android/.gradle/checksums/checksums.lock +0 -0
  87. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  88. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  89. package/android/.gradle/configuration-cache/gc.properties +0 -0
  90. package/android/.gradle/vcs-1/gc.properties +0 -0
  91. package/android/build/.transforms/8cdb68f56773f65afa4976aa86d988f7/classes/classes.dex +0 -0
  92. package/android/build/.transforms/8cdb68f56773f65afa4976aa86d988f7.bin +0 -1
  93. package/android/build/.transforms/991094845a707011dcf91007d9838bb7/classes/classes.dex +0 -0
  94. package/android/build/.transforms/991094845a707011dcf91007d9838bb7.bin +0 -1
  95. package/android/build/generated/source/buildConfig/debug/io/scanbot/barcodesdk/plugin/reactnative/BuildConfig.java +0 -18
  96. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -11
  97. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output.json +0 -1
  98. package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
  99. package/android/build/intermediates/compile_library_classes/debug/classes.jar +0 -0
  100. package/android/build/intermediates/compile_only_not_namespaced_r_class_jar/debug/R.jar +0 -0
  101. package/android/build/intermediates/incremental/debug-mergeNativeLibs/merge-state +0 -0
  102. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
  103. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
  104. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +0 -2
  105. package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +0 -4
  106. package/android/build/intermediates/incremental/packageDebugResources/merger.xml +0 -2
  107. package/android/build/intermediates/javac/debug/classes/com/reactlibrary/ScanbotBarcodeSdkModule.class +0 -0
  108. package/android/build/intermediates/javac/debug/classes/com/reactlibrary/ScanbotBarcodeSdkPackage.class +0 -0
  109. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/BitmapHelper.class +0 -0
  110. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/BuildConfig.class +0 -0
  111. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/JSONUtils$WritableMapBuilder.class +0 -0
  112. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/JSONUtils.class +0 -0
  113. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/LogUtils.class +0 -0
  114. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ObjectMapper.class +0 -0
  115. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ReactBarcodeExtensionsFilter$1.class +0 -0
  116. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ReactBarcodeExtensionsFilter$Type.class +0 -0
  117. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ReactBarcodeExtensionsFilter.class +0 -0
  118. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ResponseUtils.class +0 -0
  119. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkConfiguration.class +0 -0
  120. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkModule$1.class +0 -0
  121. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkModule$2.class +0 -0
  122. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkModule$3.class +0 -0
  123. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkModule.class +0 -0
  124. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkPackage.class +0 -0
  125. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/StorageUtils.class +0 -0
  126. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/barcode/ScanbotBarcodeDetectorAdditionalConfigBuilder.class +0 -0
  127. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/barcode/ScanbotBarcodeDetectorConfigBuilder.class +0 -0
  128. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/EventEmitter$NativeEvent.class +0 -0
  129. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/EventEmitter.class +0 -0
  130. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewConfiguration.class +0 -0
  131. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewFragment$1.class +0 -0
  132. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewFragment$2.class +0 -0
  133. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewFragment.class +0 -0
  134. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewManager$1$1$1.class +0 -0
  135. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewManager$1$1.class +0 -0
  136. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewManager$1.class +0 -0
  137. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewManager.class +0 -0
  138. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/common/ScanbotComponentFrameLayout$1.class +0 -0
  139. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/common/ScanbotComponentFrameLayout$ILayoutChangeListener.class +0 -0
  140. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/common/ScanbotComponentFrameLayout.class +0 -0
  141. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/common/ScanbotComponentRootView$1.class +0 -0
  142. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/common/ScanbotComponentRootView$2.class +0 -0
  143. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/common/ScanbotComponentRootView$ILayoutChangeListener.class +0 -0
  144. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/common/ScanbotComponentRootView$IOnChildRemovedListener.class +0 -0
  145. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/common/ScanbotComponentRootView.class +0 -0
  146. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/filters/ReactBarcodeExtensionsFilter$1.class +0 -0
  147. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/filters/ReactBarcodeExtensionsFilter$Type.class +0 -0
  148. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/filters/ReactBarcodeExtensionsFilter.class +0 -0
  149. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/utils/BitmapHelper.class +0 -0
  150. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/utils/JSONUtils$WritableMapBuilder.class +0 -0
  151. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/utils/JSONUtils.class +0 -0
  152. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/utils/LogUtils.class +0 -0
  153. package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/utils/ResponseUtils.class +0 -0
  154. package/android/build/intermediates/library_java_res/debug/res.jar +0 -0
  155. package/android/build/intermediates/library_manifest/debug/AndroidManifest.xml +0 -11
  156. package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLibraryResources/R-def.txt +0 -9
  157. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -13
  158. package/android/build/intermediates/merged_manifests/debug/output.json +0 -1
  159. package/android/build/intermediates/packaged_res/debug/drawable/ic_baseline_arrow_back_24.xml +0 -10
  160. package/android/build/intermediates/packaged_res/debug/layout/component_barcode_camera_view.xml +0 -11
  161. package/android/build/intermediates/packaged_res/debug/layout/fragment_barcode_scanner.xml +0 -23
  162. package/android/build/intermediates/res/symbol-table-with-package/debug/package-aware-r.txt +0 -3560
  163. package/android/build/intermediates/runtime_library_classes/debug/classes.jar +0 -0
  164. package/android/build/intermediates/symbols/debug/R.txt +0 -5107
  165. package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -37
  166. package/android/local.properties +0 -8
  167. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ReactBarcodeExtensionsFilter.java +0 -61
  168. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/utils/BitmapHelper.java +0 -30
  169. package/ios/ScanbotBarcodeSdk.xcodeproj/xcuserdata/mayankpatil.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  170. package/ios/ScanbotBarcodeSdk.xcworkspace/xcuserdata/mayankpatil.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
@@ -1,21 +1,25 @@
1
1
  //
2
- // RNScanbotCameraView.h
2
+ // RNScanbotBarcodeCameraView.h
3
3
  // RNScanbotSDK
4
4
  //
5
5
  // Created by Marco Saia on 18.05.21.
6
6
  //
7
7
 
8
+ // We use this compilation pragma to expose this implementation for the OLD ARCHITECTURE only
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+ #else
11
+
8
12
  #ifndef RNScanbotCameraView_h
9
13
  #define RNScanbotCameraView_h
10
14
 
11
15
  #import <React/RCTComponent.h>
12
- @import ScanbotBarcodeScannerSDK;
16
+ #import <ScanbotBarcodeScannerSDK/ScanbotBarcodeScannerSDK.h>
13
17
 
14
18
  @interface RNScanbotBarcodeCameraView: UIView<SBSDKBarcodeScannerViewControllerDelegate>
15
19
 
16
20
  @property SBSDKBarcodeScannerViewController* _Nullable cameraViewController;
17
21
  @property NSMutableArray* _Nonnull barcodes;
18
- @property (nonatomic, copy) RCTBubblingEventBlock _Nullable onBarcodeScannerResult;
22
+ @property (nonatomic, copy) RCTBubblingEventBlock _Nullable onNativeBarcodeScannerResult;
19
23
  @property (nonatomic, copy) RCTBubblingEventBlock _Nullable requestComponentReload;
20
24
  @property (nonatomic) BOOL shouldUseFinderView;
21
25
  @property (nonatomic, copy) NSDictionary* _Nullable configuration;
@@ -55,7 +59,8 @@
55
59
  @property (nonatomic) SBSDKUIBarcodeFilter* _Nullable barcodeFilter;
56
60
  @property (nonatomic) SBSDKBarcodeDensity codeDensity;
57
61
  @property (nonatomic) UIEdgeInsets finderInset;
58
- @property (nonatomic) SBSDKZoomRange* _Nullable zoomRange;
59
62
  @end
60
63
 
61
64
  #endif /* RNScanbotCameraView_h */
65
+
66
+ #endif // ifdef RCT_NEW_ARCH_ENABLED
@@ -5,12 +5,15 @@
5
5
  // Created by Marco Saia on 18.05.21.
6
6
  //
7
7
 
8
+ // We use this compilation pragma to expose this implementation for the OLD ARCHITECTURE only
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+ #else
11
+
8
12
  #import "RNScanbotBarcodeCameraView.h"
9
13
  #import "ObjectMapper.h"
10
14
  #import "BarcodeMapping.h"
11
-
12
- @import ScanbotBarcodeScannerSDK;
13
- @import Foundation;
15
+ #import <ScanbotBarcodeScannerSDK/ScanbotBarcodeScannerSDK.h>
16
+ #import <Foundation/Foundation.h>
14
17
 
15
18
  @implementation RNScanbotBarcodeCameraView {
16
19
  SBSDKBarcodeScannerViewController* viewController;
@@ -33,7 +36,7 @@
33
36
  return;
34
37
  }
35
38
 
36
- __weak typeof(self) weakSelf = self;
39
+ __weak RNScanbotBarcodeCameraView* weakSelf = self;
37
40
 
38
41
  dispatch_async(dispatch_get_main_queue(), ^{
39
42
  [weakSelf createCameraViewController];
@@ -45,21 +48,15 @@
45
48
  if (!parentViewController) {
46
49
  return;
47
50
  }
48
- BOOL isInit = false;
51
+
49
52
  if (!_cameraViewController) {
50
53
  viewController = [[SBSDKBarcodeScannerViewController alloc] initWithParentViewController:parentViewController
51
54
  parentView:self
52
55
  delegate:self];
53
56
  _cameraViewController = viewController;
54
- isInit = true;
55
- }
56
-
57
- // Temporary workaround for flashEnabled property.
58
- if (isInit && _cameraViewConfiguration.flashEnabled) {
59
- [self applyConfigurationWithDelay:0.5];
60
- } else {
61
- [self applyConfiguration];
62
57
  }
58
+
59
+ [self updateWithConfiguration];
63
60
  }
64
61
 
65
62
  - (void)setConfiguration:(NSDictionary *)configuration {
@@ -76,7 +73,7 @@
76
73
  }
77
74
 
78
75
  if ([config objectForKey:@"barcodeFilter"]) {
79
- cameraViewConfiguration.barcodeFilter = extractBarcodeFilter(config);
76
+ cameraViewConfiguration.barcodeFilter = extractBarcodeFilterFromConfiguration(config);
80
77
  [config removeObjectForKey:@"barcodeFilter"];
81
78
  }
82
79
 
@@ -88,11 +85,11 @@
88
85
  }
89
86
 
90
87
  // We also need to manually extract the MSI-Plessey Checksum Algorithm since it can't be mapped automatically
91
- cameraViewConfiguration.msiPlesseyChecksumAlgorithm = extractPlesseyChecksumAlgorithmFromConfiguration(configuration);
92
- cameraViewConfiguration.codeDensity = extractBarcodeDensity(config);
88
+ cameraViewConfiguration.msiPlesseyChecksumAlgorithm = extractMsiPlesseyChecksumAlgorithmFromConfiguration(configuration);
89
+ cameraViewConfiguration.codeDensity = extractBarcodeDensityFromConfiguration(config);
93
90
  cameraViewConfiguration.finderInset = [self populateFinderInset:config];
91
+
94
92
  self.shouldUseFinderView = [[config objectForKey:@"shouldUseFinderView"] boolValue];
95
- cameraViewConfiguration.zoomRange = extractCameraZoomRange(config);
96
93
 
97
94
  } @catch (NSException *exception) {
98
95
  NSLog(@"%@", [exception reason]);
@@ -102,11 +99,11 @@
102
99
  _cameraViewConfiguration = cameraViewConfiguration;
103
100
 
104
101
  if(viewController) {
105
- [self applyConfiguration];
102
+ [self updateWithConfiguration];
106
103
  }
107
104
  }
108
105
 
109
- - (void)applyConfiguration {
106
+ - (void)updateWithConfiguration {
110
107
 
111
108
  SBSDKBaseScannerViewFinderConfiguration *configuration = [[SBSDKBaseScannerViewFinderConfiguration alloc] init];
112
109
  configuration.lineWidth = _cameraViewConfiguration.finderLineWidth;
@@ -166,18 +163,8 @@
166
163
  if (_cameraViewConfiguration.flashEnabled) {
167
164
  viewController.flashLightEnabled = [_cameraViewConfiguration.flashEnabled boolValue];
168
165
  }
169
-
170
- if (viewController.zoomConfiguration != nil) {
171
- viewController.zoomConfiguration.zoomRange = _cameraViewConfiguration.zoomRange;
172
- }
173
166
  }
174
167
 
175
- - (void)applyConfigurationWithDelay:(NSTimeInterval)delayInSeconds {
176
- dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
177
- dispatch_after(delayTime, dispatch_get_main_queue(), ^(void){
178
- [self applyConfiguration];
179
- });
180
- }
181
168
 
182
169
  - (UIEdgeInsets)populateFinderInset: (NSMutableDictionary*)config {
183
170
  UIEdgeInsets finderInset = UIEdgeInsetsZero;
@@ -209,7 +196,7 @@
209
196
  }
210
197
 
211
198
  - (void)sendScanResults:(NSArray<SBSDKBarcodeScannerResult*>*) results onImage:(UIImage*)image {
212
- if(!self.onBarcodeScannerResult) {
199
+ if(!self.onNativeBarcodeScannerResult) {
213
200
  return;
214
201
  }
215
202
 
@@ -228,7 +215,7 @@
228
215
  }
229
216
  };
230
217
 
231
- self.onBarcodeScannerResult(outResult);
218
+ self.onNativeBarcodeScannerResult(outResult);
232
219
  }
233
220
 
234
221
  // MARK: - React Native Lifecycle
@@ -278,7 +265,7 @@
278
265
  {
279
266
  self = [super init];
280
267
  if (self) {
281
- self.shouldUseFinderView = false;
268
+ self.shouldUseFinderView = [NSNumber numberWithBool:false];
282
269
  self.finderLineWidth = 1.0;
283
270
  self.finderLineColor = UIColor.whiteColor;
284
271
  self.finderAspectRatio = [[SBSDKAspectRatio alloc] initWithWidth:1 andHeight:1];
@@ -288,9 +275,9 @@
288
275
  self.gs1DecodingEnabled = nil;
289
276
  self.maximumTextLength = nil;
290
277
  self.minimumTextLength = nil;
291
- self.msiPlesseyChecksumAlgorithm = -1;
278
+ self.msiPlesseyChecksumAlgorithm = SBSDKBarcodeMSIPlesseyChecksumAlgorithmNone;
292
279
  self.cameraZoomFactor = nil;
293
- self.engineMode = -1;
280
+ self.engineMode = SBSDKBarcodeEngineModeNextGen;
294
281
  self.flashEnabled = nil;
295
282
  self.finderInset = UIEdgeInsetsMake(32, 32, 32, 32);
296
283
  }
@@ -298,3 +285,6 @@
298
285
  }
299
286
 
300
287
  @end
288
+
289
+ #endif // ifdef RCT_NEW_ARCH_ENABLED
290
+
@@ -1,10 +1,14 @@
1
1
  //
2
- // RNScanbotClassicComponents.h
2
+ // RNScanbotBarcodeCameraViewManager.h
3
3
  // Pods
4
4
  //
5
5
  // Created by Marco Saia on 17.05.21.
6
6
  //
7
7
 
8
+ // We use this compilation pragma to expose this implementation for the OLD ARCHITECTURE only
9
+ #if defined(RCT_NEW_ARCH_ENABLED) && RCT_NEW_ARCH_ENABLED==1
10
+ #else
11
+
8
12
  #ifndef RNScanbotClassicComponents_h
9
13
  #define RNScanbotClassicComponents_h
10
14
 
@@ -20,3 +24,5 @@ typedef void (^NativeViewBlock)(RNScanbotBarcodeCameraView* _Nonnull);
20
24
  @end
21
25
 
22
26
  #endif /* RNScanbotClassicComponents_h */
27
+
28
+ #endif // ifdef RCT_NEW_ARCH_ENABLED
@@ -1,24 +1,32 @@
1
1
  //
2
- // RNScanbotClassicComponents.m
2
+ // RNScanbotBarcodeCameraViewManager.m
3
3
  // RNScanbotSDK
4
4
  //
5
5
  // Created by Marco Saia on 17.05.21.
6
6
  //
7
7
 
8
+ // We use this compilation pragma to expose this implementation for the OLD ARCHITECTURE only
9
+ #if defined(RCT_NEW_ARCH_ENABLED) && RCT_NEW_ARCH_ENABLED==1
10
+ #else
11
+
8
12
  #import <Foundation/Foundation.h>
9
13
  #import "RNScanbotBarcodeCameraViewManager.h"
10
14
  #import "RNScanbotBarcodeCameraView.h"
11
15
  #import <React/RCTViewManager.h>
12
16
  #import <React/RCTUIManager.h>
13
17
 
14
- @import UIKit;
15
- @import ScanbotBarcodeScannerSDK;
18
+ #import <React/RCTDefines.h>
19
+ #import <React/RCTJSThread.h>
20
+ #import <React/RCTBundleManager.h>
16
21
 
17
- @implementation RNScanbotBarcodeCameraViewManager
22
+ #import <UIKit/UIKit.h>
23
+ #import <ScanbotBarcodeScannerSDK/ScanbotBarcodeScannerSDK.h>
18
24
 
19
- RCT_EXPORT_MODULE(ScanbotBarcodeCameraView)
25
+ RCT_EXTERN void RCTRegisterModule(Class);
20
26
 
21
- RCT_EXPORT_VIEW_PROPERTY(onBarcodeScannerResult, RCTBubblingEventBlock)
27
+ @implementation RNScanbotBarcodeCameraViewManager
28
+
29
+ RCT_EXPORT_VIEW_PROPERTY(onNativeBarcodeScannerResult, RCTBubblingEventBlock)
22
30
  RCT_EXPORT_VIEW_PROPERTY(requestComponentReload, RCTBubblingEventBlock)
23
31
  RCT_EXPORT_VIEW_PROPERTY(shouldUseFinderView, BOOL)
24
32
  RCT_EXPORT_VIEW_PROPERTY(configuration, NSDictionary*)
@@ -28,6 +36,15 @@ RCT_EXPORT_VIEW_PROPERTY(configuration, NSDictionary*)
28
36
  return [[RNScanbotBarcodeCameraView alloc] init];
29
37
  }
30
38
 
39
+ + (NSString *)moduleName {
40
+ return @"RTNScanbotBarcodeCameraView";
41
+ }
42
+
43
+ + (void)load {
44
+ RCTRegisterModule(self);
45
+ }
46
+
47
+
31
48
  // componentDidMount
32
49
  RCT_EXPORT_METHOD(componentDidMount:(nonnull NSNumber*) reactTag) {
33
50
  [self callNativeMethodWithReactTag: reactTag andBlock: ^void (RNScanbotBarcodeCameraView* nativeView) {
@@ -69,3 +86,5 @@ RCT_EXPORT_METHOD(orientationChanged:(nonnull NSNumber*) reactTag) {
69
86
  }
70
87
 
71
88
  @end
89
+
90
+ #endif // ifdef RCT_NEW_ARCH_ENABLED
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // Scanbot Barcode Scanner SDK React Native Plugin
3
3
  //
4
- // Copyright (c) 2020 doo GmbH. All rights reserved.
4
+ // Copyright (c) 2023 Scanbot SDK GmbH. All rights reserved.
5
5
  // https://scanbot.io/sdk
6
6
  //
7
7
  #import <Foundation/Foundation.h>
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // Scanbot Barcode Scanner SDK React Native Plugin
3
3
  //
4
- // Copyright (c) 2020 doo GmbH. All rights reserved.
4
+ // Copyright (c) 2023 Scanbot SDK GmbH. All rights reserved.
5
5
  // https://scanbot.io/sdk
6
6
  //
7
7
  #import "ScanbotBarcodeSDKConfiguration.h"
@@ -1,11 +1,11 @@
1
1
  //
2
2
  // Scanbot Barcode Scanner SDK React Native Plugin
3
3
  //
4
- // Copyright (c) 2020 doo GmbH. All rights reserved.
4
+ // Copyright (c) 2023 Scanbot SDK GmbH. All rights reserved.
5
5
  // https://scanbot.io/sdk
6
6
  //
7
7
  #import <React/RCTBridgeModule.h>
8
- @import ScanbotBarcodeScannerSDK;
8
+ #import <ScanbotBarcodeScannerSDK/ScanbotBarcodeScannerSDK.h>
9
9
 
10
10
  @interface ScanbotBarcodeSdk : NSObject <RCTBridgeModule>
11
11
 
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // Scanbot Barcode Scanner SDK React Native Plugin
3
3
  //
4
- // Copyright (c) 2020 doo GmbH. All rights reserved.
4
+ // Copyright (c) 2023 Scanbot SDK GmbH. All rights reserved.
5
5
  // https://scanbot.io/sdk
6
6
  //
7
7
  #import "ScanbotBarcodeSdk.h"
@@ -66,16 +66,16 @@ RCT_EXPORT_METHOD(initializeSdk:(NSDictionary *)configuration
66
66
  config.licenseKey = [ObjectMapper normalizeJsonString:config.licenseKey];
67
67
  config.storageBaseDirectory = [ObjectMapper normalizeJsonFileURLAsString:config.storageBaseDirectory];
68
68
  [SharedConfiguration defaultConfiguration].loggingEnabled = config.loggingEnabled;
69
- [ScanbotSDK setLoggingEnabled:config.loggingEnabled];
69
+ [Scanbot setLoggingEnabled:config.loggingEnabled];
70
70
 
71
71
  BOOL hasLicense = NO;
72
72
 
73
73
  NSString *callbackMessage = @"Scanbot SDK initialized. Trial mode activated. You can now test all features for 60 seconds.";
74
74
  NSString *errorMessage = nil;
75
75
  if (config.licenseKey) {
76
- hasLicense = [ScanbotSDK setLicense: config.licenseKey];
76
+ hasLicense = [Scanbot setLicense: config.licenseKey];
77
77
  if (!hasLicense) {
78
- errorMessage = [ScanbotBarcodeSdk descriptionFromLicenseStatus:ScanbotSDK.licenseStatus];
78
+ errorMessage = [ScanbotBarcodeSdk descriptionFromLicenseStatus:Scanbot.licenseStatus];
79
79
  } else {
80
80
  callbackMessage = @"Scanbot SDK initialized.";
81
81
  }
@@ -89,7 +89,7 @@ RCT_EXPORT_METHOD(initializeSdk:(NSDictionary *)configuration
89
89
  [SBSDKUIBarcodeImageStorage setDefaultStorage:barcodeImageStorageLocation];
90
90
  }
91
91
 
92
- [ScanbotSDK setSharedApplication:[UIApplication sharedApplication]];
92
+ [Scanbot setSharedApplication:[UIApplication sharedApplication]];
93
93
  [SharedConfiguration defaultConfiguration].configuration = config;
94
94
 
95
95
  [SharedConfiguration defaultConfiguration].isSDKInitialized = YES;
@@ -109,9 +109,9 @@ RCT_EXPORT_METHOD(getLicenseInfo:(RCTPromiseResolveBlock)resolve
109
109
  }
110
110
 
111
111
  resolve(@{
112
- @"isLicenseValid": @(ScanbotSDK.isLicenseValid),
113
- @"licenseStatus": [ScanbotBarcodeSdk stringFromLicenseStatus:ScanbotSDK.licenseStatus],
114
- @"licenseStatusMessage": [ScanbotBarcodeSdk descriptionFromLicenseStatus:ScanbotSDK.licenseStatus]
112
+ @"isLicenseValid": @(Scanbot.isLicenseValid),
113
+ @"licenseStatus": [ScanbotBarcodeSdk stringFromLicenseStatus:Scanbot.licenseStatus],
114
+ @"licenseStatusMessage": [ScanbotBarcodeSdk descriptionFromLicenseStatus:Scanbot.licenseStatus]
115
115
  });
116
116
  }
117
117
 
@@ -123,7 +123,7 @@ RCT_EXPORT_METHOD(startBarcodeScanner:(NSDictionary*)configuration
123
123
  SBSDKUIBarcodeScannerBehaviorConfiguration* behaviorConfig = [[SBSDKUIBarcodeScannerBehaviorConfiguration alloc] init];
124
124
  SBSDKUIBarcodeScannerTextConfiguration* textConfig = [[SBSDKUIBarcodeScannerTextConfiguration alloc] init];
125
125
  SBSDKUICameraConfiguration* cameraConfig = [[SBSDKUICameraConfiguration alloc] init];
126
- SBSDKUIBarcodeSelectionOverlayConfiguration* selectionOverlayConfig = nil;
126
+ SBSDKUIBarcodeTrackingOverlayConfiguration* selectionOverlayConfig = nil;
127
127
  @try {
128
128
  [ObjectMapper populateInstance:uiConfig fromDictionary:configuration];
129
129
  [ObjectMapper populateInstance:behaviorConfig fromDictionary:configuration];
@@ -136,7 +136,7 @@ RCT_EXPORT_METHOD(startBarcodeScanner:(NSDictionary*)configuration
136
136
  }
137
137
 
138
138
  // Barcode Filter (at the moment used for UPC Extension filters)
139
- SBSDKUIBarcodeFilter* barcodeFilter = extractBarcodeFilter(configuration);
139
+ SBSDKUIBarcodeFilter* barcodeFilter = extractBarcodeFilterFromConfiguration(configuration);
140
140
  if (barcodeFilter != nil) {
141
141
  behaviorConfig.barcodeFilter = barcodeFilter;
142
142
  }
@@ -144,7 +144,7 @@ RCT_EXPORT_METHOD(startBarcodeScanner:(NSDictionary*)configuration
144
144
  behaviorConfig.additionalParameters = extractAdditionalParameters(configuration);
145
145
  behaviorConfig.acceptedDocumentTypes = extractBarcodeDocumentTypesFromConfiguration(configuration);
146
146
  behaviorConfig.acceptedBarcodeTypes = extractBarcodeTypesFromConfiguration(configuration);
147
- behaviorConfig.engineMode = extractEngineMode(configuration);
147
+ behaviorConfig.engineMode = extractEngineModeFromConfiguration(configuration);
148
148
 
149
149
  SBSDKZoomRange* cameraZoomRange = extractCameraZoomRange(configuration);
150
150
  if (cameraZoomRange) {
@@ -153,11 +153,12 @@ RCT_EXPORT_METHOD(startBarcodeScanner:(NSDictionary*)configuration
153
153
 
154
154
  uiConfig.orientationLockMode = [ObjectMapper extractOrientationLockMode:configuration];
155
155
 
156
- SBSDKUIBarcodeScannerConfiguration* barcodeScannerConfiguration = [[SBSDKUIBarcodeScannerConfiguration alloc] initWithUIConfiguration:uiConfig
157
- textConfiguration:textConfig
158
- behaviorConfiguration:behaviorConfig
159
- cameraConfiguration:cameraConfig
160
- selectionOverlayConfiguration: selectionOverlayConfig];
156
+ SBSDKUIBarcodeScannerConfiguration* barcodeScannerConfiguration =
157
+ [[SBSDKUIBarcodeScannerConfiguration alloc] initWithUIConfiguration:uiConfig
158
+ textConfiguration:textConfig
159
+ behaviorConfiguration:behaviorConfig
160
+ cameraConfiguration:cameraConfig
161
+ trackingOverlayConfiguration:selectionOverlayConfig];
161
162
 
162
163
  SBSDKUICameraConfiguration* cameraConfiguration = extractCameraConfiguration(configuration);
163
164
  if (cameraConfiguration) {
@@ -166,7 +167,7 @@ RCT_EXPORT_METHOD(startBarcodeScanner:(NSDictionary*)configuration
166
167
 
167
168
  bool shouldWaitForGeneratedImage = behaviorConfig.barcodeImageGenerationType != SBSDKBarcodeImageGenerationTypeNone;
168
169
  BarcodeScannerPromiseProxy* delegate = [[BarcodeScannerPromiseProxy alloc] initWithResolver: resolve
169
- shouldIncludeBarcodeImage: shouldWaitForGeneratedImage];
170
+ shouldIncludeBarcodeImage: shouldWaitForGeneratedImage];
170
171
 
171
172
  SBSDKUIBarcodeScannerViewController* viewController = [SBSDKUIBarcodeScannerViewController createNewWithConfiguration:barcodeScannerConfiguration andDelegate:delegate];
172
173
  [self presentActiveViewController:viewController];
@@ -186,7 +187,7 @@ RCT_EXPORT_METHOD(startBatchBarcodeScanner:(NSDictionary*)configuration
186
187
  SBSDKUIBarcodesBatchScannerTextConfiguration *textConfig = [[SBSDKUIBarcodesBatchScannerTextConfiguration alloc] init];
187
188
  SBSDKUIBarcodesBatchScannerBehaviorConfiguration *behaviorConfig = [[SBSDKUIBarcodesBatchScannerBehaviorConfiguration alloc] init];
188
189
  SBSDKUICameraConfiguration* cameraConfig = [[SBSDKUICameraConfiguration alloc] init];
189
- SBSDKUIBarcodeSelectionOverlayConfiguration* selectionOverlayConfig = nil;
190
+ SBSDKUIBarcodeTrackingOverlayConfiguration* selectionOverlayConfig = nil;
190
191
  @try {
191
192
  [ObjectMapper populateInstance:uiConfig fromDictionary:configuration];
192
193
  [ObjectMapper populateInstance:behaviorConfig fromDictionary:configuration];
@@ -199,7 +200,7 @@ RCT_EXPORT_METHOD(startBatchBarcodeScanner:(NSDictionary*)configuration
199
200
  }
200
201
 
201
202
  // Barcode Filter (at the moment used for UPC Extension filters)
202
- SBSDKUIBarcodeFilter* barcodeFilter = extractBarcodeFilter(configuration);
203
+ SBSDKUIBarcodeFilter* barcodeFilter = extractBarcodeFilterFromConfiguration(configuration);
203
204
  if (barcodeFilter != nil) {
204
205
  behaviorConfig.barcodeFilter = barcodeFilter;
205
206
  }
@@ -207,7 +208,7 @@ RCT_EXPORT_METHOD(startBatchBarcodeScanner:(NSDictionary*)configuration
207
208
  behaviorConfig.additionalDetectionParameters = extractAdditionalParameters(configuration);
208
209
  behaviorConfig.acceptedDocumentTypes = extractBarcodeDocumentTypesFromConfiguration(configuration);
209
210
  behaviorConfig.acceptedBarcodeTypes = extractBarcodeTypesFromConfiguration(configuration);
210
- behaviorConfig.engineMode = extractEngineMode(configuration);
211
+ behaviorConfig.engineMode = extractEngineModeFromConfiguration(configuration);
211
212
 
212
213
  SBSDKZoomRange* cameraZoomRange = extractCameraZoomRange(configuration);
213
214
  if (cameraZoomRange) {
@@ -221,7 +222,7 @@ RCT_EXPORT_METHOD(startBatchBarcodeScanner:(NSDictionary*)configuration
221
222
  textConfiguration:textConfig
222
223
  behaviorConfiguration:behaviorConfig
223
224
  cameraConfiguration:cameraConfig
224
- selectionOverlayConfiguration:selectionOverlayConfig];
225
+ trackingOverlayConfiguration:selectionOverlayConfig];
225
226
 
226
227
  SBSDKUICameraConfiguration* cameraConfiguration = extractCameraConfiguration(configuration);
227
228
  if (cameraConfiguration) {
@@ -263,7 +264,7 @@ RCT_EXPORT_METHOD(detectBarcodesOnImage:(NSDictionary *)configuration
263
264
  NSArray* barcodeDocumentTypes = extractBarcodeDocumentTypesFromConfiguration(configuration);
264
265
  [barcodeScanner setAcceptedDocumentTypes: barcodeDocumentTypes];
265
266
 
266
- SBSDKBarcodeEngineMode engineMode = extractEngineMode(configuration);
267
+ SBSDKBarcodeEngineMode engineMode = extractEngineModeFromConfiguration(configuration);
267
268
  [barcodeScanner setEngineMode:engineMode];
268
269
 
269
270
  SBSDKBarcodeAdditionalParameters* additionalParameters = extractAdditionalParameters(configuration);
@@ -277,7 +278,7 @@ RCT_EXPORT_METHOD(detectBarcodesOnImage:(NSDictionary *)configuration
277
278
  NSArray<SBSDKBarcodeScannerResult *> *barcodeResults = [barcodeScanner detectBarCodesOnImage:image];
278
279
 
279
280
  if (barcodeResults) {
280
- SBSDKUIBarcodeFilter* barcodeFilter = extractBarcodeFilter(configuration);
281
+ SBSDKUIBarcodeFilter* barcodeFilter = extractBarcodeFilterFromConfiguration(configuration);
281
282
  if (barcodeFilter != nil) {
282
283
  barcodeResults = filterBarcodeResults(barcodeResults, barcodeFilter);
283
284
  }
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // Scanbot Barcode Scanner SDK React Native Plugin
3
3
  //
4
- // Copyright (c) 2020 doo GmbH. All rights reserved.
4
+ // Copyright (c) 2023 Scanbot SDK GmbH. All rights reserved.
5
5
  // https://scanbot.io/sdk
6
6
  //
7
7
  #import <Foundation/Foundation.h>
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // Scanbot Barcode Scanner SDK React Native Plugin
3
3
  //
4
- // Copyright (c) 2020 doo GmbH. All rights reserved.
4
+ // Copyright (c) 2023 Scanbot SDK GmbH. All rights reserved.
5
5
  // https://scanbot.io/sdk
6
6
  //
7
7
  #import "SharedConfiguration.h"
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // Scanbot Barcode Scanner SDK React Native Plugin
3
3
  //
4
- // Copyright (c) 2020 doo GmbH. All rights reserved.
4
+ // Copyright (c) 2023 Scanbot SDK GmbH. All rights reserved.
5
5
  // https://scanbot.io/sdk
6
6
  //
7
7
  #ifndef BarcodeMapping_h
@@ -9,7 +9,7 @@
9
9
  #import "UIColor+JSON.h"
10
10
  #include "ScanbotStorageUtils.h"
11
11
  #include "ReactBarcodeExtensionsFilter.h"
12
- @import ScanbotBarcodeScannerSDK;
12
+ #import <ScanbotBarcodeScannerSDK/ScanbotBarcodeScannerSDK.h>
13
13
 
14
14
  static inline SBSDKBarcodeType* barcodeTypeFromString(NSString* string) {
15
15
  if ([string isEqualToString:@"AZTEC"]) return SBSDKBarcodeTypeAztec;
@@ -102,9 +102,7 @@ static inline NSArray<NSDictionary<NSString*, NSObject*>*>* jsonFromMappedBarcod
102
102
  return [jsonResults copy];
103
103
  }
104
104
 
105
- static inline SBSDKBarcodeMSIPlesseyChecksumAlgorithm extractPlesseyChecksumAlgorithmFromConfiguration(NSDictionary* configuration) {
106
- NSString* algorithm = [configuration objectForKey:@"msiPlesseyChecksumAlgorithm"];
107
-
105
+ static inline SBSDKBarcodeMSIPlesseyChecksumAlgorithm extractMsiPlesseyChecksumAlgorithm(NSString* algorithm) {
108
106
  if (algorithm != nil) {
109
107
  if ([algorithm isEqualToString:@"None"]) return SBSDKBarcodeMSIPlesseyChecksumAlgorithmNone;
110
108
  if ([algorithm isEqualToString:@"Mod10"]) return SBSDKBarcodeMSIPlesseyChecksumAlgorithmMod10;
@@ -114,27 +112,35 @@ static inline SBSDKBarcodeMSIPlesseyChecksumAlgorithm extractPlesseyChecksumAlgo
114
112
  if ([algorithm isEqualToString:@"Mod1110IBM"]) return SBSDKBarcodeMSIPlesseyChecksumAlgorithmMod1110IBM;
115
113
  if ([algorithm isEqualToString:@"Mod1110NCR"]) return SBSDKBarcodeMSIPlesseyChecksumAlgorithmMod1110NCR;
116
114
  }
117
-
115
+
118
116
  return SBSDKBarcodeMSIPlesseyChecksumAlgorithmMod10;
119
117
  }
120
118
 
121
- static inline SBSDKUIBarcodeFilter* extractBarcodeFilter(NSDictionary* configuration) {
122
- NSString* jsonFilterType = [configuration objectForKey:@"barcodeFilter"];
123
- if (jsonFilterType == nil) {
124
- return nil;
125
- }
126
-
127
- if ([jsonFilterType isEqualToString:@"WithExtension"]) {
119
+ static inline SBSDKBarcodeMSIPlesseyChecksumAlgorithm extractMsiPlesseyChecksumAlgorithmFromConfiguration(NSDictionary* configuration) {
120
+ return extractMsiPlesseyChecksumAlgorithm((NSString*)[configuration objectForKey:@"msiPlesseyChecksumAlgorithm"]);
121
+ }
122
+
123
+ static inline SBSDKUIBarcodeFilter* extractBarcodeFilter(NSString* barcodeFilter) {
124
+ if ([barcodeFilter isEqualToString:@"WithExtension"]) {
128
125
  return [[ReactBarcodeExtensionsFilter alloc] init:ReactBarcodeExtensionsFilterWithExtension];
129
- } else if ([jsonFilterType isEqualToString:@"WithEAN2Extension"]) {
126
+ } else if ([barcodeFilter isEqualToString:@"WithEAN2Extension"]) {
130
127
  return [[ReactBarcodeExtensionsFilter alloc] init:ReactBarcodeExtensionsFilterWithEAN2Extension];
131
- } else if ([jsonFilterType isEqualToString:@"WithEAN5Extension"]) {
128
+ } else if ([barcodeFilter isEqualToString:@"WithEAN5Extension"]) {
132
129
  return [[ReactBarcodeExtensionsFilter alloc] init:ReactBarcodeExtensionsFilterWithEAN5Extension];
133
130
  }
134
131
 
135
132
  return nil;
136
133
  }
137
134
 
135
+ static inline SBSDKUIBarcodeFilter* extractBarcodeFilterFromConfiguration(NSDictionary* configuration) {
136
+ NSString* jsonFilterType = [configuration objectForKey:@"barcodeFilter"];
137
+ if (jsonFilterType == nil) {
138
+ return nil;
139
+ }
140
+
141
+ return extractBarcodeFilter(jsonFilterType);
142
+ }
143
+
138
144
  static inline NSArray* filterBarcodeResults(NSArray<SBSDKBarcodeScannerResult *>* barcodeResults, SBSDKUIBarcodeFilter* filter) {
139
145
  NSMutableArray<SBSDKBarcodeScannerResult *>* outResults = [[NSMutableArray alloc] init];
140
146
 
@@ -182,29 +188,30 @@ static inline NSArray* extractBarcodeDocumentTypesFromConfiguration(NSDictionary
182
188
  return nil;
183
189
  }
184
190
 
185
- static inline SBSDKBarcodeDensity extractBarcodeDensity(NSDictionary* configuration) {
186
- SBSDKBarcodeDensity barcodeDensity = SBSDKBarcodeDensityLow;
187
-
188
- NSString* codeDensity = [configuration objectForKey:@"codeDensity"];
189
- if (codeDensity != nil) {
190
- if([codeDensity isEqualToString:@"HIGH"]) {
191
- barcodeDensity = SBSDKBarcodeDensityHigh;
192
- }
191
+ static inline SBSDKBarcodeDensity extractBarcodeDensity(NSString* value) {
192
+ if (value != nil && [value isEqualToString:@"HIGH"]) {
193
+ return SBSDKBarcodeDensityHigh;
193
194
  }
194
-
195
- return barcodeDensity;
195
+
196
+ return SBSDKBarcodeDensityLow;
196
197
  }
197
198
 
198
- static inline SBSDKBarcodeEngineMode extractEngineMode(NSDictionary* configuration) {
199
- NSString* mode = [configuration objectForKey:@"engineMode"];
200
-
201
- if (mode && [@"LEGACY" isEqualToString:mode]) {
199
+ static inline SBSDKBarcodeDensity extractBarcodeDensityFromConfiguration(NSDictionary* configuration) {
200
+ return extractBarcodeDensity((NSString*)[configuration objectForKey:@"codeDensity"]);
201
+ }
202
+
203
+ static inline SBSDKBarcodeEngineMode extractEngineMode(NSString* value) {
204
+ if (value && [@"LEGACY" isEqualToString:value]) {
202
205
  return SBSDKBarcodeEngineModeLegacy;
203
206
  }
204
207
 
205
208
  return SBSDKBarcodeEngineModeNextGen;
206
209
  }
207
210
 
211
+ static inline SBSDKBarcodeEngineMode extractEngineModeFromConfiguration(NSDictionary* configuration) {
212
+ return extractEngineMode((NSString*)[configuration objectForKey:@"engineMode"]);
213
+ }
214
+
208
215
  static inline SBSDKBarcodeAdditionalParameters* extractAdditionalParameters(NSDictionary* configuration) {
209
216
  SBSDKBarcodeAdditionalParameters* additionalParameters = [[SBSDKBarcodeAdditionalParameters alloc] init];
210
217
  @try {
@@ -222,9 +229,9 @@ static inline SBSDKBarcodeAdditionalParameters* extractAdditionalParameters(NSDi
222
229
  }
223
230
 
224
231
  // We also need to manually extract the MSI-Plessey Checksum Algorithm since it can't be mapped automatically
225
- additionalParameters.msiPlesseyChecksumAlgorithm = extractPlesseyChecksumAlgorithmFromConfiguration(configuration);
232
+ additionalParameters.msiPlesseyChecksumAlgorithm = extractMsiPlesseyChecksumAlgorithmFromConfiguration(configuration);
226
233
 
227
- additionalParameters.codeDensity = extractBarcodeDensity(configuration);
234
+ additionalParameters.codeDensity = extractBarcodeDensityFromConfiguration(configuration);
228
235
 
229
236
  return additionalParameters;
230
237
  }
@@ -266,8 +273,8 @@ static inline SBSDKBarcodeOverlayFormat extractTextOverlayFormat(NSDictionary* c
266
273
  /**
267
274
  Extracts the selection overlay configuration values from the JSON dictionary.
268
275
  */
269
- static inline SBSDKUIBarcodeSelectionOverlayConfiguration* extractSelectionOverlayConfig(NSDictionary *dictionary) {
270
- SBSDKUIBarcodeSelectionOverlayConfiguration *overlayConfig = [[SBSDKUIBarcodeSelectionOverlayConfiguration alloc] init];
276
+ static inline SBSDKUIBarcodeTrackingOverlayConfiguration* extractSelectionOverlayConfig(NSDictionary *dictionary) {
277
+ SBSDKUIBarcodeTrackingOverlayConfiguration *overlayConfig = [[SBSDKUIBarcodeTrackingOverlayConfiguration alloc] init];
271
278
  NSDictionary *selectionOverlayDictionary = [dictionary objectForKey:@"overlayConfiguration"];
272
279
  if (selectionOverlayDictionary != nil) {
273
280
  NSNumber *overlayEnabled = [selectionOverlayDictionary objectForKey:@"overlayEnabled"];
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // Scanbot Barcode Scanner SDK React Native Plugin
3
3
  //
4
- // Copyright (c) 2020 doo GmbH. All rights reserved.
4
+ // Copyright (c) 2023 Scanbot SDK GmbH. All rights reserved.
5
5
  // https://scanbot.io/sdk
6
6
  //
7
7
 
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // Scanbot Barcode Scanner SDK React Native Plugin
3
3
  //
4
- // Copyright (c) 2020 doo GmbH. All rights reserved.
4
+ // Copyright (c) 2023 Scanbot SDK GmbH. All rights reserved.
5
5
  // https://scanbot.io/sdk
6
6
  //
7
7
 
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // Scanbot Barcode Scanner SDK React Native Plugin
3
3
  //
4
- // Copyright (c) 2020 doo GmbH. All rights reserved.
4
+ // Copyright (c) 2023 Scanbot SDK GmbH. All rights reserved.
5
5
  // https://scanbot.io/sdk
6
6
  //
7
7