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,24 +1,27 @@
1
+ # AUTOGENERATED: DO NOT MODIFY MANUALLY
2
+
1
3
  require "json"
2
4
 
3
5
  package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
6
 
5
- ScanbotBarcodeScannerSDKVersion = '3.7.0'
6
-
7
- package = JSON.parse(File.read(File.join(__dir__, "package.json")))
7
+ ScanbotBarcodeScannerSDKVersion = '4.0.0'
8
8
 
9
9
  Pod::Spec.new do |s|
10
10
  s.name = "RNScanbotBarcodeSDK"
11
- s.version = package['version']
12
- s.summary = package['description']
13
- s.homepage = package['homepage']
14
- s.authors = package['author']
11
+ s.version = package['version']
12
+ s.summary = package['description']
13
+ s.homepage = package['homepage']
14
+ s.authors = package['author']
15
15
  s.license = { :type => 'Commercial' }
16
16
  s.platforms = { :ios => "13.0" }
17
- s.source = { :http => 'https://download.scanbot.io/barcode-scanner-sdk/react-native/react-native-scanbot-barcode-scanner-sdk-' + package['version'] + '.tgz' }
18
17
 
19
- s.source_files = "ios/**/*.{h,m,swift}"
18
+
19
+ s.source = { :http => 'https://download.scanbot.io/barcode-scanner-sdk/react-native/react-native-scanbot-barcode-scanner-sdk-' + package['version'] + '.tgz' }
20
+ s.source_files = "ios/**/*.{h,m,mm,swift}"
20
21
  s.requires_arc = true
21
22
 
23
+ install_modules_dependencies(s)
24
+
22
25
  s.dependency "React"
23
26
  s.dependency "ScanbotBarcodeScannerSDK", ScanbotBarcodeScannerSDKVersion
24
27
 
@@ -4,27 +4,30 @@ def DEFAULT_COMPILE_SDK_VERSION = 31
4
4
  def DEFAULT_MIN_SDK_VERSION = 21
5
5
  def DEFAULT_TARGET_SDK_VERSION = 31
6
6
 
7
- def sdkVersion = '3.7.0'
7
+ def sdkVersion = '4.0.0'
8
8
 
9
- buildscript {
10
- if (project == rootProject) {
11
- repositories {
12
- google()
13
- mavenCentral()
14
- jcenter()
15
- }
16
- dependencies {
17
- classpath 'com.android.tools.build:gradle:3.5.3'
18
- }
19
- }
9
+ def isNewArchitectureEnabled = {
10
+ return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
20
11
  }
21
12
 
22
- apply plugin: 'com.android.library'
23
-
24
- def safeExtGet(prop, fallback) {
13
+ buildscript {
14
+ ext.safeExtGet = {prop, fallback ->
25
15
  rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
16
+ }
17
+ repositories {
18
+ google()
19
+ gradlePluginPortal()
20
+ jcenter()
21
+ mavenCentral()
22
+ }
23
+ dependencies {
24
+ classpath("com.android.tools.build:gradle:7.3.1")
25
+ }
26
26
  }
27
27
 
28
+ apply plugin: 'com.android.library'
29
+ apply plugin: 'com.facebook.react'
30
+
28
31
  android {
29
32
  compileSdkVersion safeExtGet('ScanbotBarcodeScannerSdk_compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
30
33
  defaultConfig {
@@ -32,6 +35,17 @@ android {
32
35
  targetSdkVersion safeExtGet('ScanbotBarcodeScannerSdk_targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
33
36
  versionCode 1
34
37
  versionName "1.0"
38
+ buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
39
+ }
40
+
41
+ sourceSets {
42
+ main {
43
+ if (isNewArchitectureEnabled()) {
44
+ java.srcDirs += ['src/main', 'src/new-architecture']
45
+ } else {
46
+ java.srcDirs += ['src/main', 'src/old-architecture']
47
+ }
48
+ }
35
49
  }
36
50
 
37
51
  buildTypes {
@@ -43,21 +57,12 @@ android {
43
57
  lintOptions {
44
58
  disable 'GradleCompatible'
45
59
  }
46
-
47
- compileOptions {
48
- sourceCompatibility JavaVersion.VERSION_1_8
49
- targetCompatibility JavaVersion.VERSION_1_8
50
- }
51
60
  }
52
61
 
53
62
  repositories {
54
63
  mavenLocal()
55
- maven {
56
- // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
57
- url("$rootDir/../node_modules/react-native/android")
58
- }
59
- google()
60
64
  mavenCentral()
65
+ google()
61
66
  jcenter()
62
67
 
63
68
  // Scanbot SDK Maven Repositories (NEXUS)
@@ -70,8 +75,7 @@ repositories {
70
75
  }
71
76
 
72
77
  dependencies {
73
- //noinspection GradleDynamicVersion
74
- implementation 'com.facebook.react:react-native:+' // From node_modules
78
+ implementation 'com.facebook.react:react-native'
75
79
 
76
80
  implementation 'androidx.appcompat:appcompat:1.1.0'
77
81
  implementation 'androidx.core:core-ktx:1.1.0'
@@ -1,5 +1,5 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
4
4
  zipStoreBase=GRADLE_USER_HOME
5
5
  zipStorePath=wrapper/dists
@@ -1,4 +1,3 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="io.scanbot.barcodesdk.plugin.reactnative">
1
+ <manifest package="io.scanbot.barcodesdk.plugin.reactnative">
3
2
 
4
3
  </manifest>
@@ -1,24 +1,17 @@
1
1
  /*
2
2
  Scanbot Barcode Scanner SDK React Native Plugin
3
- Copyright (c) 2020 doo GmbH. All rights reserved.
3
+ Copyright (c) 2023 Scanbot SDK GmbH. All rights reserved.
4
4
  https://scanbot.io/sdk
5
5
  */
6
6
  package com.reactlibrary;
7
7
 
8
- import com.facebook.react.bridge.ReactApplicationContext;
8
+ import androidx.annotation.NonNull;
9
+
9
10
  import com.facebook.react.bridge.ReactContextBaseJavaModule;
10
- import com.facebook.react.bridge.ReactMethod;
11
- import com.facebook.react.bridge.Callback;
12
11
 
12
+ /** @noinspection unused*/
13
13
  public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule {
14
-
15
- private final ReactApplicationContext reactContext;
16
-
17
- public ScanbotBarcodeSdkModule(ReactApplicationContext reactContext) {
18
- super(reactContext);
19
- this.reactContext = reactContext;
20
- }
21
-
14
+ @NonNull
22
15
  @Override
23
16
  public String getName() {
24
17
  return "ScanbotBarcodeSdk";
@@ -1,13 +1,12 @@
1
1
  /*
2
2
  Scanbot Barcode Scanner SDK React Native Plugin
3
- Copyright (c) 2020 doo GmbH. All rights reserved.
3
+ Copyright (c) 2023 Scanbot SDK GmbH. All rights reserved.
4
4
  https://scanbot.io/sdk
5
5
  */
6
6
  package com.reactlibrary;
7
7
 
8
8
  import androidx.annotation.NonNull;
9
9
 
10
- import java.util.Arrays;
11
10
  import java.util.Collections;
12
11
  import java.util.List;
13
12
 
@@ -19,6 +18,7 @@ import com.facebook.react.uimanager.ViewManager;
19
18
  import io.scanbot.barcodesdk.plugin.reactnative.ScanbotBarcodeSdkModule;
20
19
  import io.scanbot.barcodesdk.plugin.reactnative.components.barcodecameraview.ScanbotBarcodeCameraViewManager;
21
20
 
21
+ /** @noinspection unused*/
22
22
  public class ScanbotBarcodeSdkPackage implements ReactPackage {
23
23
  @NonNull
24
24
  @Override
@@ -1,12 +1,11 @@
1
1
  /*
2
2
  Scanbot Barcode Scanner SDK React Native Plugin
3
- Copyright (c) 2020 doo GmbH. All rights reserved.
3
+ Copyright (c) 2023 Scanbot SDK GmbH. All rights reserved.
4
4
  https://scanbot.io/sdk
5
5
  */
6
6
  package io.scanbot.barcodesdk.plugin.reactnative;
7
7
 
8
8
  import android.graphics.Color;
9
- import android.util.Log;
10
9
 
11
10
  import com.facebook.react.bridge.ReadableMap;
12
11
 
@@ -15,11 +14,10 @@ import java.lang.reflect.Method;
15
14
  import java.util.HashMap;
16
15
  import java.util.Map;
17
16
 
18
- import io.scanbot.barcodesdk.plugin.reactnative.utils.LogUtils;
19
- import io.scanbot.sdk.ui.camera.FinderAspectRatio;
17
+ import io.scanbot.sdk.AspectRatio;
20
18
 
21
19
  public final class ObjectMapper {
22
- private static Map<String, Map<String, Method>> methodCache = new HashMap<>();
20
+ private static final Map<String, Map<String, Method>> methodCache = new HashMap<>();
23
21
 
24
22
  private static Map<String, Map<String, String>> enumMappings;
25
23
 
@@ -47,7 +45,7 @@ public final class ObjectMapper {
47
45
  ObjectMapper.enumMappings = enumMappings;
48
46
  }
49
47
 
50
- @SuppressWarnings({"unchecked", "SuspiciousMethodCalls", "rawtypes", "ConstantConditions"})
48
+ @SuppressWarnings({"unchecked", "SuspiciousMethodCalls", "rawtypes"})
51
49
  private static void map(final Map<String, Object> source, final Object target)
52
50
  throws IllegalAccessException, InvocationTargetException {
53
51
  final Class cls = target.getClass();
@@ -102,22 +100,31 @@ public final class ObjectMapper {
102
100
 
103
101
  if (enumMappings != null && enumMappings.containsKey(prop)) {
104
102
  Map<String, String> enumNames = enumMappings.get(prop);
105
- if (enumNames.containsKey(value)) {
103
+ if (enumNames != null && enumNames.containsKey(value)) {
106
104
  value = enumNames.get(value);
107
105
  }
108
106
  }
109
107
 
110
108
  if (setterName.equals("setFinderAspectRatio")) {
111
- Map<String, Object> pointMap = (Map<String, Object>) value;
112
- int x = ((Number) pointMap.get("width")).intValue();
113
- int y = ((Number) pointMap.get("height")).intValue();
114
- setter.invoke(target, new FinderAspectRatio(x, y));
109
+ final Map<String, Object> pointMap = (Map<String, Object>) value;
110
+ if (pointMap != null) {
111
+ final Object widthObj = pointMap.get("width");
112
+ final Object heightObj = pointMap.get("width");
113
+ if (widthObj != null && heightObj != null) {
114
+ int x = ((Number) widthObj).intValue();
115
+ int y = ((Number) heightObj).intValue();
116
+ setter.invoke(target, new AspectRatio(x, y));
117
+ }
118
+ }
115
119
  } else if (setter.getParameterTypes().length == 2 && value instanceof Map) {
116
- // map Size to a binary function
117
- Map<String, Object> pointMap = (Map<String, Object>) value;
118
- int x = ((Number) pointMap.get("width")).intValue();
119
- int y = ((Number) pointMap.get("height")).intValue();
120
- setter.invoke(target, x, y);
120
+ final Map<String, Object> pointMap = (Map<String, Object>) value;
121
+ final Object widthObj = pointMap.get("width");
122
+ final Object heightObj = pointMap.get("width");
123
+ if (widthObj != null && heightObj != null) {
124
+ int x = ((Number) widthObj).intValue();
125
+ int y = ((Number) heightObj).intValue();
126
+ setter.invoke(target, new AspectRatio(x, y));
127
+ }
121
128
  } else {
122
129
  final Class paramType = setter.getParameterTypes()[0];
123
130
  if (setterName.contains("Color")) {
@@ -134,7 +141,7 @@ public final class ObjectMapper {
134
141
  } else if (paramType == long.class) {
135
142
  assert value instanceof Number;
136
143
  value = ((Number) value).longValue();
137
- } else if (paramType.isEnum()) {
144
+ } else if (paramType.isEnum() && value != null) {
138
145
  try {
139
146
  value = Enum.valueOf(paramType, (String) value);
140
147
  } catch (final Exception ignored) {
@@ -1,16 +1,19 @@
1
1
  /*
2
2
  Scanbot Barcode Scanner SDK React Native Plugin
3
- Copyright (c) 2020 doo GmbH. All rights reserved.
3
+ Copyright (c) 2023 Scanbot SDK GmbH. All rights reserved.
4
4
  https://scanbot.io/sdk
5
5
  */
6
6
  package io.scanbot.barcodesdk.plugin.reactnative;
7
7
 
8
+ // The following noinspection rule has been introduced since
9
+ // methods in this class are called through reflection
10
+ /** @noinspection unused*/
8
11
  public class ScanbotBarcodeSdkConfiguration {
9
12
  private boolean loggingEnabled = false;
10
13
  private boolean enableNativeLogging = false;
11
14
  private String licenseKey;
12
15
  private String storageBaseDirectory = null;
13
- private boolean useCameraX = false;
16
+ private boolean useCameraX = true;
14
17
  private boolean allowXnnpackAcceleration = true;
15
18
  private boolean allowGpuAcceleration = true;
16
19
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  Scanbot Barcode Scanner SDK React Native Plugin
3
- Copyright (c) 2020 doo GmbH. All rights reserved.
3
+ Copyright (c) 2023 Scanbot SDK GmbH. All rights reserved.
4
4
  https://scanbot.io/sdk
5
5
  */
6
6
  package io.scanbot.barcodesdk.plugin.reactnative;
@@ -18,15 +18,11 @@ import com.facebook.react.bridge.ReactApplicationContext;
18
18
  import com.facebook.react.bridge.ReactContext;
19
19
  import com.facebook.react.bridge.ReactContextBaseJavaModule;
20
20
  import com.facebook.react.bridge.ReactMethod;
21
- import com.facebook.react.bridge.ReadableArray;
22
21
  import com.facebook.react.bridge.ReadableMap;
23
- import com.facebook.react.bridge.WritableArray;
24
22
  import com.facebook.react.bridge.WritableMap;
25
23
 
26
24
  import org.jetbrains.annotations.Contract;
27
25
  import org.jetbrains.annotations.NotNull;
28
- import org.json.JSONArray;
29
- import org.json.JSONException;
30
26
 
31
27
  import java.io.File;
32
28
  import java.io.IOException;
@@ -47,7 +43,6 @@ import io.scanbot.sdk.barcode.entity.BarcodeDocumentFormat;
47
43
  import io.scanbot.sdk.barcode.entity.BarcodeFormat;
48
44
  import io.scanbot.sdk.barcode.entity.BarcodeItem;
49
45
  import io.scanbot.sdk.barcode.entity.BarcodeScanningResult;
50
- import io.scanbot.sdk.barcode.entity.EngineMode;
51
46
  import io.scanbot.sdk.barcode_scanner.ScanbotBarcodeScannerSDK;
52
47
  import io.scanbot.sdk.barcode_scanner.ScanbotBarcodeScannerSDKInitializer;
53
48
  import io.scanbot.sdk.camera.ZoomRange;
@@ -60,10 +55,11 @@ import io.scanbot.sdk.ui.view.barcode.configuration.BarcodeScannerAdditionalConf
60
55
  import io.scanbot.sdk.ui.view.barcode.configuration.BarcodeScannerConfiguration;
61
56
  import io.scanbot.sdk.ui.view.barcode.common.configuration.CommonBarcodeScannerConfiguration;
62
57
  import io.scanbot.sdk.ui.view.base.configuration.CameraOrientationMode;
63
- import kotlin.Unit;
64
58
 
65
59
  import android.app.Activity;
66
60
 
61
+ import androidx.annotation.NonNull;
62
+
67
63
 
68
64
  public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implements ActivityEventListener {
69
65
 
@@ -71,7 +67,6 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
71
67
  private static final String LOG_TAG = ScanbotBarcodeSdkModule.class.getSimpleName();
72
68
 
73
69
  private final ExecutorService threadPool;
74
- private final ReactApplicationContext reactContext;
75
70
 
76
71
  private static boolean isSdkInitialized;
77
72
 
@@ -79,7 +74,6 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
79
74
 
80
75
  public ScanbotBarcodeSdkModule(ReactApplicationContext reactContext) {
81
76
  super(reactContext);
82
- this.reactContext = reactContext;
83
77
  this.threadPool = Executors.newCachedThreadPool();
84
78
 
85
79
  Map<String, Map<String, String>> enumMappings = new HashMap<>();
@@ -93,67 +87,78 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
93
87
  reactContext.addActivityEventListener(this);
94
88
  }
95
89
 
90
+ @NonNull
96
91
  @Override
97
92
  public String getName() {
98
93
  return "ScanbotBarcodeSdk";
99
94
  }
100
95
 
96
+ /** @noinspection unused*/
101
97
  @ReactMethod
102
98
  public void initializeSdk(final ReadableMap options, final Promise promise) {
103
99
  debugLog("Initializing Scanbot SDK ...");
104
- this.threadPool.execute(new Runnable() {
105
- public void run() {
106
- try {
107
- final ScanbotBarcodeSdkConfiguration configuration = new ScanbotBarcodeSdkConfiguration();
108
- safeMap(options, configuration, promise);
109
-
110
- final Application app = getCurrentActivity().getApplication();
111
- final String callbackMessage;
112
-
113
- final ScanbotBarcodeScannerSDKInitializer initializer = new ScanbotBarcodeScannerSDKInitializer();
114
- initializer.withLogging(configuration.isLoggingEnabled(), configuration.getEnableNativeLogging());
115
- LogUtils.setLoggingEnabled(configuration.isLoggingEnabled());
116
-
117
- initializer.allowGpuAcceleration(configuration.getAllowGpuAcceleration());
118
- initializer.allowXnnpackAcceleration(configuration.getAllowXnnpackAcceleration());
119
- initializer.useCameraXRtuUi(configuration.getUseCameraX());
120
-
121
- if (configuration.getStorageBaseDirectory() != null && !"".equals(configuration.getStorageBaseDirectory())) {
122
- final Uri uri = Uri.parse(configuration.getStorageBaseDirectory());
123
- final File customStorageBaseDirectory = new File(uri.getPath());
124
- customStorageBaseDirectory.mkdirs();
125
- if (!customStorageBaseDirectory.isDirectory()) {
126
- throw new IOException("Specified storageBaseDirectory is not valid: " + uri);
127
- }
128
- initializer.sdkFilesDirectory(app, customStorageBaseDirectory);
129
- StorageUtils.setCustomStorageBaseDirectory(customStorageBaseDirectory);
130
- debugLog("Using custom storage base directory: " + customStorageBaseDirectory.getAbsolutePath());
131
- }
100
+ this.threadPool.execute(() -> {
101
+ try {
102
+ final ScanbotBarcodeSdkConfiguration configuration = new ScanbotBarcodeSdkConfiguration();
103
+ safeMap(options, configuration, promise);
132
104
 
133
- final String licenseKey = configuration.getLicenseKey();
134
- if (licenseKey != null && !"".equals(licenseKey.trim()) && !"null".equals(licenseKey.toLowerCase())) {
135
- initializer.license(app, licenseKey);
136
- callbackMessage = "Scanbot SDK initialized.";
137
- } else {
138
- callbackMessage = "Scanbot SDK initialized. Trial mode activated. You can now test all features for 60 seconds.";
139
- }
105
+ final Activity activity = getCurrentActivity();
106
+ if (activity == null) {
107
+ throw new RuntimeException("Cannot get current activity");
108
+ }
140
109
 
141
- debugLog("Checking license ...");
142
- SdkLicenseInfo licenseInfo = initializer.initialize(app);
110
+ final Application application = activity.getApplication();
111
+ final String callbackMessage;
143
112
 
144
- if (licenseInfo.isValid()) {
145
- isSdkInitialized = true;
146
- ResponseUtils.successMessageJson(callbackMessage, promise);
147
- } else {
148
- ResponseUtils.errorMessageJson(descriptionFromLicenseStatus(licenseInfo.getStatus()), promise);
113
+ final ScanbotBarcodeScannerSDKInitializer initializer = new ScanbotBarcodeScannerSDKInitializer();
114
+ initializer.withLogging(configuration.isLoggingEnabled(), configuration.getEnableNativeLogging());
115
+ LogUtils.setLoggingEnabled(configuration.isLoggingEnabled());
116
+
117
+ initializer.allowGpuAcceleration(configuration.getAllowGpuAcceleration());
118
+ initializer.allowXnnpackAcceleration(configuration.getAllowXnnpackAcceleration());
119
+ initializer.useCameraXRtuUi(configuration.getUseCameraX());
120
+
121
+ if (configuration.getStorageBaseDirectory() != null && !"".equals(configuration.getStorageBaseDirectory())) {
122
+ final Uri uri = Uri.parse(configuration.getStorageBaseDirectory());
123
+ final String path = uri.getPath();
124
+ if (path == null) {
125
+ throw new IOException("Cannot get path from uri: " + uri);
149
126
  }
150
- } catch (Exception ex) {
151
- promise.reject(ex);
127
+ final File customStorageBaseDirectory = new File(path);
128
+ boolean ignoredMkdirs = customStorageBaseDirectory.mkdirs();
129
+ if (!customStorageBaseDirectory.isDirectory()) {
130
+ throw new IOException("Specified storageBaseDirectory is not valid: " + uri);
131
+ }
132
+
133
+ initializer.sdkFilesDirectory(application, customStorageBaseDirectory);
134
+ StorageUtils.setCustomStorageBaseDirectory(customStorageBaseDirectory);
135
+ debugLog("Using custom storage base directory: " + customStorageBaseDirectory.getAbsolutePath());
136
+ }
137
+
138
+ final String licenseKey = configuration.getLicenseKey();
139
+ if (licenseKey != null && !"".equals(licenseKey.trim()) && !"null".equalsIgnoreCase(licenseKey)) {
140
+ initializer.license(application, licenseKey);
141
+ callbackMessage = "Scanbot SDK initialized.";
142
+ } else {
143
+ callbackMessage = "Scanbot SDK initialized. Trial mode activated. You can now test all features for 60 seconds.";
144
+ }
145
+
146
+ debugLog("Checking license ...");
147
+ SdkLicenseInfo licenseInfo = initializer.initialize(application);
148
+
149
+ if (licenseInfo.isValid()) {
150
+ isSdkInitialized = true;
151
+ ResponseUtils.successMessageJson(callbackMessage, promise);
152
+ } else {
153
+ ResponseUtils.errorMessageJson(descriptionFromLicenseStatus(licenseInfo.getStatus()), promise);
152
154
  }
155
+ } catch (Exception ex) {
156
+ promise.reject(ex);
153
157
  }
154
158
  });
155
159
  }
156
160
 
161
+ /** @noinspection unused*/
157
162
  @ReactMethod
158
163
  public void getLicenseInfo(final Promise promise) {
159
164
  if (rejectIfUninitialized(promise)) {
@@ -172,6 +177,7 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
172
177
  }
173
178
  }
174
179
 
180
+ /** @noinspection unused*/
175
181
  @ReactMethod
176
182
  public void detectBarcodesOnImage(final ReadableMap options, final Promise promise) {
177
183
  if (rejectIfUninitialized(promise)) {
@@ -215,6 +221,7 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
215
221
  });
216
222
  }
217
223
 
224
+ /** @noinspection unused*/
218
225
  @ReactMethod
219
226
  public void startBarcodeScanner(final ReadableMap options, final Promise promise) {
220
227
  if (rejectIfUninitialized(promise)) {
@@ -230,15 +237,22 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
230
237
 
231
238
  this.setCustomBarcodeScannerConfiguration(options, configuration);
232
239
 
233
- final Intent intent = BarcodeScannerActivity.newIntent(this.getReactApplicationContext(), configuration);
240
+ // Setup activity result callback
234
241
  activityCallbackPromise = promise;
235
242
  context.addActivityEventListener(this);
243
+
244
+ // TODO: Migrate to Results API
245
+ final Intent intent = BarcodeScannerActivity.newIntent(
246
+ this.getReactApplicationContext(),
247
+ configuration
248
+ );
236
249
  context.startActivityForResult(intent, REQUEST_SB_BARCODE_SCANNER, null);
237
250
  } catch (final Exception e) {
238
251
  promise.reject("Error starting barcode scanner.", e);
239
252
  }
240
253
  }
241
254
 
255
+ /** @noinspection unused*/
242
256
  @ReactMethod
243
257
  public void closeBarcodeScanner(final Promise promise) {
244
258
  final ReactContext context = getReactApplicationContext();
@@ -246,6 +260,7 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
246
260
  promise.resolve(null);
247
261
  }
248
262
 
263
+ /** @noinspection unused*/
249
264
  @ReactMethod
250
265
  public void startBatchBarcodeScanner(ReadableMap configuration, final Promise promise) {
251
266
  final ReactContext context = getReactApplicationContext();
@@ -257,11 +272,13 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
257
272
 
258
273
  this.setCustomBarcodeScannerConfiguration(configuration, nativeConfig);
259
274
 
260
- Intent startIntent = BatchBarcodeScannerActivity.newIntent(context, nativeConfig, null);
261
-
275
+ // Setup activity result callback
262
276
  activityCallbackPromise = promise;
263
277
  context.addActivityEventListener(this);
264
- context.startActivityForResult(startIntent, REQUEST_SB_BARCODE_SCANNER, null);
278
+
279
+ // TODO: Migrate to Results API
280
+ final Intent intent = BatchBarcodeScannerActivity.newIntent(context, nativeConfig, null);
281
+ context.startActivityForResult(intent, REQUEST_SB_BARCODE_SCANNER, null);
265
282
  } catch (Exception ex) {
266
283
  promise.reject(ex);
267
284
  }
@@ -319,6 +336,7 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
319
336
  configuration.setCameraPreviewMode(JSONUtils.extractCameraPreviewMode(options));
320
337
  }
321
338
 
339
+ /** @noinspection unused*/
322
340
  @ReactMethod
323
341
  public void closeBatchBarcodeScanner(final Promise promise) {
324
342
  final ReactContext context = getReactApplicationContext();
@@ -326,25 +344,24 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
326
344
  promise.resolve(null);
327
345
  }
328
346
 
347
+ /** @noinspection unused*/
329
348
  @ReactMethod
330
349
  public void cleanup(final Promise promise) {
331
350
  if (rejectIfUninitialized(promise)) {
332
351
  return;
333
352
  }
334
- threadPool.execute(new Runnable() {
335
- public void run() {
336
- try {
337
-
338
- debugLog("Cleaning Barcode SDK storage folder ...");
339
- ScanbotBarcodeScannerSDK sdk = new ScanbotBarcodeScannerSDK(getReactApplicationContext());
340
- sdk.createBarcodeFileStorage().cleanupBarcodeImagesDirectory();
341
-
342
- debugLog("Cleaning plugin storage folder ...");
343
- StorageUtils.cleanupPluginStorageDirectory(getReactApplicationContext());
344
- ResponseUtils.successMessageJson("Cleanup successfully done.", promise);
345
- } catch (final Exception e) {
346
- ResponseUtils.errorMessageJson(e.getLocalizedMessage(), promise);
347
- }
353
+ threadPool.execute(() -> {
354
+ try {
355
+
356
+ debugLog("Cleaning Barcode SDK storage folder ...");
357
+ ScanbotBarcodeScannerSDK sdk = new ScanbotBarcodeScannerSDK(getReactApplicationContext());
358
+ sdk.createBarcodeFileStorage().cleanupBarcodeImagesDirectory();
359
+
360
+ debugLog("Cleaning plugin storage folder ...");
361
+ StorageUtils.cleanupPluginStorageDirectory(getReactApplicationContext());
362
+ ResponseUtils.successMessageJson("Cleanup successfully done.", promise);
363
+ } catch (final Exception e) {
364
+ ResponseUtils.errorMessageJson(e.getLocalizedMessage(), promise);
348
365
  }
349
366
  });
350
367
  }
@@ -353,19 +370,13 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
353
370
  public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent intent) {
354
371
  debugLog("onActivityResult: requestCode=" + requestCode + ", resultCode=" + resultCode + ", intent=" + intent);
355
372
 
356
- switch (requestCode) {
357
- case REQUEST_SB_BARCODE_SCANNER:
358
- this.handleBarcodeScannerActivityCompletion(intent, resultCode);
359
- return;
360
-
361
- default:
362
- return;
373
+ if (requestCode == REQUEST_SB_BARCODE_SCANNER) {
374
+ this.handleBarcodeScannerActivityCompletion(intent, resultCode);
363
375
  }
364
376
  }
365
377
 
366
378
  @Override
367
- public void onNewIntent(Intent intent) {
368
- }
379
+ public void onNewIntent(Intent intent) {}
369
380
 
370
381
  private void handleBarcodeScannerActivityCompletion(final Intent intent, final int resultCode) {
371
382
  Promise promise = this.activityCallbackPromise;
@@ -376,10 +387,7 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
376
387
  if (barcodeResult.getResultOk()) {
377
388
  final WritableMap result = JSONUtils.jsonResultFromBarcodeResult(barcodeResult.getResult());
378
389
 
379
- String imagePath = intent.getStringExtra(BarcodeScannerActivity.SCANNED_BARCODE_IMAGE_PATH_EXTRA);
380
- if (imagePath == null) {
381
- imagePath = intent.getStringExtra(BarcodeScannerActivity.SCANNED_BARCODE_PREVIEW_FRAME_PATH_EXTRA);
382
- }
390
+ final String imagePath = barcodeResult.getBarcodeImagePath();
383
391
  if (imagePath != null) {
384
392
  result.putString("imageFileUri", "file://" + imagePath);
385
393
  }
@@ -1,13 +1,12 @@
1
1
  /*
2
2
  Scanbot Barcode Scanner SDK React Native Plugin
3
- Copyright (c) 2020 doo GmbH. All rights reserved.
3
+ Copyright (c) 2023 Scanbot SDK GmbH. All rights reserved.
4
4
  https://scanbot.io/sdk
5
5
  */
6
6
  package io.scanbot.barcodesdk.plugin.reactnative;
7
7
 
8
8
  import androidx.annotation.NonNull;
9
9
 
10
- import java.util.Arrays;
11
10
  import java.util.Collections;
12
11
  import java.util.List;
13
12