react-native-scanbot-barcode-scanner-sdk 8.0.0-rc.1 → 8.0.0-rc.3

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.
@@ -41,6 +41,6 @@ Pod::Spec.new do |s|
41
41
  end
42
42
  end
43
43
 
44
- s.dependency "ScanbotBarcodeSDKNativeWrapper", '8.0.1.0'
44
+ s.dependency "ScanbotBarcodeSDKNativeWrapper", '8.0.1.1'
45
45
  s.ios.vendored_frameworks = 'ScanbotBarcodeSDKWrapper.framework'
46
46
  end
@@ -49,6 +49,7 @@ class ScanbotBarcodeScannerView(
49
49
  companion object {
50
50
  private const val CAMERA_PERMISSION_REQUEST_CODE = 3331
51
51
  private const val INITIAL_FLASH_STATE = false
52
+ private const val INITIAL_FRAME_PROCESSING_STATE = true
52
53
  private const val BARCODE_SCANNING_INTERVAL = 0L
53
54
  }
54
55
 
@@ -74,6 +75,7 @@ class ScanbotBarcodeScannerView(
74
75
  private set
75
76
 
76
77
  var flashState: Boolean = INITIAL_FLASH_STATE
78
+ var frameProcessingState: Boolean = INITIAL_FRAME_PROCESSING_STATE
77
79
  var polygonStyle = PolygonStyleConfig()
78
80
  var textStyle = TextStyleConfig()
79
81
 
@@ -114,8 +116,10 @@ class ScanbotBarcodeScannerView(
114
116
  initScanningBehavior(it, { result, _ ->
115
117
  try {
116
118
  result.getOrThrow().let { barcodeResult ->
117
- sendEvent(BarcodeScannerResultEvent(barcodeResult))
118
- addBarcodeItemOverlayViewInitialBinder(barcodeResult)
119
+ if (barcodeResult.barcodes.isNotEmpty() && frameProcessingState) {
120
+ sendEvent(BarcodeScannerResultEvent(barcodeResult))
121
+ addBarcodeItemOverlayViewInitialBinder(barcodeResult)
122
+ }
119
123
  }
120
124
  } catch (ex: Throwable) {
121
125
  sendEvent(BarcodeErrorEvent(ex))
@@ -124,6 +128,9 @@ class ScanbotBarcodeScannerView(
124
128
  }, object : IBarcodeScannerViewCallback {
125
129
  override fun onCameraOpen() {
126
130
  viewController.useFlash(flashState)
131
+ postDelayed({
132
+ viewController.isFrameProcessingEnabled = frameProcessingState
133
+ }, 500)
127
134
  }
128
135
 
129
136
  override fun onPictureTaken(image: ImageRef, captureInfo: CaptureInfo) {
@@ -25,7 +25,7 @@ import io.scanbot.sdk.barcode.BarcodeDocumentFormats
25
25
  import io.scanbot.sdk.barcode.BarcodeFormatCommonConfiguration
26
26
  import io.scanbot.sdk.barcode.BarcodeScannerEngineMode
27
27
  import io.scanbot.sdk.barcode.ui.BarcodeOverlayTextFormat
28
- import io.scanbot.sdk.camera.CameraModule
28
+ import io.scanbot.sdk.ui_v2.common.CameraModule
29
29
  import io.scanbot.sdk.camera.ZoomRange
30
30
  import io.scanbot.sdk.geometry.AspectRatio
31
31
  import io.scanbot.sdk_wrapper.SBWrapper
@@ -107,6 +107,7 @@ class ScanbotBarcodeScannerViewManager : SimpleViewManager<ScanbotBarcodeScanner
107
107
 
108
108
  @ReactProp(name = "scanningEnabled")
109
109
  override fun setScanningEnabled(view: ScanbotBarcodeScannerView, value: Boolean) {
110
+ view.frameProcessingState = value
110
111
  view.scannerView?.viewController?.isFrameProcessingEnabled = value
111
112
  }
112
113
 
@@ -120,10 +121,14 @@ class ScanbotBarcodeScannerViewManager : SimpleViewManager<ScanbotBarcodeScanner
120
121
 
121
122
  @ReactProp(name = "cameraModule")
122
123
  override fun setCameraModule(view: ScanbotBarcodeScannerView, value: String?) {
123
- view.scannerView?.cameraConfiguration?.setCameraModule(
124
- SBWrapper.gson.fromJson(value!!, CameraModule::class.java)
125
- )
126
- view.scannerView?.viewController?.restartPreview()
124
+ value?.let {
125
+ val module = when (SBWrapper.gson.fromJson(it, CameraModule::class.java)){
126
+ CameraModule.BACK_WIDEST, CameraModule.BACK -> io.scanbot.sdk.camera.CameraModule.BACK
127
+ CameraModule.FRONT -> io.scanbot.sdk.camera.CameraModule.FRONT
128
+ }
129
+ view.scannerView?.cameraConfiguration?.setCameraModule(module)
130
+ view.scannerView?.viewController?.restartPreview()
131
+ }
127
132
  }
128
133
 
129
134
  @ReactProp(name = "cameraZoomRange")
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-scanbot-barcode-scanner-sdk",
3
3
  "title": "Scanbot Barcode Scanner SDK for React Native",
4
- "version": "8.0.0-rc.1",
4
+ "version": "8.0.0-rc.3",
5
5
  "description": "Scanbot Barcode Scanner SDK React Native Plugin for Android and iOS",
6
6
  "main": "lib/commonjs/index",
7
7
  "module": "lib/module/index",