scandit-capacitor-datacapture-label 8.0.0-beta.1

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/Package.swift ADDED
@@ -0,0 +1,48 @@
1
+ // swift-tools-version: 5.9
2
+ import PackageDescription
3
+ import Foundation
4
+
5
+ // Read version from package.json
6
+ func getVersion() -> String {
7
+ let packageJSONPath = Context.packageDirectory + "/package.json"
8
+ guard let data = try? Data(contentsOf: URL(fileURLWithPath: packageJSONPath)),
9
+ let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
10
+ let version = json["version"] as? String else {
11
+ fatalError("Could not read version from package.json at \(packageJSONPath)")
12
+ }
13
+ return version
14
+ }
15
+
16
+ let version = getVersion()
17
+
18
+ let package = Package(
19
+ name: "ScanditCapacitorDatacaptureLabel",
20
+ platforms: [.iOS(.v15)],
21
+ products: [
22
+ .library(
23
+ name: "ScanditCapacitorDatacaptureLabel",
24
+ targets: ["ScanditCapacitorLabel"])
25
+ ],
26
+ dependencies: [
27
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"),
28
+ .package(url: "https://github.com/Scandit/scandit-capacitor-datacapture-core.git", exact: Version(stringLiteral: version)),
29
+ .package(url: "https://github.com/Scandit/scandit-capacitor-datacapture-barcode.git", exact: Version(stringLiteral: version)),
30
+ .package(url: "https://github.com/Scandit/scandit-datacapture-frameworks-label.git", exact: Version(stringLiteral: version)),
31
+ ],
32
+ targets: [
33
+ .target(
34
+ name: "ScanditCapacitorLabel",
35
+ dependencies: [
36
+ .product(name: "Capacitor", package: "capacitor-swift-pm"),
37
+ .product(name: "Cordova", package: "capacitor-swift-pm"),
38
+ .product(name: "ScanditCapacitorDatacaptureCore", package: "scandit-capacitor-datacapture-core"),
39
+ .product(name: "ScanditCapacitorDatacaptureBarcode", package: "scandit-capacitor-datacapture-barcode"),
40
+ .product(name: "ScanditFrameworksLabel", package: "scandit-datacapture-frameworks-label"),
41
+ ],
42
+ path: "ios/Sources/ScanditCapacitorLabel"),
43
+ .testTarget(
44
+ name: "ScanditCapacitorLabelTests",
45
+ dependencies: ["ScanditCapacitorLabel"],
46
+ path: "ios/Tests/ScanditCapacitorLabelTests")
47
+ ]
48
+ )
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ ScanditLabel implements the label capture capabilities of the Scandit Data Capture SDK. It supports capturing and processing various label types and formats.
2
+
3
+ Learn more with the [official documentation](https://docs.scandit.com/) or get started with [our samples](https://github.com/Scandit/datacapture-capacitor-samples)
@@ -0,0 +1,22 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+ version = package["version"]
5
+
6
+ Pod::Spec.new do |s|
7
+ s.name = 'ScanditCapacitorDatacaptureLabel'
8
+ s.version = version
9
+ s.summary = package["description"]
10
+ s.license = package["license"]
11
+ s.homepage = package["repository"]["url"]
12
+ s.author = package["author"]
13
+ s.source = { :git => package["repository"]["url"], :tag => s.version.to_s }
14
+ s.source_files = "ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}"
15
+ s.ios.deployment_target = "15.0"
16
+ s.swift_version = "5.7"
17
+
18
+ s.dependency "Capacitor"
19
+ s.dependency "ScanditCapacitorDatacaptureCore", "= #{version}"
20
+ s.dependency "ScanditCapacitorDatacaptureBarcode", "= #{version}"
21
+ s.dependency "scandit-datacapture-frameworks-label", '= 8.0.0-beta.1'
22
+ end
@@ -0,0 +1,114 @@
1
+ ext {
2
+ androidxCoreVersion = project.hasProperty('androidxCoreVersion') ? rootProject.ext.androidxCoreVersion : '1.10.0'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
4
+ cordovaAndroidVersion = project.hasProperty('cordovaAndroidVersion') ? rootProject.ext.cordovaAndroidVersion : '10.1.1'
5
+ }
6
+
7
+ def safeExtGet(prop, fallback) {
8
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
9
+ }
10
+
11
+ buildscript {
12
+ def retrieveCapacitorCompatibility = {
13
+ def appModule = rootProject.findProject(":app")
14
+ if (appModule == null) {
15
+ return
16
+ }
17
+
18
+ def file = appModule.file("capacitor.build.gradle")
19
+ if (file.exists()) {
20
+ def content = file.text
21
+
22
+ def sourceCompatibilityMatch = content =~ /sourceCompatibility\s+JavaVersion.VERSION_(\d+)/
23
+ def targetCompatibilityMatch = content =~ /targetCompatibility\s+JavaVersion.VERSION_(\d+)/
24
+
25
+ if (sourceCompatibilityMatch) {
26
+ ext.rootSourceCompatibility = JavaVersion.toVersion(sourceCompatibilityMatch[0][1])
27
+ } else {
28
+ ext.rootSourceCompatibility = JavaVersion.VERSION_17
29
+ }
30
+
31
+ if (targetCompatibilityMatch) {
32
+ ext.rootTargetCompatibility = JavaVersion.toVersion(targetCompatibilityMatch[0][1])
33
+ } else {
34
+ ext.rootTargetCompatibility = JavaVersion.VERSION_17
35
+ }
36
+
37
+ if (ext.rootTargetCompatibility == JavaVersion.VERSION_21) {
38
+ ext.kotlin_version = "1.9.25"
39
+ ext.agp_version = "8.7.2"
40
+ }
41
+ }
42
+ }
43
+
44
+ ext {
45
+ kotlin_version = "1.9.25"
46
+ agp_version = "8.5.2"
47
+ rootSourceCompatibility = JavaVersion.VERSION_17
48
+ rootTargetCompatibility = JavaVersion.VERSION_17
49
+ }
50
+
51
+ repositories {
52
+ google()
53
+ mavenCentral()
54
+ }
55
+
56
+ dependencies {
57
+ classpath "com.android.tools.build:gradle:$agp_version"
58
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
59
+ }
60
+
61
+ retrieveCapacitorCompatibility()
62
+ }
63
+
64
+ apply plugin: 'com.android.library'
65
+ apply plugin: 'kotlin-android'
66
+
67
+ android {
68
+ namespace "com.scandit.capacitor.datacapture.barcode"
69
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
70
+ defaultConfig {
71
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
72
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
73
+ versionCode 1
74
+ versionName "1.0"
75
+ }
76
+ buildTypes {
77
+ release {
78
+ minifyEnabled false
79
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
80
+ }
81
+ }
82
+ lintOptions {
83
+ abortOnError false
84
+ }
85
+ compileOptions {
86
+ sourceCompatibility = rootSourceCompatibility
87
+ targetCompatibility = rootTargetCompatibility
88
+ }
89
+ }
90
+
91
+ repositories {
92
+ google()
93
+ mavenCentral()
94
+ }
95
+
96
+ dependencies {
97
+ def sdk_version = "8.0.0-beta.1"
98
+
99
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
100
+ implementation fileTree(dir: 'library', include: ['*.aar'])
101
+ implementation project(':capacitor-android')
102
+
103
+ implementation project(':scandit-capacitor-datacapture-core')
104
+ implementation project(':scandit-capacitor-datacapture-barcode')
105
+ println("Version of the native sdk used in this build: ${safeExtGet('global_sdk_version', sdk_version)}")
106
+ if (findProject(':scandit-datacapture-frameworks-label') != null) {
107
+ api project(":scandit-datacapture-frameworks-label")
108
+ } else {
109
+ api "com.scandit.datacapture.frameworks:label:${safeExtGet('global_sdk_version', sdk_version)}"
110
+ }
111
+
112
+ implementation "androidx.core:core-ktx:$androidxCoreVersion"
113
+ implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
114
+ }
@@ -0,0 +1,429 @@
1
+ /*
2
+ * This file is part of the Scandit Data Capture SDK
3
+ *
4
+ * Copyright (C) 2025- Scandit AG. All rights reserved.
5
+ */
6
+ package com.scandit.capacitor.datacapture.label
7
+
8
+ import android.Manifest
9
+ import android.view.View
10
+ import android.view.ViewGroup
11
+ import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
12
+ import android.widget.ImageView
13
+ import com.getcapacitor.JSObject
14
+ import com.getcapacitor.PermissionState
15
+ import com.getcapacitor.Plugin
16
+ import com.getcapacitor.PluginCall
17
+ import com.getcapacitor.PluginHandle
18
+ import com.getcapacitor.PluginMethod
19
+ import com.getcapacitor.annotation.CapacitorPlugin
20
+ import com.getcapacitor.annotation.Permission
21
+ import com.getcapacitor.annotation.PermissionCallback
22
+ import com.scandit.capacitor.datacapture.barcode.utils.SerializableAdvancedOverlayView
23
+ import com.scandit.capacitor.datacapture.barcode.utils.SerializableAdvancedOverlayViewData
24
+ import com.scandit.capacitor.datacapture.core.ScanditCaptureCoreNative
25
+ import com.scandit.capacitor.datacapture.core.errors.JsonParseError
26
+ import com.scandit.capacitor.datacapture.core.utils.CapacitorResult
27
+ import com.scandit.datacapture.frameworks.core.context.data.toMap
28
+ import com.scandit.datacapture.frameworks.core.events.Emitter
29
+ import com.scandit.datacapture.frameworks.core.extensions.DATA_CAPTURE_VIEW_ID_KEY
30
+ import com.scandit.datacapture.frameworks.core.ui.ViewFromJsonResolver
31
+ import com.scandit.datacapture.frameworks.core.utils.DefaultFrameworksLog
32
+ import com.scandit.datacapture.frameworks.core.utils.DefaultMainThread
33
+ import com.scandit.datacapture.frameworks.core.utils.DefaultWorkerThread
34
+ import com.scandit.datacapture.frameworks.core.utils.FrameworksLog
35
+ import com.scandit.datacapture.frameworks.core.utils.MainThread
36
+ import com.scandit.datacapture.frameworks.core.utils.WorkerThread
37
+ import com.scandit.datacapture.frameworks.core.utils.getBitmapFromBase64EncodedViewData
38
+ import com.scandit.datacapture.frameworks.label.LabelCaptureModule
39
+ import org.json.JSONException
40
+ import org.json.JSONObject
41
+
42
+ @CapacitorPlugin(
43
+ name = "ScanditLabelNative",
44
+ permissions = [
45
+ Permission(strings = [Manifest.permission.CAMERA], alias = "camera")
46
+ ]
47
+ )
48
+ class ScanditLabelNative : Plugin(), Emitter {
49
+
50
+ companion object {
51
+ private const val FIELD_RESULT = "result"
52
+ private const val CORE_PLUGIN_NAME = "ScanditCaptureCoreNative"
53
+ private const val WRONG_INPUT = "Wrong input parameter"
54
+ }
55
+
56
+ private var corePlugin: PluginHandle? = null
57
+ private val labelModule = LabelCaptureModule.create(this)
58
+ private val logger: FrameworksLog = DefaultFrameworksLog.getInstance()
59
+ private val workerThread: WorkerThread = DefaultWorkerThread.getInstance()
60
+ private val mainThread: MainThread = DefaultMainThread.getInstance()
61
+
62
+ override fun load() {
63
+ super.load()
64
+
65
+ // We need to register the plugin with its Core dependency for serializers to load.
66
+ corePlugin = bridge.getPlugin(CORE_PLUGIN_NAME)
67
+ if (corePlugin != null) {
68
+ (corePlugin!!.instance as ScanditCaptureCoreNative).registerPluginInstance(
69
+ pluginHandle.instance
70
+ )
71
+ } else {
72
+ logger.error("Core not found")
73
+ }
74
+
75
+ labelModule.onCreate(context)
76
+ }
77
+
78
+ override fun handleOnDestroy() {
79
+ labelModule.onDestroy()
80
+ }
81
+
82
+ private fun checkCameraPermission(): Boolean =
83
+ getPermissionState("camera") == PermissionState.GRANTED
84
+
85
+ private fun checkOrRequestCameraPermissions(call: PluginCall) {
86
+ if (!checkCameraPermission()) {
87
+ requestPermissionForAlias("camera", call, "onCameraPermissionResult")
88
+ } else {
89
+ onCameraPermissionResult(call)
90
+ }
91
+ }
92
+
93
+ @Suppress("unused")
94
+ @PermissionCallback
95
+ private fun onCameraPermissionResult(call: PluginCall) {
96
+ if (checkCameraPermission()) {
97
+ call.resolve()
98
+ return
99
+ }
100
+
101
+ call.reject("Camera permissions not granted.")
102
+ }
103
+
104
+ @PluginMethod
105
+ fun getDefaults(call: PluginCall) {
106
+ val defaults = JSObject.fromJSONObject(
107
+ JSONObject(
108
+ mapOf<String, Any?>(
109
+ "LabelCapture" to labelModule.getDefaults()
110
+ )
111
+ )
112
+ )
113
+ call.resolve(defaults)
114
+ }
115
+
116
+ @PluginMethod
117
+ fun registerListenerForEvents(call: PluginCall) {
118
+ labelModule.addListener(getModeId(call))
119
+ call.resolve()
120
+ }
121
+
122
+ @PluginMethod
123
+ fun unregisterListenerForEvents(call: PluginCall) {
124
+ labelModule.removeListener(getModeId(call))
125
+ call.resolve()
126
+ }
127
+
128
+ @PluginMethod
129
+ fun finishDidUpdateSessionCallback(call: PluginCall) {
130
+ labelModule.finishDidUpdateSession(getModeId(call), call.data.getBoolean("isEnabled"))
131
+ call.resolve()
132
+ }
133
+
134
+ @PluginMethod
135
+ fun updateLabelCaptureFeedback(call: PluginCall) {
136
+ val modeId = getModeId(call)
137
+ val feedbackJson = call.data.getString("feedbackJson")
138
+ ?: return call.reject(WRONG_INPUT)
139
+ labelModule.updateLabelCaptureFeedback(modeId, feedbackJson, CapacitorResult(call))
140
+ }
141
+
142
+ @PluginMethod
143
+ fun setModeEnabledState(call: PluginCall) {
144
+ labelModule.setModeEnabled(getModeId(call), call.data.getBoolean("isEnabled"))
145
+ call.resolve()
146
+ }
147
+
148
+ @PluginMethod
149
+ fun updateLabelCaptureSettings(call: PluginCall) {
150
+ val modeId = getModeId(call)
151
+ val settingsJson = call.data.getString("settingsJson")
152
+ ?: return call.reject(WRONG_INPUT)
153
+ labelModule.applyModeSettings(modeId, settingsJson, CapacitorResult(call))
154
+ }
155
+
156
+ // Advanced Overlay Methods
157
+ @PluginMethod
158
+ fun setViewForCapturedLabel(call: PluginCall) {
159
+ val dataCaptureViewId = getDataCaptureViewId(call)
160
+ val trackingId = call.data.getInt("trackingId")
161
+ val viewJson = call.data.getString("jsonView") ?: return call.reject(WRONG_INPUT)
162
+ try {
163
+ mainThread.runOnMainThread {
164
+ labelModule.setViewForCapturedLabel(
165
+ dataCaptureViewId,
166
+ viewJson,
167
+ trackingId,
168
+ viewFromJsonResolver = object : ViewFromJsonResolver {
169
+ override fun getView(viewJson: String): View? {
170
+ val imageData =
171
+ SerializableAdvancedOverlayView.fromJson(JSONObject(viewJson))
172
+
173
+ if (imageData == null) {
174
+ call.reject(WRONG_INPUT)
175
+ return null
176
+ }
177
+
178
+ return ImageView(context).also {
179
+ it.setImageBitmap(getBitmapFromBase64EncodedViewData(imageData.data))
180
+ it.layoutParams = ViewGroup.MarginLayoutParams(
181
+ imageData.options.width,
182
+ imageData.options.height
183
+ )
184
+ }
185
+ }
186
+
187
+ },
188
+ result = CapacitorResult(call)
189
+ )
190
+ }
191
+ } catch (e: JSONException) {
192
+ call.reject(JsonParseError(e.message).toString())
193
+ } catch (e: RuntimeException) {
194
+ call.reject(JsonParseError(e.message).toString())
195
+ }
196
+
197
+ call.resolve()
198
+ }
199
+
200
+ @PluginMethod
201
+ fun setAnchorForCapturedLabel(call: PluginCall) {
202
+ val dataCaptureViewId = getDataCaptureViewId(call)
203
+ val anchor = call.data.getString("anchor")
204
+ ?: return call.reject(WRONG_INPUT)
205
+ val trackingId = call.data.getInt("trackingId")
206
+ labelModule.setAnchorForCapturedLabel(
207
+ dataCaptureViewId,
208
+ anchor,
209
+ trackingId,
210
+ CapacitorResult(call)
211
+ )
212
+ }
213
+
214
+ @PluginMethod
215
+ fun setOffsetForCapturedLabel(call: PluginCall) {
216
+ val dataCaptureViewId = getDataCaptureViewId(call)
217
+ val offsetJson = call.data.getString("offsetJson")
218
+ ?: return call.reject(WRONG_INPUT)
219
+ val trackingId = call.data.getInt("trackingId")
220
+ labelModule.setOffsetForCapturedLabel(
221
+ dataCaptureViewId,
222
+ offsetJson,
223
+ trackingId,
224
+ CapacitorResult(call)
225
+ )
226
+ }
227
+
228
+ @PluginMethod
229
+ fun setViewForCapturedLabelField(call: PluginCall) {
230
+ try {
231
+ mainThread.runOnMainThread {
232
+ labelModule.setViewForLabelField(
233
+ viewParams = call.data.toMap(),
234
+ viewFromJsonResolver = object : ViewFromJsonResolver {
235
+ override fun getView(viewJson: String): View? {
236
+ val imageData =
237
+ SerializableAdvancedOverlayView.fromJson(JSONObject(viewJson))
238
+
239
+ if (imageData == null) {
240
+ call.reject(WRONG_INPUT)
241
+ return null
242
+ }
243
+
244
+ return ImageView(context).also {
245
+ it.setImageBitmap(getBitmapFromBase64EncodedViewData(imageData.data))
246
+ it.layoutParams = ViewGroup.MarginLayoutParams(
247
+ imageData.options.width,
248
+ imageData.options.height
249
+ )
250
+ }
251
+ }
252
+
253
+ },
254
+ result = CapacitorResult(call)
255
+ )
256
+ }
257
+ } catch (e: JSONException) {
258
+ call.reject(JsonParseError(e.message).toString())
259
+ } catch (e: RuntimeException) {
260
+ call.reject(JsonParseError(e.message).toString())
261
+ }
262
+
263
+ call.resolve()
264
+ }
265
+
266
+ @PluginMethod
267
+ fun setAnchorForCapturedLabelField(call: PluginCall) {
268
+ val dataCaptureViewId = getDataCaptureViewId(call)
269
+ val anchor = call.data.getString("anchor")
270
+ ?: return call.reject(WRONG_INPUT)
271
+ val identifier = call.data.getString("identifier")
272
+ ?: return call.reject(WRONG_INPUT)
273
+ labelModule.setAnchorForLabelField(
274
+ dataCaptureViewId,
275
+ anchor,
276
+ identifier,
277
+ CapacitorResult(call)
278
+ )
279
+ }
280
+
281
+ @PluginMethod
282
+ fun setOffsetForCapturedLabelField(call: PluginCall) {
283
+ val dataCaptureViewId = getDataCaptureViewId(call)
284
+ val offset = call.data.getString("offset")
285
+ ?: return call.reject(WRONG_INPUT)
286
+ val identifier = call.data.getString("identifier")
287
+ ?: return call.reject(WRONG_INPUT)
288
+ labelModule.setOffsetForLabelField(
289
+ dataCaptureViewId,
290
+ offset,
291
+ identifier,
292
+ CapacitorResult(call)
293
+ )
294
+ }
295
+
296
+ @PluginMethod
297
+ fun clearCapturedLabelViews(call: PluginCall) {
298
+ val dataCaptureViewId = getDataCaptureViewId(call)
299
+ labelModule.clearCapturedLabelViews(dataCaptureViewId, CapacitorResult(call))
300
+ }
301
+
302
+ @PluginMethod
303
+ fun registerListenerForAdvancedOverlayEvents(call: PluginCall) {
304
+ labelModule.addAdvancedOverlayListener(getDataCaptureViewId(call))
305
+ call.resolve()
306
+ }
307
+
308
+ @PluginMethod
309
+ fun unregisterListenerForAdvancedOverlayEvents(call: PluginCall) {
310
+ labelModule.removeAdvancedOverlayListener(getDataCaptureViewId(call))
311
+ call.resolve()
312
+ }
313
+
314
+ @PluginMethod
315
+ fun updateLabelCaptureAdvancedOverlay(call: PluginCall) {
316
+ val dataCaptureViewId = getDataCaptureViewId(call)
317
+ val advancedOverlayJson = call.data.getString("advancedOverlayJson")
318
+ ?: return call.reject(WRONG_INPUT)
319
+ labelModule.updateAdvancedOverlay(
320
+ dataCaptureViewId,
321
+ advancedOverlayJson,
322
+ CapacitorResult(call)
323
+ )
324
+ }
325
+
326
+ // Basic Overlay Methods
327
+ @PluginMethod
328
+ fun setBrushForFieldOfLabel(call: PluginCall) {
329
+ val dataCaptureViewId = getDataCaptureViewId(call)
330
+ val brushJson = call.data.getString("brushJson")
331
+ val fieldName = call.data.getString("fieldName")
332
+ ?: return call.reject(WRONG_INPUT)
333
+ val trackingId = call.data.getInt("trackingId")
334
+ labelModule.setBrushForFieldOfLabel(
335
+ dataCaptureViewId,
336
+ brushJson,
337
+ fieldName,
338
+ trackingId,
339
+ CapacitorResult(call)
340
+ )
341
+ }
342
+
343
+ @PluginMethod
344
+ fun setBrushForLabel(call: PluginCall) {
345
+ val dataCaptureViewId = getDataCaptureViewId(call)
346
+ val brushJson = call.data.getString("brushJson")
347
+ val trackingId = call.data.getInt("trackingId")
348
+ labelModule.setBrushForLabel(
349
+ dataCaptureViewId,
350
+ brushJson,
351
+ trackingId,
352
+ CapacitorResult(call)
353
+ )
354
+ }
355
+
356
+ @PluginMethod
357
+ fun registerListenerForBasicOverlayEvents(call: PluginCall) {
358
+ labelModule.addBasicOverlayListener(getDataCaptureViewId(call))
359
+ call.resolve()
360
+ }
361
+
362
+ @PluginMethod
363
+ fun unregisterListenerForBasicOverlayEvents(call: PluginCall) {
364
+ labelModule.removeBasicOverlayListener(getDataCaptureViewId(call))
365
+ call.resolve()
366
+ }
367
+
368
+ @PluginMethod
369
+ fun updateLabelCaptureBasicOverlay(call: PluginCall) {
370
+ val dataCaptureViewId = getDataCaptureViewId(call)
371
+ val basicOverlayJson = call.data.getString("basicOverlayJson")
372
+ ?: return call.reject(WRONG_INPUT)
373
+ labelModule.updateBasicOverlay(dataCaptureViewId, basicOverlayJson, CapacitorResult(call))
374
+ }
375
+
376
+ @PluginMethod
377
+ fun registerListenerForValidationFlowEvents(call: PluginCall) {
378
+ labelModule.addValidationFlowOverlayListener(getDataCaptureViewId(call))
379
+ call.resolve()
380
+ }
381
+
382
+ @PluginMethod
383
+ fun unregisterListenerForValidationFlowEvents(call: PluginCall) {
384
+ labelModule.removeValidationFlowOverlayListener(getDataCaptureViewId(call))
385
+ call.resolve()
386
+ }
387
+
388
+ @PluginMethod
389
+ fun updateLabelCaptureValidationFlowOverlay(call: PluginCall) {
390
+ val dataCaptureViewId = getDataCaptureViewId(call)
391
+ val overlayJson = call.data.getString("overlayJson")
392
+ ?: return call.reject(WRONG_INPUT)
393
+ labelModule.updateValidationFlowOverlay(
394
+ dataCaptureViewId,
395
+ overlayJson,
396
+ CapacitorResult(call)
397
+ )
398
+ }
399
+
400
+ private fun getViewId(call: PluginCall): Int {
401
+ return call.data.getInt("viewId")
402
+ }
403
+
404
+ private fun getDataCaptureViewId(call: PluginCall): Int {
405
+ return call.data.getInt("dataCaptureViewId")
406
+ }
407
+
408
+ private fun getModeId(call: PluginCall): Int {
409
+ return call.data.getInt("modeId")
410
+ }
411
+
412
+ override fun emit(eventName: String, payload: MutableMap<String, Any?>) {
413
+ val capacitorPayload = JSObject()
414
+ capacitorPayload.put("name", eventName)
415
+ capacitorPayload.put("data", JSONObject(payload).toString())
416
+
417
+ notifyListeners(eventName, capacitorPayload)
418
+ }
419
+
420
+ override fun hasListenersForEvent(eventName: String): Boolean = this.hasListeners(eventName)
421
+
422
+ override fun hasViewSpecificListenersForEvent(viewId: Int, eventName: String): Boolean {
423
+ return this.hasListenersForEvent(eventName)
424
+ }
425
+
426
+ override fun hasModeSpecificListenersForEvent(modeId: Int, eventName: String): Boolean {
427
+ return this.hasListenersForEvent(eventName)
428
+ }
429
+ }
@@ -0,0 +1,40 @@
1
+ export { BarcodeField } from 'scandit-datacapture-frameworks-label';
2
+ export { CapturedLabel } from 'scandit-datacapture-frameworks-label';
3
+ export { CustomBarcode } from 'scandit-datacapture-frameworks-label';
4
+ export { CustomText } from 'scandit-datacapture-frameworks-label';
5
+ export { ExpiryDateText } from 'scandit-datacapture-frameworks-label';
6
+ export { ImeiOneBarcode } from 'scandit-datacapture-frameworks-label';
7
+ export { ImeiTwoBarcode } from 'scandit-datacapture-frameworks-label';
8
+ export { LabelCapture } from 'scandit-datacapture-frameworks-label';
9
+ export { LabelCaptureAdvancedOverlay } from 'scandit-datacapture-frameworks-label';
10
+ export { LabelCaptureAdvancedOverlayListener } from 'scandit-datacapture-frameworks-label';
11
+ export { LabelCaptureAdvancedOverlayView } from './ts/LabelCaptureAdvancedOverlayView';
12
+ export { LabelCaptureBasicOverlay } from 'scandit-datacapture-frameworks-label';
13
+ export { LabelCaptureBasicOverlayListener } from 'scandit-datacapture-frameworks-label';
14
+ export { LabelCaptureFeedback } from 'scandit-datacapture-frameworks-label';
15
+ export { LabelCaptureListener } from 'scandit-datacapture-frameworks-label';
16
+ export { LabelCaptureSession } from 'scandit-datacapture-frameworks-label';
17
+ export { LabelCaptureSettings } from 'scandit-datacapture-frameworks-label';
18
+ export { LabelCaptureValidationFlowListener } from 'scandit-datacapture-frameworks-label';
19
+ export { LabelCaptureValidationFlowOverlay } from 'scandit-datacapture-frameworks-label';
20
+ export { LabelCaptureValidationFlowSettings } from 'scandit-datacapture-frameworks-label';
21
+ export { LabelDateComponentFormat } from 'scandit-datacapture-frameworks-label';
22
+ export { LabelDateFormat } from 'scandit-datacapture-frameworks-label';
23
+ export { LabelDateResult } from 'scandit-datacapture-frameworks-label';
24
+ export { LabelDefinition } from 'scandit-datacapture-frameworks-label';
25
+ export { LabelField } from 'scandit-datacapture-frameworks-label';
26
+ export { LabelFieldDefinition } from 'scandit-datacapture-frameworks-label';
27
+ export { LabelFieldLocation } from 'scandit-datacapture-frameworks-label';
28
+ export { LabelFieldLocationType } from 'scandit-datacapture-frameworks-label';
29
+ export { LabelFieldState } from 'scandit-datacapture-frameworks-label';
30
+ export { LabelFieldType } from 'scandit-datacapture-frameworks-label';
31
+ export { PackingDateText } from 'scandit-datacapture-frameworks-label';
32
+ export { PartNumberBarcode } from 'scandit-datacapture-frameworks-label';
33
+ export { SerialNumberBarcode } from 'scandit-datacapture-frameworks-label';
34
+ export { TextField } from 'scandit-datacapture-frameworks-label';
35
+ export { TotalPriceText } from 'scandit-datacapture-frameworks-label';
36
+ export { UnitPriceText } from 'scandit-datacapture-frameworks-label';
37
+ export { WeightText } from 'scandit-datacapture-frameworks-label';
38
+ export interface ScanditLabelPluginInterface {
39
+ initialize(coreDefaults: any): Promise<any>;
40
+ }
@@ -0,0 +1,2 @@
1
+ export * from './definitions';
2
+ export * from './web';
@@ -0,0 +1,15 @@
1
+ import { CapacitorNativeCaller } from 'scandit-capacitor-datacapture-core';
2
+ import { LabelCaptureDefaults } from 'scandit-datacapture-frameworks-label';
3
+ export declare const Capacitor: {
4
+ pluginName: string;
5
+ defaults: LabelCaptureDefaults;
6
+ exec: (success: Function | null, error: Function | null, functionName: string, args: [
7
+ any
8
+ ] | null) => void;
9
+ };
10
+ export interface CapacitorWindow extends Window {
11
+ Scandit: any;
12
+ Capacitor: any;
13
+ }
14
+ export declare const getDefaults: () => Promise<LabelCaptureDefaults>;
15
+ export declare const capacitorLabelNativeCaller: CapacitorNativeCaller;
@@ -0,0 +1 @@
1
+ export declare function initLabelProxy(): void;