react-native-scanbot-barcode-scanner-sdk 6.2.0-beta.1 → 6.2.0-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/LICENSE +1 -1
- package/Libraries.txt +1 -1
- package/RNScanbotBarcodeSDK.podspec +1 -1
- package/android/gradle.properties +1 -1
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkModule.kt +15 -11
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/barcode_scanner_view/ScanbotBarcodeScannerView.kt +25 -43
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/barcode_scanner_view/ScanbotBarcodeScannerViewManager.kt +0 -37
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/barcode_scanner_view/models/ScanbotBarcodeScannerModels.kt +0 -50
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/extensions/ReadableMap.kt +2 -2
- package/android/src/paper/com/facebook/react/viewmanagers/ScanbotBarcodeScannerViewManagerDelegate.java +0 -15
- package/android/src/paper/com/facebook/react/viewmanagers/ScanbotBarcodeScannerViewManagerInterface.java +0 -5
- package/ios/Components/BarcodeScannerView/RNScanbotBarcodeScannerLegacyView.h +0 -3
- package/ios/Components/BarcodeScannerView/RNScanbotBarcodeScannerLegacyView.m +17 -40
- package/ios/Components/BarcodeScannerView/RNScanbotBarcodeScannerView.h +0 -1
- package/ios/Components/BarcodeScannerView/RNScanbotBarcodeScannerView.mm +27 -52
- package/ios/Components/BarcodeScannerView/RNScanbotBarcodeScannerViewControllerWrapper.h +4 -20
- package/ios/Components/BarcodeScannerView/RNScanbotBarcodeScannerViewControllerWrapper.m +32 -114
- package/ios/Components/BarcodeScannerView/RNScanbotBarcodeScannerViewManager.mm +0 -11
- package/lib/commonjs/component/barcode-camera-view/ScanbotBarcodeCameraView.js +4 -31
- package/lib/commonjs/component/barcode-camera-view/ScanbotBarcodeCameraView.js.map +1 -1
- package/lib/commonjs/component/spec/ScanbotBarcodeScannerViewNativeComponent.js +1 -1
- package/lib/commonjs/component/spec/ScanbotBarcodeScannerViewNativeComponent.js.map +1 -1
- package/lib/module/component/barcode-camera-view/ScanbotBarcodeCameraView.js +4 -31
- package/lib/module/component/barcode-camera-view/ScanbotBarcodeCameraView.js.map +1 -1
- package/lib/module/component/spec/ScanbotBarcodeScannerViewNativeComponent.js +1 -1
- package/lib/module/component/spec/ScanbotBarcodeScannerViewNativeComponent.js.map +1 -1
- package/lib/typescript/src/component/barcode-camera-view/ScanbotBarcodeCameraView.d.ts.map +1 -1
- package/lib/typescript/src/component/barcode-camera-view/ScanbotBarcodeCameraViewProperties.d.ts +1 -19
- package/lib/typescript/src/component/barcode-camera-view/ScanbotBarcodeCameraViewProperties.d.ts.map +1 -1
- package/lib/typescript/src/component/spec/ScanbotBarcodeScannerViewNativeComponent.d.ts +0 -5
- package/lib/typescript/src/component/spec/ScanbotBarcodeScannerViewNativeComponent.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/component/barcode-camera-view/ScanbotBarcodeCameraView.tsx +4 -44
- package/src/component/barcode-camera-view/ScanbotBarcodeCameraViewProperties.ts +1 -19
- package/src/component/spec/ScanbotBarcodeScannerViewNativeComponent.ts +1 -14
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/extensions/BarcodeItemExtensions.kt +0 -8
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
All items and source code Copyright (c)
|
|
1
|
+
All items and source code Copyright (c) 2025 Scanbot SDK GmbH (https://scanbot.io).
|
|
2
2
|
|
|
3
3
|
Scanbot Document and Barcode Scanner SDK for React Native is a commercial
|
|
4
4
|
product and requires a license to be used in a production environment. It will
|
package/Libraries.txt
CHANGED
|
@@ -2749,7 +2749,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
2749
2749
|
|
|
2750
2750
|
------------------------------------------------------------------------------------------------------------------------
|
|
2751
2751
|
|
|
2752
|
-
Open Source libraries used in the Scanbot Barcode Scanner SDK for Android version 6.
|
|
2752
|
+
Open Source libraries used in the Scanbot Barcode Scanner SDK for Android version 6.2.0
|
|
2753
2753
|
CWAC-Camera
|
|
2754
2754
|
|
|
2755
2755
|
Version 0.6.42
|
package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkModule.kt
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package io.scanbot.barcodesdk.plugin.reactnative
|
|
2
2
|
|
|
3
3
|
import android.app.Activity
|
|
4
|
+
import android.app.Application
|
|
4
5
|
import android.content.Intent
|
|
5
6
|
import com.facebook.react.bridge.ActivityEventListener
|
|
6
7
|
import com.facebook.react.bridge.Promise
|
|
@@ -20,7 +21,7 @@ import io.scanbot.sdk_wrapper.barcode.rtuui.SBBRtuUi
|
|
|
20
21
|
import org.json.JSONException
|
|
21
22
|
import org.json.JSONObject
|
|
22
23
|
|
|
23
|
-
class ScanbotBarcodeSdkModule(
|
|
24
|
+
class ScanbotBarcodeSdkModule(reactContext: ReactApplicationContext) :
|
|
24
25
|
ReactContextBaseJavaModule(reactContext), ActivityEventListener {
|
|
25
26
|
|
|
26
27
|
companion object {
|
|
@@ -33,19 +34,22 @@ class ScanbotBarcodeSdkModule(private val reactContext: ReactApplicationContext)
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
@ReactMethod
|
|
36
|
-
fun initializeSdk(configuration: ReadableMap, promise: Promise) =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
) { configurationAsJSON, currentActivity ->
|
|
37
|
+
fun initializeSdk(configuration: ReadableMap, promise: Promise) = runOperationWithJSONParam(
|
|
38
|
+
configuration, promise
|
|
39
|
+
) { configurationAsJSON ->
|
|
40
40
|
|
|
41
|
+
reactApplicationContextIfActiveOrWarn?.let {
|
|
41
42
|
SBBSetupOperations.initializeSdk(
|
|
42
|
-
|
|
43
|
+
it.applicationContext as Application,
|
|
43
44
|
configurationAsJSON,
|
|
44
45
|
ScanbotBarcodeSdkPluginResultDelegate(promise)
|
|
45
46
|
)
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
it.addActivityEventListener(this)
|
|
49
|
+
} ?: run {
|
|
50
|
+
promise.reject("", "React Native Instance has already disappeared.")
|
|
48
51
|
}
|
|
52
|
+
}
|
|
49
53
|
|
|
50
54
|
@ReactMethod
|
|
51
55
|
fun getLicenseInfo(promise: Promise) {
|
|
@@ -105,8 +109,8 @@ class ScanbotBarcodeSdkModule(private val reactContext: ReactApplicationContext)
|
|
|
105
109
|
SBBRtuUi.startBarcodeScanner(
|
|
106
110
|
currentActivity, configurationAsJSON, ScanbotBarcodeSdkPluginResultDelegate(promise)
|
|
107
111
|
) {
|
|
108
|
-
|
|
109
|
-
|
|
112
|
+
reactApplicationContextIfActiveOrWarn?.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
113
|
+
?.emit(BARCODE_ITEM_MAPPER_EVENT, it.toWritableMap())
|
|
110
114
|
}
|
|
111
115
|
} else {
|
|
112
116
|
SBBRtuUi.startBarcodeScanner(
|
|
@@ -190,7 +194,7 @@ class ScanbotBarcodeSdkModule(private val reactContext: ReactApplicationContext)
|
|
|
190
194
|
private fun runOperationWithSafeActivity(
|
|
191
195
|
promise: Promise, operation: (currentActivity: Activity) -> Unit
|
|
192
196
|
) {
|
|
193
|
-
|
|
197
|
+
reactApplicationContext?.currentActivity?.let {
|
|
194
198
|
operation(it)
|
|
195
199
|
} ?: run {
|
|
196
200
|
promise.reject("", "ScanbotBarcodeSdkModule is not attached to activity")
|
|
@@ -211,7 +215,7 @@ class ScanbotBarcodeSdkModule(private val reactContext: ReactApplicationContext)
|
|
|
211
215
|
return
|
|
212
216
|
}
|
|
213
217
|
|
|
214
|
-
|
|
218
|
+
reactApplicationContext?.currentActivity?.let {
|
|
215
219
|
operation(configurationAsJSON, it)
|
|
216
220
|
} ?: run {
|
|
217
221
|
promise.reject("", "ScanbotBarcodeSdkModule is not attached to activity")
|
|
@@ -10,6 +10,7 @@ import android.view.View
|
|
|
10
10
|
import android.view.ViewGroup
|
|
11
11
|
import android.widget.Button
|
|
12
12
|
import android.widget.FrameLayout
|
|
13
|
+
import android.graphics.Color
|
|
13
14
|
import androidx.core.app.ActivityCompat
|
|
14
15
|
import com.facebook.react.bridge.LifecycleEventListener
|
|
15
16
|
import com.facebook.react.bridge.ReactContext
|
|
@@ -18,10 +19,8 @@ import io.scanbot.barcodesdk.plugin.reactnative.components.barcode_scanner_view.
|
|
|
18
19
|
import io.scanbot.barcodesdk.plugin.reactnative.components.barcode_scanner_view.models.CameraConfiguration
|
|
19
20
|
import io.scanbot.barcodesdk.plugin.reactnative.components.barcode_scanner_view.models.FinderViewConfiguration
|
|
20
21
|
import io.scanbot.barcodesdk.plugin.reactnative.components.barcode_scanner_view.models.PolygonStyleConfig
|
|
21
|
-
import io.scanbot.barcodesdk.plugin.reactnative.components.barcode_scanner_view.models.SelectedBarcodes
|
|
22
22
|
import io.scanbot.barcodesdk.plugin.reactnative.components.barcode_scanner_view.models.TextStyleConfig
|
|
23
23
|
import io.scanbot.barcodesdk.plugin.reactnative.extensions.toPx
|
|
24
|
-
import io.scanbot.barcodesdk.plugin.reactnative.extensions.uuid
|
|
25
24
|
import io.scanbot.sdk.barcode.entity.BarcodeItem
|
|
26
25
|
import io.scanbot.sdk.barcode.entity.BarcodeScanningResult
|
|
27
26
|
import io.scanbot.sdk.barcode.ui.BarcodePolygonsView
|
|
@@ -33,6 +32,7 @@ import io.scanbot.sdk.barcode_scanner.ScanbotBarcodeScannerSDK
|
|
|
33
32
|
import io.scanbot.sdk.camera.CaptureInfo
|
|
34
33
|
import io.scanbot.sdk.camera.FrameHandlerResult
|
|
35
34
|
import io.scanbot.sdk.ui.camera.CameraUiSettings
|
|
35
|
+
import io.scanbot.sdk_wrapper.barcode.extensions.uuid
|
|
36
36
|
|
|
37
37
|
class ScanbotBarcodeScannerView(
|
|
38
38
|
context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int
|
|
@@ -58,7 +58,6 @@ class ScanbotBarcodeScannerView(
|
|
|
58
58
|
var flashState: Boolean = INITIAL_FLASH_STATE
|
|
59
59
|
var polygonStyle = PolygonStyleConfig()
|
|
60
60
|
var textStyle = TextStyleConfig()
|
|
61
|
-
var selectedBarcodes: List<SelectedBarcodes> = emptyList()
|
|
62
61
|
|
|
63
62
|
private var cameraPermissionRequested = false
|
|
64
63
|
|
|
@@ -73,25 +72,14 @@ class ScanbotBarcodeScannerView(
|
|
|
73
72
|
?.let { overlayViewConfig ->
|
|
74
73
|
buttonView.text = overlayViewConfig.text
|
|
75
74
|
|
|
76
|
-
//
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
?: textStyle.textContainerHighlightedColor!!
|
|
85
|
-
)
|
|
86
|
-
} else {
|
|
87
|
-
buttonView.setTextColor(
|
|
88
|
-
overlayViewConfig.textColorParsed ?: textStyle.textColor!!
|
|
89
|
-
)
|
|
90
|
-
buttonView.backgroundTintList = ColorStateList.valueOf(
|
|
91
|
-
overlayViewConfig.textContainerColorParsed
|
|
92
|
-
?: textStyle.textContainerColor!!
|
|
93
|
-
)
|
|
94
|
-
}
|
|
75
|
+
// buttonView doesn't use global overlay configuration by default
|
|
76
|
+
buttonView.setTextColor(
|
|
77
|
+
overlayViewConfig.textColorParsed ?: textStyle.textColor!!
|
|
78
|
+
)
|
|
79
|
+
buttonView.backgroundTintList = ColorStateList.valueOf(
|
|
80
|
+
overlayViewConfig.textContainerColorParsed
|
|
81
|
+
?: textStyle.textContainerColor!!
|
|
82
|
+
)
|
|
95
83
|
}
|
|
96
84
|
}
|
|
97
85
|
}
|
|
@@ -119,6 +107,9 @@ class ScanbotBarcodeScannerView(
|
|
|
119
107
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
120
108
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
121
109
|
)
|
|
110
|
+
|
|
111
|
+
setBackgroundColor(Color.BLACK)
|
|
112
|
+
|
|
122
113
|
addView(barcodeScanner)
|
|
123
114
|
}
|
|
124
115
|
|
|
@@ -190,9 +181,9 @@ class ScanbotBarcodeScannerView(
|
|
|
190
181
|
): BarcodePolygonsView.BarcodePolygonStyle {
|
|
191
182
|
return defaultStyle.copy(
|
|
192
183
|
fillColor = PolygonStyleConfig.DEFAULT_FILL_COLOR,
|
|
193
|
-
fillHighlightedColor = PolygonStyleConfig.
|
|
184
|
+
fillHighlightedColor = PolygonStyleConfig.DEFAULT_FILL_COLOR,
|
|
194
185
|
strokeColor = PolygonStyleConfig.DEFAULT_STROKE_COLOR,
|
|
195
|
-
strokeHighlightedColor = PolygonStyleConfig.
|
|
186
|
+
strokeHighlightedColor = PolygonStyleConfig.DEFAULT_STROKE_COLOR
|
|
196
187
|
)
|
|
197
188
|
}
|
|
198
189
|
|
|
@@ -201,22 +192,13 @@ class ScanbotBarcodeScannerView(
|
|
|
201
192
|
): BarcodePolygonsView.BarcodeTextViewStyle {
|
|
202
193
|
return defaultStyle.copy(
|
|
203
194
|
textColor = TextStyleConfig.DEFAULT_TEXT_COLOR,
|
|
204
|
-
textHighlightedColor = TextStyleConfig.
|
|
195
|
+
textHighlightedColor = TextStyleConfig.DEFAULT_TEXT_COLOR,
|
|
205
196
|
textContainerColor = TextStyleConfig.DEFAULT_TEXT_CONTAINER_COLOR,
|
|
206
|
-
textContainerHighlightedColor = TextStyleConfig.
|
|
197
|
+
textContainerHighlightedColor = TextStyleConfig.DEFAULT_TEXT_CONTAINER_COLOR,
|
|
207
198
|
textFormat = TextStyleConfig.DEFAULT_TEXT_FORMAT
|
|
208
199
|
)
|
|
209
200
|
}
|
|
210
201
|
})
|
|
211
|
-
|
|
212
|
-
selectionOverlayController.setBarcodeHighlightedDelegate(object :
|
|
213
|
-
BarcodePolygonsView.BarcodeHighlightDelegate {
|
|
214
|
-
override fun shouldHighlight(barcodeItem: BarcodeItem): Boolean {
|
|
215
|
-
return selectedBarcodes.any {
|
|
216
|
-
it.type == barcodeItem.barcodeFormat && it.textWithExtension == barcodeItem.textWithExtension
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
})
|
|
220
202
|
}
|
|
221
203
|
|
|
222
204
|
override fun onAttachedToWindow() {
|
|
@@ -283,19 +265,19 @@ class ScanbotBarcodeScannerView(
|
|
|
283
265
|
defaultStyle.copy(
|
|
284
266
|
fillColor = overlayViewConfig.polygonColorParsed
|
|
285
267
|
?: polygonStyle.fillColor!!,
|
|
286
|
-
fillHighlightedColor = overlayViewConfig.
|
|
287
|
-
?: polygonStyle.
|
|
268
|
+
fillHighlightedColor = overlayViewConfig.polygonColorParsed
|
|
269
|
+
?: polygonStyle.fillColor!!,
|
|
288
270
|
strokeColor = overlayViewConfig.strokeColorParsed
|
|
289
271
|
?: polygonStyle.strokeColor!!,
|
|
290
|
-
strokeHighlightedColor = overlayViewConfig.
|
|
291
|
-
?: polygonStyle.
|
|
272
|
+
strokeHighlightedColor = overlayViewConfig.strokeColorParsed
|
|
273
|
+
?: polygonStyle.strokeColor!!,
|
|
292
274
|
)
|
|
293
275
|
} ?: run {
|
|
294
276
|
defaultStyle.copy(
|
|
295
277
|
fillColor = polygonStyle.fillColor!!,
|
|
296
|
-
fillHighlightedColor = polygonStyle.
|
|
278
|
+
fillHighlightedColor = polygonStyle.fillColor!!,
|
|
297
279
|
strokeColor = polygonStyle.strokeColor!!,
|
|
298
|
-
strokeHighlightedColor = polygonStyle.
|
|
280
|
+
strokeHighlightedColor = polygonStyle.strokeColor!!,
|
|
299
281
|
)
|
|
300
282
|
}
|
|
301
283
|
}
|
|
@@ -305,9 +287,9 @@ class ScanbotBarcodeScannerView(
|
|
|
305
287
|
): BarcodePolygonsView.BarcodeTextViewStyle {
|
|
306
288
|
return defaultStyle.copy(
|
|
307
289
|
textColor = textStyle.textColor!!,
|
|
308
|
-
textHighlightedColor = textStyle.
|
|
290
|
+
textHighlightedColor = textStyle.textColor!!,
|
|
309
291
|
textContainerColor = textStyle.textContainerColor!!,
|
|
310
|
-
textContainerHighlightedColor = textStyle.
|
|
292
|
+
textContainerHighlightedColor = textStyle.textContainerColor!!,
|
|
311
293
|
textFormat = textStyle.textFormat!!
|
|
312
294
|
)
|
|
313
295
|
}
|
|
@@ -10,13 +10,11 @@ import com.facebook.react.uimanager.ViewManagerDelegate
|
|
|
10
10
|
import com.facebook.react.uimanager.annotations.ReactProp
|
|
11
11
|
import com.facebook.react.viewmanagers.ScanbotBarcodeScannerViewManagerDelegate
|
|
12
12
|
import com.facebook.react.viewmanagers.ScanbotBarcodeScannerViewManagerInterface
|
|
13
|
-
import com.google.gson.reflect.TypeToken
|
|
14
13
|
import io.scanbot.barcodesdk.plugin.reactnative.components.barcode_scanner_view.models.BarcodeItemOverlayViewConfig
|
|
15
14
|
import io.scanbot.barcodesdk.plugin.reactnative.components.barcode_scanner_view.models.CameraConfiguration
|
|
16
15
|
import io.scanbot.barcodesdk.plugin.reactnative.components.barcode_scanner_view.models.DetectorConfig
|
|
17
16
|
import io.scanbot.barcodesdk.plugin.reactnative.components.barcode_scanner_view.models.FinderInsets
|
|
18
17
|
import io.scanbot.barcodesdk.plugin.reactnative.components.barcode_scanner_view.models.FinderViewConfiguration
|
|
19
|
-
import io.scanbot.barcodesdk.plugin.reactnative.components.barcode_scanner_view.models.SelectedBarcodes
|
|
20
18
|
import io.scanbot.barcodesdk.plugin.reactnative.components.barcode_scanner_view.models.ZoomRangeConfig
|
|
21
19
|
import io.scanbot.barcodesdk.plugin.reactnative.extensions.toJSON
|
|
22
20
|
import io.scanbot.barcodesdk.plugin.reactnative.extensions.toPx
|
|
@@ -77,14 +75,6 @@ class ScanbotBarcodeScannerViewManager : SimpleViewManager<ScanbotBarcodeScanner
|
|
|
77
75
|
view.barcodeScanner.viewController.stopPreview()
|
|
78
76
|
}
|
|
79
77
|
|
|
80
|
-
override fun addHighLightedBarcode(view: ScanbotBarcodeScannerView, barcodeItems: String?) {
|
|
81
|
-
barcodeItems?.let {
|
|
82
|
-
val itemType = object : TypeToken<List<SelectedBarcodes>>() {}.type
|
|
83
|
-
|
|
84
|
-
view.selectedBarcodes = SBWrapper.gson.fromJson(it, itemType)
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
78
|
override fun bindBarcodeItemOverlayView(
|
|
89
79
|
view: ScanbotBarcodeScannerView, barcodeItemUuid: String, bindingConfig: String
|
|
90
80
|
) {
|
|
@@ -101,7 +91,6 @@ class ScanbotBarcodeScannerViewManager : SimpleViewManager<ScanbotBarcodeScanner
|
|
|
101
91
|
when (commandId) {
|
|
102
92
|
"freezeCamera" -> freezeCamera(root)
|
|
103
93
|
"unfreezeCamera" -> unfreezeCamera(root)
|
|
104
|
-
"addHighLightedBarcode" -> addHighLightedBarcode(root, args?.getString(0))
|
|
105
94
|
"bindBarcodeItemOverlayView" -> bindBarcodeItemOverlayView(
|
|
106
95
|
root, args!!.getString(0), args.getString(1)
|
|
107
96
|
)
|
|
@@ -272,50 +261,24 @@ class ScanbotBarcodeScannerViewManager : SimpleViewManager<ScanbotBarcodeScanner
|
|
|
272
261
|
view.setOverlayAppearance()
|
|
273
262
|
}
|
|
274
263
|
|
|
275
|
-
@ReactProp(name = "overlayHighlightedStrokeColor", customType = "Color")
|
|
276
|
-
override fun setOverlayHighlightedStrokeColor(view: ScanbotBarcodeScannerView, value: Int?) {
|
|
277
|
-
view.polygonStyle.strokeHighlightedColor = value
|
|
278
|
-
view.setOverlayAppearance()
|
|
279
|
-
}
|
|
280
|
-
|
|
281
264
|
@ReactProp(name = "overlayPolygonColor", customType = "Color")
|
|
282
265
|
override fun setOverlayPolygonColor(view: ScanbotBarcodeScannerView, value: Int?) {
|
|
283
266
|
view.polygonStyle.fillColor = value
|
|
284
267
|
view.setOverlayAppearance()
|
|
285
268
|
}
|
|
286
269
|
|
|
287
|
-
@ReactProp(name = "overlayHighlightedPolygonColor", customType = "Color")
|
|
288
|
-
override fun setOverlayHighlightedPolygonColor(view: ScanbotBarcodeScannerView, value: Int?) {
|
|
289
|
-
view.polygonStyle.fillHighlightedColor = value
|
|
290
|
-
view.setOverlayAppearance()
|
|
291
|
-
}
|
|
292
|
-
|
|
293
270
|
@ReactProp(name = "overlayTextColor", customType = "Color")
|
|
294
271
|
override fun setOverlayTextColor(view: ScanbotBarcodeScannerView, value: Int?) {
|
|
295
272
|
view.textStyle.textColor = value
|
|
296
273
|
view.setOverlayAppearance()
|
|
297
274
|
}
|
|
298
275
|
|
|
299
|
-
@ReactProp(name = "overlayHighlightedTextColor", customType = "Color")
|
|
300
|
-
override fun setOverlayHighlightedTextColor(view: ScanbotBarcodeScannerView, value: Int?) {
|
|
301
|
-
view.textStyle.textHighlightedColor = value
|
|
302
|
-
view.setOverlayAppearance()
|
|
303
|
-
}
|
|
304
|
-
|
|
305
276
|
@ReactProp(name = "overlayTextContainerColor", customType = "Color")
|
|
306
277
|
override fun setOverlayTextContainerColor(view: ScanbotBarcodeScannerView, value: Int?) {
|
|
307
278
|
view.textStyle.textContainerColor = value
|
|
308
279
|
view.setOverlayAppearance()
|
|
309
280
|
}
|
|
310
281
|
|
|
311
|
-
@ReactProp(name = "overlayHighlightedTextContainerColor", customType = "Color")
|
|
312
|
-
override fun setOverlayHighlightedTextContainerColor(
|
|
313
|
-
view: ScanbotBarcodeScannerView, value: Int?
|
|
314
|
-
) {
|
|
315
|
-
view.textStyle.textContainerHighlightedColor = value
|
|
316
|
-
view.setOverlayAppearance()
|
|
317
|
-
}
|
|
318
|
-
|
|
319
282
|
@ReactProp(name = "overlayTextFormat")
|
|
320
283
|
override fun setOverlayTextFormat(view: ScanbotBarcodeScannerView, value: String?) {
|
|
321
284
|
view.textStyle.textFormat =
|
|
@@ -6,7 +6,6 @@ import io.scanbot.barcodesdk.plugin.reactnative.extensions.Utils
|
|
|
6
6
|
import io.scanbot.sdk.AspectRatio
|
|
7
7
|
import io.scanbot.sdk.barcode.entity.BarcodeDocumentFormat
|
|
8
8
|
import io.scanbot.sdk.barcode.entity.BarcodeFormat
|
|
9
|
-
import io.scanbot.sdk.barcode.entity.BarcodeItem
|
|
10
9
|
import io.scanbot.sdk.barcode.entity.EngineMode
|
|
11
10
|
import io.scanbot.sdk.barcode.entity.Gs1Handling
|
|
12
11
|
import io.scanbot.sdk.barcode.entity.MSIPlesseyChecksumAlgorithm
|
|
@@ -33,29 +32,19 @@ data class DetectorConfig(
|
|
|
33
32
|
|
|
34
33
|
class PolygonStyleConfig(
|
|
35
34
|
strokeColor: Int? = null,
|
|
36
|
-
strokeHighlightedColor: Int? = null,
|
|
37
35
|
fillColor: Int? = null,
|
|
38
|
-
fillHighlightedColor: Int? = null
|
|
39
36
|
) {
|
|
40
37
|
companion object {
|
|
41
38
|
val DEFAULT_STROKE_COLOR = Color.parseColor("#CC00CFA6")
|
|
42
|
-
val DEFAULT_STROKE_HIGHLIGHTED_COLOR = Color.parseColor("#CCC81A3C")
|
|
43
39
|
val DEFAULT_FILL_COLOR = Color.parseColor("#3300CFA6")
|
|
44
|
-
val DEFAULT_FILL_HIGHLIGHTED_COLOR = Color.parseColor("#33C81A3C")
|
|
45
40
|
}
|
|
46
41
|
|
|
47
42
|
var strokeColor: Int? = strokeColor
|
|
48
43
|
get() = field ?: DEFAULT_STROKE_COLOR
|
|
49
44
|
|
|
50
|
-
var strokeHighlightedColor: Int? = strokeHighlightedColor
|
|
51
|
-
get() = field ?: DEFAULT_STROKE_HIGHLIGHTED_COLOR
|
|
52
|
-
|
|
53
45
|
var fillColor: Int? = fillColor
|
|
54
46
|
get() = field ?: DEFAULT_FILL_COLOR
|
|
55
47
|
|
|
56
|
-
var fillHighlightedColor: Int? = fillHighlightedColor
|
|
57
|
-
get() = field ?: DEFAULT_FILL_HIGHLIGHTED_COLOR
|
|
58
|
-
|
|
59
48
|
override fun equals(other: Any?): Boolean {
|
|
60
49
|
if (this === other) return true
|
|
61
50
|
if (javaClass != other?.javaClass) return false
|
|
@@ -63,49 +52,35 @@ class PolygonStyleConfig(
|
|
|
63
52
|
other as PolygonStyleConfig
|
|
64
53
|
|
|
65
54
|
if (strokeColor != other.strokeColor) return false
|
|
66
|
-
if (strokeHighlightedColor != other.strokeHighlightedColor) return false
|
|
67
55
|
if (fillColor != other.fillColor) return false
|
|
68
|
-
if (fillHighlightedColor != other.fillHighlightedColor) return false
|
|
69
56
|
|
|
70
57
|
return true
|
|
71
58
|
}
|
|
72
59
|
|
|
73
60
|
override fun hashCode(): Int {
|
|
74
61
|
var result = strokeColor ?: 0
|
|
75
|
-
result = 31 * result + (strokeHighlightedColor ?: 0)
|
|
76
62
|
result = 31 * result + (fillColor ?: 0)
|
|
77
|
-
result = 31 * result + (fillHighlightedColor ?: 0)
|
|
78
63
|
return result
|
|
79
64
|
}
|
|
80
65
|
}
|
|
81
66
|
|
|
82
67
|
class TextStyleConfig(
|
|
83
68
|
textColor: Int? = null,
|
|
84
|
-
textHighlightedColor: Int? = null,
|
|
85
69
|
textContainerColor: Int? = null,
|
|
86
|
-
textContainerHighlightedColor: Int? = null,
|
|
87
70
|
textFormat: BarcodeOverlayTextFormat? = null
|
|
88
71
|
) {
|
|
89
72
|
companion object {
|
|
90
73
|
const val DEFAULT_TEXT_COLOR = Color.BLACK
|
|
91
|
-
const val DEFAULT_TEXT_HIGHLIGHTED_COLOR = Color.WHITE
|
|
92
74
|
val DEFAULT_TEXT_CONTAINER_COLOR = Color.parseColor("#CC00CFA6")
|
|
93
|
-
val DEFAULT_TEXT_CONTAINER_HIGHLIGHTED_COLOR = Color.parseColor("#CCC81A3C")
|
|
94
75
|
val DEFAULT_TEXT_FORMAT = BarcodeOverlayTextFormat.CODE_AND_TYPE
|
|
95
76
|
}
|
|
96
77
|
|
|
97
78
|
var textColor: Int? = textColor
|
|
98
79
|
get() = field ?: DEFAULT_TEXT_COLOR
|
|
99
80
|
|
|
100
|
-
var textHighlightedColor: Int? = textHighlightedColor
|
|
101
|
-
get() = field ?: DEFAULT_TEXT_HIGHLIGHTED_COLOR
|
|
102
|
-
|
|
103
81
|
var textContainerColor: Int? = textContainerColor
|
|
104
82
|
get() = field ?: DEFAULT_TEXT_CONTAINER_COLOR
|
|
105
83
|
|
|
106
|
-
var textContainerHighlightedColor: Int? = textContainerHighlightedColor
|
|
107
|
-
get() = field ?: DEFAULT_TEXT_CONTAINER_HIGHLIGHTED_COLOR
|
|
108
|
-
|
|
109
84
|
var textFormat: BarcodeOverlayTextFormat? = textFormat
|
|
110
85
|
get() = field ?: DEFAULT_TEXT_FORMAT
|
|
111
86
|
|
|
@@ -116,9 +91,7 @@ class TextStyleConfig(
|
|
|
116
91
|
other as TextStyleConfig
|
|
117
92
|
|
|
118
93
|
if (textColor != other.textColor) return false
|
|
119
|
-
if (textHighlightedColor != other.textHighlightedColor) return false
|
|
120
94
|
if (textContainerColor != other.textContainerColor) return false
|
|
121
|
-
if (textContainerHighlightedColor != other.textContainerHighlightedColor) return false
|
|
122
95
|
if (textFormat != other.textFormat) return false
|
|
123
96
|
|
|
124
97
|
return true
|
|
@@ -126,9 +99,7 @@ class TextStyleConfig(
|
|
|
126
99
|
|
|
127
100
|
override fun hashCode(): Int {
|
|
128
101
|
var result = textColor ?: 0
|
|
129
|
-
result = 31 * result + (textHighlightedColor ?: 0)
|
|
130
102
|
result = 31 * result + (textContainerColor ?: 0)
|
|
131
|
-
result = 31 * result + (textContainerHighlightedColor ?: 0)
|
|
132
103
|
result = 31 * result + (textFormat?.hashCode() ?: 0)
|
|
133
104
|
return result
|
|
134
105
|
}
|
|
@@ -148,11 +119,6 @@ object CameraConfiguration {
|
|
|
148
119
|
val DEFAULT_ZOOM_RANGE = ZoomRange(1f, 12f)
|
|
149
120
|
}
|
|
150
121
|
|
|
151
|
-
@Keep
|
|
152
|
-
data class SelectedBarcodes(
|
|
153
|
-
val textWithExtension: String, val type: BarcodeFormat
|
|
154
|
-
)
|
|
155
|
-
|
|
156
122
|
@Keep
|
|
157
123
|
data class ZoomRangeConfig(
|
|
158
124
|
var minZoom: Float,
|
|
@@ -169,12 +135,8 @@ data class BarcodeItemOverlayViewConfig(
|
|
|
169
135
|
var text: String? = null,
|
|
170
136
|
var textColor: String? = null,
|
|
171
137
|
var textContainerColor: String? = null,
|
|
172
|
-
var highlightedTextColor: String? = null,
|
|
173
|
-
var highlightedTextContainerColor: String? = null,
|
|
174
138
|
var polygonColor: String? = null,
|
|
175
139
|
var strokeColor: String? = null,
|
|
176
|
-
var highlightedPolygonColor: String? = null,
|
|
177
|
-
var highlightedStrokeColor: String? = null
|
|
178
140
|
) {
|
|
179
141
|
|
|
180
142
|
val textColorParsed: Int?
|
|
@@ -183,24 +145,12 @@ data class BarcodeItemOverlayViewConfig(
|
|
|
183
145
|
val textContainerColorParsed: Int?
|
|
184
146
|
get() = textContainerColor?.let { Utils.tryToParseRGBAHexColor(it) }
|
|
185
147
|
|
|
186
|
-
val highlightedTextColorParsed: Int?
|
|
187
|
-
get() = highlightedTextColor?.let { Utils.tryToParseRGBAHexColor(it) }
|
|
188
|
-
|
|
189
|
-
val highlightedTextContainerColorParsed: Int?
|
|
190
|
-
get() = highlightedTextContainerColor?.let { Utils.tryToParseRGBAHexColor(it) }
|
|
191
|
-
|
|
192
148
|
val polygonColorParsed: Int?
|
|
193
149
|
get() = polygonColor?.let { Utils.tryToParseRGBAHexColor(it) }
|
|
194
150
|
|
|
195
151
|
val strokeColorParsed: Int?
|
|
196
152
|
get() = strokeColor?.let { Utils.tryToParseRGBAHexColor(it) }
|
|
197
153
|
|
|
198
|
-
val highlightedPolygonColorParsed: Int?
|
|
199
|
-
get() = highlightedPolygonColor?.let { Utils.tryToParseRGBAHexColor(it) }
|
|
200
|
-
|
|
201
|
-
val highlightedStrokeColorParsed: Int?
|
|
202
|
-
get() = highlightedStrokeColor?.let { Utils.tryToParseRGBAHexColor(it) }
|
|
203
|
-
|
|
204
154
|
companion object {
|
|
205
155
|
var LOADING_TEXT: String? = null
|
|
206
156
|
}
|
package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/extensions/ReadableMap.kt
CHANGED
|
@@ -40,8 +40,8 @@ fun ReadableArray.toJSONArray(): JSONArray {
|
|
|
40
40
|
ReadableType.Boolean -> jsonResult.put(this.getBoolean(i))
|
|
41
41
|
ReadableType.Number -> jsonResult.put(this.getDouble(i))
|
|
42
42
|
ReadableType.String -> jsonResult.put(this.getString(i))
|
|
43
|
-
ReadableType.Map -> jsonResult.put(this.getMap(i)
|
|
44
|
-
ReadableType.Array -> jsonResult.put(this.getArray(i)
|
|
43
|
+
ReadableType.Map -> jsonResult.put(this.getMap(i)?.toJSON())
|
|
44
|
+
ReadableType.Array -> jsonResult.put(this.getArray(i)?.toJSONArray())
|
|
45
45
|
ReadableType.Null -> {
|
|
46
46
|
jsonResult.put(JSONObject.NULL)
|
|
47
47
|
}
|
|
@@ -75,24 +75,12 @@ public class ScanbotBarcodeScannerViewManagerDelegate<T extends View, U extends
|
|
|
75
75
|
case "overlayStrokeColor":
|
|
76
76
|
mViewManager.setOverlayStrokeColor(view, ColorPropConverter.getColor(value, view.getContext()));
|
|
77
77
|
break;
|
|
78
|
-
case "overlayHighlightedPolygonColor":
|
|
79
|
-
mViewManager.setOverlayHighlightedPolygonColor(view, ColorPropConverter.getColor(value, view.getContext()));
|
|
80
|
-
break;
|
|
81
|
-
case "overlayHighlightedStrokeColor":
|
|
82
|
-
mViewManager.setOverlayHighlightedStrokeColor(view, ColorPropConverter.getColor(value, view.getContext()));
|
|
83
|
-
break;
|
|
84
78
|
case "overlayTextColor":
|
|
85
79
|
mViewManager.setOverlayTextColor(view, ColorPropConverter.getColor(value, view.getContext()));
|
|
86
80
|
break;
|
|
87
81
|
case "overlayTextContainerColor":
|
|
88
82
|
mViewManager.setOverlayTextContainerColor(view, ColorPropConverter.getColor(value, view.getContext()));
|
|
89
83
|
break;
|
|
90
|
-
case "overlayHighlightedTextColor":
|
|
91
|
-
mViewManager.setOverlayHighlightedTextColor(view, ColorPropConverter.getColor(value, view.getContext()));
|
|
92
|
-
break;
|
|
93
|
-
case "overlayHighlightedTextContainerColor":
|
|
94
|
-
mViewManager.setOverlayHighlightedTextContainerColor(view, ColorPropConverter.getColor(value, view.getContext()));
|
|
95
|
-
break;
|
|
96
84
|
case "overlayTextFormat":
|
|
97
85
|
mViewManager.setOverlayTextFormat(view, value == null ? "CODE_AND_TYPE" : (String) value);
|
|
98
86
|
break;
|
|
@@ -116,9 +104,6 @@ public class ScanbotBarcodeScannerViewManagerDelegate<T extends View, U extends
|
|
|
116
104
|
case "unfreezeCamera":
|
|
117
105
|
mViewManager.unfreezeCamera(view);
|
|
118
106
|
break;
|
|
119
|
-
case "addHighLightedBarcode":
|
|
120
|
-
mViewManager.addHighLightedBarcode(view, args.getString(0));
|
|
121
|
-
break;
|
|
122
107
|
case "bindBarcodeItemOverlayView":
|
|
123
108
|
mViewManager.bindBarcodeItemOverlayView(view, args.getString(0), args.getString(1));
|
|
124
109
|
break;
|
|
@@ -31,17 +31,12 @@ public interface ScanbotBarcodeScannerViewManagerInterface<T extends View> {
|
|
|
31
31
|
void setOverlayEnabled(T view, boolean value);
|
|
32
32
|
void setOverlayPolygonColor(T view, @Nullable Integer value);
|
|
33
33
|
void setOverlayStrokeColor(T view, @Nullable Integer value);
|
|
34
|
-
void setOverlayHighlightedPolygonColor(T view, @Nullable Integer value);
|
|
35
|
-
void setOverlayHighlightedStrokeColor(T view, @Nullable Integer value);
|
|
36
34
|
void setOverlayTextColor(T view, @Nullable Integer value);
|
|
37
35
|
void setOverlayTextContainerColor(T view, @Nullable Integer value);
|
|
38
|
-
void setOverlayHighlightedTextColor(T view, @Nullable Integer value);
|
|
39
|
-
void setOverlayHighlightedTextContainerColor(T view, @Nullable Integer value);
|
|
40
36
|
void setOverlayTextFormat(T view, @Nullable String value);
|
|
41
37
|
void setOverlayLoadingTextValue(T view, @Nullable String value);
|
|
42
38
|
void setOverlayBarcodeItemOverlayViewBinder(T view, boolean value);
|
|
43
39
|
void freezeCamera(T view);
|
|
44
40
|
void unfreezeCamera(T view);
|
|
45
|
-
void addHighLightedBarcode(T view, String barcodeItem);
|
|
46
41
|
void bindBarcodeItemOverlayView(T view, String barcodeItemUuid, String bindingConfig);
|
|
47
42
|
}
|
|
@@ -15,11 +15,8 @@
|
|
|
15
15
|
@property (nonatomic, copy) RCTDirectEventBlock onBarcodeScannerResult;
|
|
16
16
|
@property (nonatomic, copy) RCTDirectEventBlock onSelectBarcodeResult;
|
|
17
17
|
|
|
18
|
-
@property (nonatomic, copy) NSMutableSet *selectedBarcodes;
|
|
19
|
-
|
|
20
18
|
- (void) freezeCamera;
|
|
21
19
|
- (void) unfreezeCamera;
|
|
22
|
-
- (void) addHighlightedBarcode:(NSString *)barcodesJSON;
|
|
23
20
|
- (void) bindBarcodeItemOverlayView:(nonnull NSString *)barcodeItemUuid bindingConfig:(nonnull NSString *)bindingConfigJson;
|
|
24
21
|
@end
|
|
25
22
|
|