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.
- package/RNScanbotBarcodeSDK.podspec +12 -9
- package/android/build.gradle +31 -27
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/main/java/com/reactlibrary/ScanbotBarcodeSdkModule.java +5 -12
- package/android/src/main/java/com/reactlibrary/ScanbotBarcodeSdkPackage.java +2 -2
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ObjectMapper.java +24 -17
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkConfiguration.java +5 -2
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkModule.java +92 -84
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkPackage.java +1 -2
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/StorageUtils.java +5 -69
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/barcode/ScanbotBarcodeDetectorAdditionalConfigBuilder.java +1 -1
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/barcode/ScanbotBarcodeDetectorConfigBuilder.java +1 -1
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraView.java +9 -15
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewConfiguration.java +6 -5
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/base/communication/ScanbotEventEmitter.java +5 -3
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/base/communication/ScanbotEventReceiver.java +15 -4
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/utils/JSONUtils.java +29 -40
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/utils/LogUtils.java +4 -1
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/utils/ResponseUtils.java +2 -10
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/utils/ScanbotViewUtils.java +0 -17
- package/android/src/new-architecture/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewManager.java +127 -0
- package/android/src/{main/java → old-architecture}/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewManager.java +1 -1
- package/index.js +1 -1
- package/ios/Categories/SBSDKPolygon+JSON.h +1 -1
- package/ios/Categories/SBSDKPolygon+JSON.m +1 -1
- package/ios/Categories/UIColor+JSON.h +1 -1
- package/ios/Categories/UIColor+JSON.m +1 -1
- package/ios/Components/BarcodeCameraView/NewArchitecture/RTNScanbotBarcodeCameraView.h +45 -0
- package/ios/Components/BarcodeCameraView/NewArchitecture/RTNScanbotBarcodeCameraView.mm +364 -0
- package/ios/Components/BarcodeCameraView/NewArchitecture/RTNScanbotBarcodeCameraViewManager.mm +71 -0
- package/ios/Components/BarcodeCameraView/{RNScanbotBarcodeCameraView.h → OldArchitecture/RNScanbotBarcodeCameraView.h} +9 -4
- package/ios/Components/BarcodeCameraView/{RNScanbotBarcodeCameraView.m → OldArchitecture/RNScanbotBarcodeCameraView.mm} +24 -34
- package/ios/Components/BarcodeCameraView/{RNScanbotBarcodeCameraViewManager.h → OldArchitecture/RNScanbotBarcodeCameraViewManager.h} +7 -1
- package/ios/Components/BarcodeCameraView/{RNScanbotBarcodeCameraViewManager.m → OldArchitecture/RNScanbotBarcodeCameraViewManager.mm} +25 -6
- package/ios/ScanbotBarcodeSDKConfiguration.h +1 -1
- package/ios/ScanbotBarcodeSDKConfiguration.m +1 -1
- package/ios/ScanbotBarcodeSdk.h +2 -2
- package/ios/ScanbotBarcodeSdk.m +24 -23
- package/ios/SharedConfiguration.h +1 -1
- package/ios/SharedConfiguration.m +1 -1
- package/ios/Utils/BarcodeMapping.h +40 -33
- package/ios/Utils/HashUtils.h +1 -1
- package/ios/Utils/JSONMappings.h +1 -1
- package/ios/Utils/LoggingUtils.h +1 -1
- package/ios/Utils/ObjectMapper.h +1 -1
- package/ios/Utils/ObjectMapper.m +1 -1
- package/ios/Utils/ReactBarcodeExtensionsFilter.h +1 -1
- package/ios/Utils/ScanbotStorageUtils.h +1 -1
- package/ios/Utils/ScanbotStorageUtils.m +1 -1
- package/js/RTNScanbotBarcodeCameraViewNativeComponent.tsx +209 -0
- package/package.json +22 -2
- package/src/components/barcode-camera-view/scanbot-barcode-camera-view-types.tsx +8 -1
- package/src/components/barcode-camera-view/scanbot-barcode-camera-view.tsx +46 -12
- package/src/components/barcode-camera-view/scanbot-native-barcode-camera-view.tsx +7 -5
- package/src/configuration.ts +4 -1
- package/src/enum.ts +1 -1
- package/android/.gradle/6.1.1/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/6.1.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.1.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/6.1.1/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/6.1.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/6.1.1/gc.properties +0 -0
- package/android/.gradle/6.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/6.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/6.2/gc.properties +0 -0
- package/android/.gradle/6.8/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.8/fileChanges/last-build.bin +0 -0
- package/android/.gradle/6.8/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/6.8/gc.properties +0 -0
- package/android/.gradle/7.0-rc-1/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.0-rc-1/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.0-rc-1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.0-rc-1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.0-rc-1/gc.properties +0 -0
- package/android/.gradle/7.1.1/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.1.1/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.1.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.1.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.1.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.1.1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/configuration-cache/gc.properties +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build/.transforms/8cdb68f56773f65afa4976aa86d988f7/classes/classes.dex +0 -0
- package/android/build/.transforms/8cdb68f56773f65afa4976aa86d988f7.bin +0 -1
- package/android/build/.transforms/991094845a707011dcf91007d9838bb7/classes/classes.dex +0 -0
- package/android/build/.transforms/991094845a707011dcf91007d9838bb7.bin +0 -1
- package/android/build/generated/source/buildConfig/debug/io/scanbot/barcodesdk/plugin/reactnative/BuildConfig.java +0 -18
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -11
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output.json +0 -1
- package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
- package/android/build/intermediates/compile_library_classes/debug/classes.jar +0 -0
- package/android/build/intermediates/compile_only_not_namespaced_r_class_jar/debug/R.jar +0 -0
- package/android/build/intermediates/incremental/debug-mergeNativeLibs/merge-state +0 -0
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
- package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +0 -2
- package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +0 -4
- package/android/build/intermediates/incremental/packageDebugResources/merger.xml +0 -2
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/ScanbotBarcodeSdkModule.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/ScanbotBarcodeSdkPackage.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/BitmapHelper.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/BuildConfig.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/JSONUtils$WritableMapBuilder.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/JSONUtils.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/LogUtils.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ObjectMapper.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ReactBarcodeExtensionsFilter$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ReactBarcodeExtensionsFilter$Type.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ReactBarcodeExtensionsFilter.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ResponseUtils.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkConfiguration.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkModule$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkModule$2.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkModule$3.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkModule.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkPackage.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/StorageUtils.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/barcode/ScanbotBarcodeDetectorAdditionalConfigBuilder.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/barcode/ScanbotBarcodeDetectorConfigBuilder.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/EventEmitter$NativeEvent.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/EventEmitter.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewConfiguration.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewFragment$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewFragment$2.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewFragment.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewManager$1$1$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewManager$1$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewManager$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewManager.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/common/ScanbotComponentFrameLayout$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/common/ScanbotComponentFrameLayout$ILayoutChangeListener.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/common/ScanbotComponentFrameLayout.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/common/ScanbotComponentRootView$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/common/ScanbotComponentRootView$2.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/common/ScanbotComponentRootView$ILayoutChangeListener.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/common/ScanbotComponentRootView$IOnChildRemovedListener.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/components/common/ScanbotComponentRootView.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/filters/ReactBarcodeExtensionsFilter$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/filters/ReactBarcodeExtensionsFilter$Type.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/filters/ReactBarcodeExtensionsFilter.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/utils/BitmapHelper.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/utils/JSONUtils$WritableMapBuilder.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/utils/JSONUtils.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/utils/LogUtils.class +0 -0
- package/android/build/intermediates/javac/debug/classes/io/scanbot/barcodesdk/plugin/reactnative/utils/ResponseUtils.class +0 -0
- package/android/build/intermediates/library_java_res/debug/res.jar +0 -0
- package/android/build/intermediates/library_manifest/debug/AndroidManifest.xml +0 -11
- package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLibraryResources/R-def.txt +0 -9
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -13
- package/android/build/intermediates/merged_manifests/debug/output.json +0 -1
- package/android/build/intermediates/packaged_res/debug/drawable/ic_baseline_arrow_back_24.xml +0 -10
- package/android/build/intermediates/packaged_res/debug/layout/component_barcode_camera_view.xml +0 -11
- package/android/build/intermediates/packaged_res/debug/layout/fragment_barcode_scanner.xml +0 -23
- package/android/build/intermediates/res/symbol-table-with-package/debug/package-aware-r.txt +0 -3560
- package/android/build/intermediates/runtime_library_classes/debug/classes.jar +0 -0
- package/android/build/intermediates/symbols/debug/R.txt +0 -5107
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -37
- package/android/local.properties +0 -8
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ReactBarcodeExtensionsFilter.java +0 -61
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/utils/BitmapHelper.java +0 -30
- package/ios/ScanbotBarcodeSdk.xcodeproj/xcuserdata/mayankpatil.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- 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 = '
|
|
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
|
|
12
|
-
s.summary
|
|
13
|
-
s.homepage
|
|
14
|
-
s.authors
|
|
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
|
-
|
|
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
|
|
package/android/build.gradle
CHANGED
|
@@ -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 = '
|
|
7
|
+
def sdkVersion = '4.0.0'
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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-
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
|
|
4
4
|
zipStoreBase=GRADLE_USER_HOME
|
|
5
5
|
zipStorePath=wrapper/dists
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Scanbot Barcode Scanner SDK React Native Plugin
|
|
3
|
-
Copyright (c)
|
|
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
|
|
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)
|
|
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)
|
|
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.
|
|
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"
|
|
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
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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)
|
|
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 =
|
|
16
|
+
private boolean useCameraX = true;
|
|
14
17
|
private boolean allowXnnpackAcceleration = true;
|
|
15
18
|
private boolean allowGpuAcceleration = true;
|
|
16
19
|
|
package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkModule.java
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Scanbot Barcode Scanner SDK React Native Plugin
|
|
3
|
-
Copyright (c)
|
|
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(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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
|
-
|
|
142
|
-
|
|
110
|
+
final Application application = activity.getApplication();
|
|
111
|
+
final String callbackMessage;
|
|
143
112
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
151
|
-
|
|
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
|
-
|
|
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
|
-
|
|
261
|
-
|
|
275
|
+
// Setup activity result callback
|
|
262
276
|
activityCallbackPromise = promise;
|
|
263
277
|
context.addActivityEventListener(this);
|
|
264
|
-
|
|
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(
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
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
|
-
|
|
357
|
-
|
|
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 =
|
|
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
|
}
|
package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkPackage.java
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Scanbot Barcode Scanner SDK React Native Plugin
|
|
3
|
-
Copyright (c)
|
|
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
|
|