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 +48 -0
- package/README.md +3 -0
- package/ScanditCapacitorDatacaptureLabel.podspec +22 -0
- package/android/build.gradle +114 -0
- package/android/src/main/java/com/scandit/capacitor/datacapture/label/ScanditLabelNative.kt +429 -0
- package/dist/esm/definitions.d.ts +40 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/ts/Capacitor/Capacitor.d.ts +15 -0
- package/dist/esm/ts/Capacitor/initProxy.d.ts +1 -0
- package/dist/esm/ts/LabelCaptureAdvancedOverlayView.d.ts +22 -0
- package/dist/esm/web.d.ts +6 -0
- package/dist/index.js +1919 -0
- package/dist/index.js.map +1 -0
- package/ios/Podfile +15 -0
- package/ios/ScanditLabelCapturePlugin.xcodeproj/project.pbxproj +676 -0
- package/ios/ScanditLabelCapturePlugin.xcodeproj/xcshareddata/xcschemes/ScanditBarcodeCapturePlugin.xcscheme +77 -0
- package/ios/ScanditLabelCapturePlugin.xcworkspace/contents.xcworkspacedata +10 -0
- package/ios/ScanditLabelCapturePlugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/ScanditLabelCapturePlugin.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
- package/ios/Sources/ScanditCapacitorLabel/ScanditCapacitorLabel.swift +333 -0
- package/package.json +72 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Scheme
|
|
3
|
+
LastUpgradeVersion = "1220"
|
|
4
|
+
version = "1.3">
|
|
5
|
+
<BuildAction
|
|
6
|
+
parallelizeBuildables = "YES"
|
|
7
|
+
buildImplicitDependencies = "YES">
|
|
8
|
+
<BuildActionEntries>
|
|
9
|
+
<BuildActionEntry
|
|
10
|
+
buildForTesting = "YES"
|
|
11
|
+
buildForRunning = "YES"
|
|
12
|
+
buildForProfiling = "YES"
|
|
13
|
+
buildForArchiving = "YES"
|
|
14
|
+
buildForAnalyzing = "YES">
|
|
15
|
+
<BuildableReference
|
|
16
|
+
BuildableIdentifier = "primary"
|
|
17
|
+
BlueprintIdentifier = "50ADFF87201F53D600D50D53"
|
|
18
|
+
BuildableName = "ScanditBarcodeCapturePlugin.framework"
|
|
19
|
+
BlueprintName = "ScanditBarcodeCapturePlugin"
|
|
20
|
+
ReferencedContainer = "container:ScanditBarcodeCapturePlugin.xcodeproj">
|
|
21
|
+
</BuildableReference>
|
|
22
|
+
</BuildActionEntry>
|
|
23
|
+
</BuildActionEntries>
|
|
24
|
+
</BuildAction>
|
|
25
|
+
<TestAction
|
|
26
|
+
buildConfiguration = "Debug"
|
|
27
|
+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
28
|
+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
29
|
+
shouldUseLaunchSchemeArgsEnv = "YES">
|
|
30
|
+
<Testables>
|
|
31
|
+
<TestableReference
|
|
32
|
+
skipped = "NO">
|
|
33
|
+
<BuildableReference
|
|
34
|
+
BuildableIdentifier = "primary"
|
|
35
|
+
BlueprintIdentifier = "50ADFF90201F53D600D50D53"
|
|
36
|
+
BuildableName = "ScanditBarcodeCapturePluginTests.xctest"
|
|
37
|
+
BlueprintName = "ScanditBarcodeCapturePluginTests"
|
|
38
|
+
ReferencedContainer = "container:ScanditBarcodeCapturePlugin.xcodeproj">
|
|
39
|
+
</BuildableReference>
|
|
40
|
+
</TestableReference>
|
|
41
|
+
</Testables>
|
|
42
|
+
</TestAction>
|
|
43
|
+
<LaunchAction
|
|
44
|
+
buildConfiguration = "Debug"
|
|
45
|
+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
46
|
+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
47
|
+
launchStyle = "0"
|
|
48
|
+
useCustomWorkingDirectory = "NO"
|
|
49
|
+
ignoresPersistentStateOnLaunch = "NO"
|
|
50
|
+
debugDocumentVersioning = "YES"
|
|
51
|
+
debugServiceExtension = "internal"
|
|
52
|
+
allowLocationSimulation = "YES">
|
|
53
|
+
</LaunchAction>
|
|
54
|
+
<ProfileAction
|
|
55
|
+
buildConfiguration = "Release"
|
|
56
|
+
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
57
|
+
savedToolIdentifier = ""
|
|
58
|
+
useCustomWorkingDirectory = "NO"
|
|
59
|
+
debugDocumentVersioning = "YES">
|
|
60
|
+
<MacroExpansion>
|
|
61
|
+
<BuildableReference
|
|
62
|
+
BuildableIdentifier = "primary"
|
|
63
|
+
BlueprintIdentifier = "50ADFF87201F53D600D50D53"
|
|
64
|
+
BuildableName = "ScanditBarcodeCapturePlugin.framework"
|
|
65
|
+
BlueprintName = "ScanditBarcodeCapturePlugin"
|
|
66
|
+
ReferencedContainer = "container:ScanditBarcodeCapturePlugin.xcodeproj">
|
|
67
|
+
</BuildableReference>
|
|
68
|
+
</MacroExpansion>
|
|
69
|
+
</ProfileAction>
|
|
70
|
+
<AnalyzeAction
|
|
71
|
+
buildConfiguration = "Debug">
|
|
72
|
+
</AnalyzeAction>
|
|
73
|
+
<ArchiveAction
|
|
74
|
+
buildConfiguration = "Release"
|
|
75
|
+
revealArchiveInOrganizer = "YES">
|
|
76
|
+
</ArchiveAction>
|
|
77
|
+
</Scheme>
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the Scandit Data Capture SDK
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025- Scandit AG. All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import Capacitor
|
|
8
|
+
import Foundation
|
|
9
|
+
import ScanditCapacitorDatacaptureCore
|
|
10
|
+
import ScanditCapacitorDatacaptureBarcode
|
|
11
|
+
import ScanditFrameworksLabel
|
|
12
|
+
import ScanditFrameworksCore
|
|
13
|
+
|
|
14
|
+
@objc(ScanditCapacitorLabel)
|
|
15
|
+
public class ScanditCapacitorLabel: CAPPlugin, CAPBridgedPlugin {
|
|
16
|
+
public let identifier = "ScanditCapacitorLabel"
|
|
17
|
+
public let jsName = "ScanditLabelNative"
|
|
18
|
+
public let pluginMethods: [CAPPluginMethod] = [
|
|
19
|
+
CAPPluginMethod(name: "getDefaults", returnType: CAPPluginReturnPromise),
|
|
20
|
+
CAPPluginMethod(name: "registerListenerForEvents", returnType: CAPPluginReturnPromise),
|
|
21
|
+
CAPPluginMethod(name: "unregisterListenerForEvents", returnType: CAPPluginReturnPromise),
|
|
22
|
+
CAPPluginMethod(name: "finishDidUpdateSessionCallback", returnType: CAPPluginReturnPromise),
|
|
23
|
+
CAPPluginMethod(name: "setModeEnabledState", returnType: CAPPluginReturnPromise),
|
|
24
|
+
CAPPluginMethod(name: "updateLabelCaptureFeedback", returnType: CAPPluginReturnPromise),
|
|
25
|
+
CAPPluginMethod(name: "updateLabelCaptureSettings", returnType: CAPPluginReturnPromise),
|
|
26
|
+
CAPPluginMethod(name: "setViewForCapturedLabel", returnType: CAPPluginReturnPromise),
|
|
27
|
+
CAPPluginMethod(name: "setAnchorForCapturedLabel", returnType: CAPPluginReturnPromise),
|
|
28
|
+
CAPPluginMethod(name: "setOffsetForCapturedLabel", returnType: CAPPluginReturnPromise),
|
|
29
|
+
CAPPluginMethod(name: "setViewForCapturedLabelField", returnType: CAPPluginReturnPromise),
|
|
30
|
+
CAPPluginMethod(name: "setAnchorForCapturedLabelField", returnType: CAPPluginReturnPromise),
|
|
31
|
+
CAPPluginMethod(name: "setOffsetForCapturedLabelField", returnType: CAPPluginReturnPromise),
|
|
32
|
+
CAPPluginMethod(name: "clearCapturedLabelViews", returnType: CAPPluginReturnPromise),
|
|
33
|
+
CAPPluginMethod(name: "registerListenerForAdvancedOverlayEvents", returnType: CAPPluginReturnPromise),
|
|
34
|
+
CAPPluginMethod(name: "unregisterListenerForAdvancedOverlayEvents", returnType: CAPPluginReturnPromise),
|
|
35
|
+
CAPPluginMethod(name: "updateLabelCaptureAdvancedOverlay", returnType: CAPPluginReturnPromise),
|
|
36
|
+
CAPPluginMethod(name: "setBrushForFieldOfLabel", returnType: CAPPluginReturnPromise),
|
|
37
|
+
CAPPluginMethod(name: "setBrushForLabel", returnType: CAPPluginReturnPromise),
|
|
38
|
+
CAPPluginMethod(name: "registerListenerForBasicOverlayEvents", returnType: CAPPluginReturnPromise),
|
|
39
|
+
CAPPluginMethod(name: "unregisterListenerForBasicOverlayEvents", returnType: CAPPluginReturnPromise),
|
|
40
|
+
CAPPluginMethod(name: "updateLabelCaptureBasicOverlay", returnType: CAPPluginReturnPromise),
|
|
41
|
+
CAPPluginMethod(name: "registerListenerForValidationFlowEvents", returnType: CAPPluginReturnPromise),
|
|
42
|
+
CAPPluginMethod(name: "unregisterListenerForValidationFlowEvents", returnType: CAPPluginReturnPromise),
|
|
43
|
+
CAPPluginMethod(name: "updateLabelCaptureValidationFlowOverlay", returnType: CAPPluginReturnPromise),
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
private var labelModule: LabelModule!
|
|
47
|
+
|
|
48
|
+
override public func load() {
|
|
49
|
+
let emitter = CapacitorEventEmitter(with: self)
|
|
50
|
+
labelModule = LabelModule(emitter: emitter)
|
|
51
|
+
labelModule.didStart()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@objc func getDefaults(_ call: CAPPluginCall) {
|
|
55
|
+
let defaults = labelModule.defaults.toEncodable()
|
|
56
|
+
let defaultsResult = ["LabelCapture": defaults]
|
|
57
|
+
call.resolve(defaultsResult)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@objc func registerListenerForEvents(_ call: CAPPluginCall) {
|
|
61
|
+
labelModule.addListener(getModeId(call))
|
|
62
|
+
call.resolve()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@objc func unregisterListenerForEvents(_ call: CAPPluginCall) {
|
|
66
|
+
labelModule.removeListener(getModeId(call))
|
|
67
|
+
call.resolve()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@objc func finishDidUpdateSessionCallback(_ call: CAPPluginCall) {
|
|
71
|
+
let enabled = call.getBool("isEnabled", true)
|
|
72
|
+
labelModule.finishDidUpdateCallback(modeId: getModeId(call), enabled: enabled)
|
|
73
|
+
call.resolve()
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@objc func setModeEnabledState(_ call: CAPPluginCall) {
|
|
77
|
+
guard let enabled = call.getBool("isEnabled") else {
|
|
78
|
+
call.reject("isEnabled parameter is required")
|
|
79
|
+
return
|
|
80
|
+
}
|
|
81
|
+
labelModule.setModeEnabled(modeId: getModeId(call), enabled: enabled)
|
|
82
|
+
call.resolve()
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@objc func updateLabelCaptureFeedback(_ call: CAPPluginCall) {
|
|
86
|
+
guard let feedbackJson = call.getString("feedbackJson") else {
|
|
87
|
+
call.reject("feedbackJson parameter is required")
|
|
88
|
+
return
|
|
89
|
+
}
|
|
90
|
+
labelModule.updateFeedback(modeId: getModeId(call), feedbackJson: feedbackJson, result: CapacitorResult(call))
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@objc func updateLabelCaptureSettings(_ call: CAPPluginCall) {
|
|
94
|
+
guard let settingsJson = call.getString("settingsJson") else {
|
|
95
|
+
call.reject("settingsJson parameter is required")
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
labelModule.applyModeSettings(modeId: getModeId(call), modeSettingsJson: settingsJson, result: CapacitorResult(call))
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Advanced Overlay Methods
|
|
102
|
+
@objc func setViewForCapturedLabel(_ call: CAPPluginCall) {
|
|
103
|
+
let trackingId = call.getInt("trackingId", -1)
|
|
104
|
+
|
|
105
|
+
if trackingId < 0 {
|
|
106
|
+
call.reject("trackingId parameter is required")
|
|
107
|
+
return
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
let dataCaptureViewId = getDataCaptureViewId(call)
|
|
111
|
+
guard let viewJson = call.getString("jsonView") else {
|
|
112
|
+
call.reject("view parameter is required")
|
|
113
|
+
return
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Parse the JSON string to extract view data and options
|
|
117
|
+
guard let jsonData = viewJson.data(using: .utf8),
|
|
118
|
+
let parsedJson = try? JSONSerialization.jsonObject(with: jsonData, options: []) as? [String: Any],
|
|
119
|
+
let viewJsonData = try? JSONSerialization.data(withJSONObject: parsedJson, options: []),
|
|
120
|
+
let decodedViewJson = try? JSONDecoder().decode(TappableBase64ImageView.JSON.self, from: viewJsonData) else {
|
|
121
|
+
call.reject("Invalid view JSON format")
|
|
122
|
+
return
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
dispatchMain { [weak self] in
|
|
126
|
+
let view: TappableBase64ImageView? = TappableBase64ImageView(json: decodedViewJson)
|
|
127
|
+
|
|
128
|
+
let viewForLabel = ViewForLabel(dataCaptureViewId: dataCaptureViewId, view: view, trackingId: trackingId)
|
|
129
|
+
|
|
130
|
+
self?.labelModule.setViewForCapturedLabel(viewForLabel: viewForLabel, result: CapacitorResult(call))
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@objc func setAnchorForCapturedLabel(_ call: CAPPluginCall) {
|
|
135
|
+
guard let anchor = call.getString("anchor") else {
|
|
136
|
+
call.reject("anchor parameter is required")
|
|
137
|
+
return
|
|
138
|
+
}
|
|
139
|
+
let dataCaptureViewId = getDataCaptureViewId(call)
|
|
140
|
+
let trackingId = call.getInt("trackingId", 0)
|
|
141
|
+
let anchroForLabel = AnchorForLabel(dataCaptureViewId: dataCaptureViewId, anchorString: anchor, trackingId: trackingId)
|
|
142
|
+
labelModule.setAnchorForCapturedLabel(anchorForLabel: anchroForLabel, result: CapacitorResult(call))
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@objc func setOffsetForCapturedLabel(_ call: CAPPluginCall) {
|
|
146
|
+
guard let offsetJson = call.getString("offsetJson") else {
|
|
147
|
+
call.reject("offsetJson parameter is required")
|
|
148
|
+
return
|
|
149
|
+
}
|
|
150
|
+
let dataCaptureViewId = getDataCaptureViewId(call)
|
|
151
|
+
let trackingId = call.getInt("trackingId", 0)
|
|
152
|
+
let offsetForLabel = OffsetForLabel(dataCaptureViewId: dataCaptureViewId, offsetJson: offsetJson, trackingId: trackingId)
|
|
153
|
+
labelModule.setOffsetForCapturedLabel(offsetForLabel: offsetForLabel, result: CapacitorResult(call))
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@objc func setViewForCapturedLabelField(_ call: CAPPluginCall) {
|
|
157
|
+
guard let identifier = call.getString("identifier") else {
|
|
158
|
+
call.reject("identifier parameter is required")
|
|
159
|
+
return
|
|
160
|
+
}
|
|
161
|
+
let dataCaptureViewId = getDataCaptureViewId(call)
|
|
162
|
+
guard let viewJson = call.getString("view") else {
|
|
163
|
+
call.reject("view parameter is required")
|
|
164
|
+
return
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Parse the JSON string to extract view data and options
|
|
168
|
+
guard let jsonData = viewJson.data(using: .utf8),
|
|
169
|
+
let parsedJson = try? JSONSerialization.jsonObject(with: jsonData, options: []) as? [String: Any],
|
|
170
|
+
let viewJsonData = try? JSONSerialization.data(withJSONObject: parsedJson, options: []),
|
|
171
|
+
let decodedViewJson = try? JSONDecoder().decode(TappableBase64ImageView.JSON.self, from: viewJsonData) else {
|
|
172
|
+
call.reject("Invalid view JSON format")
|
|
173
|
+
return
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
dispatchMain { [weak self] in
|
|
177
|
+
let view: TappableBase64ImageView? = TappableBase64ImageView(json: decodedViewJson)
|
|
178
|
+
|
|
179
|
+
let components = identifier.components(separatedBy: String(FrameworksLabelCaptureSession.separator))
|
|
180
|
+
let trackingId = Int(components[0])!
|
|
181
|
+
let fieldName = components[1]
|
|
182
|
+
|
|
183
|
+
let viewForLabel = ViewForLabel(dataCaptureViewId: dataCaptureViewId, view: view, trackingId: trackingId, fieldName: fieldName)
|
|
184
|
+
|
|
185
|
+
self?.labelModule.setViewForFieldOfLabel(viewForFieldOfLabel: viewForLabel, result: CapacitorResult(call))
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@objc func setAnchorForCapturedLabelField(_ call: CAPPluginCall) {
|
|
190
|
+
guard let anchor = call.getString("anchor"),
|
|
191
|
+
let identifier = call.getString("identifier") else {
|
|
192
|
+
call.reject("anchor and identifier parameters are required")
|
|
193
|
+
return
|
|
194
|
+
}
|
|
195
|
+
let dataCaptureViewId = getDataCaptureViewId(call)
|
|
196
|
+
|
|
197
|
+
let components = identifier.components(separatedBy: String(FrameworksLabelCaptureSession.separator))
|
|
198
|
+
let trackingId = Int(components[0])!
|
|
199
|
+
let fieldName = components[1]
|
|
200
|
+
|
|
201
|
+
let anchorForLabelField = AnchorForLabel(
|
|
202
|
+
dataCaptureViewId: dataCaptureViewId,
|
|
203
|
+
anchorString: anchor,
|
|
204
|
+
trackingId: trackingId,
|
|
205
|
+
fieldName: fieldName
|
|
206
|
+
)
|
|
207
|
+
labelModule.setAnchorForFieldOfLabel(anchorForFieldOfLabel: anchorForLabelField, result: CapacitorResult(call))
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@objc func setOffsetForCapturedLabelField(_ call: CAPPluginCall) {
|
|
211
|
+
guard let offsetJson = call.getString("offset"),
|
|
212
|
+
let identifier = call.getString("identifier") else {
|
|
213
|
+
call.reject("offset and identifier parameters are required")
|
|
214
|
+
return
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
let dataCaptureViewId = getDataCaptureViewId(call)
|
|
218
|
+
let components = identifier.components(separatedBy: String(FrameworksLabelCaptureSession.separator))
|
|
219
|
+
let trackingId = Int(components[0])!
|
|
220
|
+
let fieldName = components[1]
|
|
221
|
+
let offsetForLabelField = OffsetForLabel(
|
|
222
|
+
dataCaptureViewId: dataCaptureViewId,
|
|
223
|
+
offsetJson: offsetJson,
|
|
224
|
+
trackingId: trackingId,
|
|
225
|
+
fieldName: fieldName
|
|
226
|
+
)
|
|
227
|
+
labelModule.setOffsetForCapturedLabel(offsetForLabel: offsetForLabelField, result: CapacitorResult(call))
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
@objc func clearCapturedLabelViews(_ call: CAPPluginCall) {
|
|
231
|
+
let dataCaptureViewId = getDataCaptureViewId(call)
|
|
232
|
+
labelModule.clearTrackedCapturedLabelViews(dataCaptureViewId)
|
|
233
|
+
call.resolve()
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
@objc func registerListenerForAdvancedOverlayEvents(_ call: CAPPluginCall) {
|
|
237
|
+
labelModule.addAdvancedOverlayListener(getDataCaptureViewId(call))
|
|
238
|
+
call.resolve()
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
@objc func unregisterListenerForAdvancedOverlayEvents(_ call: CAPPluginCall) {
|
|
242
|
+
labelModule.removeAdvancedOverlayListener(getDataCaptureViewId(call))
|
|
243
|
+
call.resolve()
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
@objc func updateLabelCaptureAdvancedOverlay(_ call: CAPPluginCall) {
|
|
247
|
+
guard let advancedOverlayJson = call.getString("advancedOverlayJson") else {
|
|
248
|
+
call.reject("advancedOverlayJson parameter is required")
|
|
249
|
+
return
|
|
250
|
+
}
|
|
251
|
+
let dataCaptureViewId = getDataCaptureViewId(call)
|
|
252
|
+
labelModule.updateAdvancedOverlay(dataCaptureViewId, overlayJson: advancedOverlayJson, result: CapacitorResult(call))
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Basic Overlay Methods
|
|
256
|
+
@objc func setBrushForFieldOfLabel(_ call: CAPPluginCall) {
|
|
257
|
+
guard let fieldName = call.getString("fieldName") else {
|
|
258
|
+
call.reject("fieldName parameter is required")
|
|
259
|
+
return
|
|
260
|
+
}
|
|
261
|
+
let dataCaptureViewId = getDataCaptureViewId(call)
|
|
262
|
+
let brushJson = call.getString("brushJson")
|
|
263
|
+
let trackingId = call.getInt("trackingId", 0)
|
|
264
|
+
let brushForFieldOfLabel = BrushForLabelField(dataCaptureViewId: dataCaptureViewId,
|
|
265
|
+
brushJson: brushJson,
|
|
266
|
+
labelTrackingId: trackingId,
|
|
267
|
+
fieldName: fieldName)
|
|
268
|
+
labelModule.setBrushForFieldOfLabel(brushForFieldOfLabel: brushForFieldOfLabel, result: CapacitorResult(call))
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
@objc func setBrushForLabel(_ call: CAPPluginCall) {
|
|
272
|
+
let dataCaptureViewId = getDataCaptureViewId(call)
|
|
273
|
+
let brushJson = call.getString("brushJson")
|
|
274
|
+
let trackingId = call.getInt("trackingId", 0)
|
|
275
|
+
|
|
276
|
+
let brushForLabel = BrushForLabelField(dataCaptureViewId: dataCaptureViewId,
|
|
277
|
+
brushJson: brushJson,
|
|
278
|
+
labelTrackingId: trackingId)
|
|
279
|
+
|
|
280
|
+
labelModule.setBrushForLabel(brushForLabel: brushForLabel, result: CapacitorResult(call))
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
@objc func registerListenerForBasicOverlayEvents(_ call: CAPPluginCall) {
|
|
284
|
+
labelModule.addBasicOverlayListener(getDataCaptureViewId(call))
|
|
285
|
+
call.resolve()
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
@objc func unregisterListenerForBasicOverlayEvents(_ call: CAPPluginCall) {
|
|
289
|
+
labelModule.removeBasicOverlayListener(getDataCaptureViewId(call))
|
|
290
|
+
call.resolve()
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
@objc func registerListenerForValidationFlowEvents(_ call: CAPPluginCall) {
|
|
294
|
+
labelModule.addValidationFlowOverlayListener(getDataCaptureViewId(call))
|
|
295
|
+
call.resolve()
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
@objc func unregisterListenerForValidationFlowEvents(_ call: CAPPluginCall) {
|
|
299
|
+
labelModule.removeValidationFlowOverlayListener(getDataCaptureViewId(call))
|
|
300
|
+
call.resolve()
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
@objc func updateLabelCaptureBasicOverlay(_ call: CAPPluginCall) {
|
|
305
|
+
guard let basicOverlayJson = call.getString("basicOverlayJson") else {
|
|
306
|
+
call.reject("basicOverlayJson parameter is required")
|
|
307
|
+
return
|
|
308
|
+
}
|
|
309
|
+
let dataCaptureViewId = getDataCaptureViewId(call)
|
|
310
|
+
labelModule.updateBasicOverlay(dataCaptureViewId, overlayJson: basicOverlayJson, result: CapacitorResult(call))
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
@objc func updateLabelCaptureValidationFlowOverlay(_ call: CAPPluginCall) {
|
|
314
|
+
guard let overlayJson = call.getString("overlayJson") else {
|
|
315
|
+
call.reject("overlayJson parameter is required")
|
|
316
|
+
return
|
|
317
|
+
}
|
|
318
|
+
let dataCaptureViewId = getDataCaptureViewId(call)
|
|
319
|
+
labelModule.updateValidationFlowOverlay(dataCaptureViewId, overlayJson: overlayJson, result: CapacitorResult(call))
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
private func getModeId(_ call: CAPPluginCall) -> Int {
|
|
323
|
+
return call.getInt("modeId", 0)
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
private func getViewId(_ call: CAPPluginCall) -> Int {
|
|
327
|
+
return call.getInt("viewId", 0)
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
private func getDataCaptureViewId(_ call: CAPPluginCall) -> Int {
|
|
331
|
+
return call.getInt("dataCaptureViewId", 0)
|
|
332
|
+
}
|
|
333
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "scandit-capacitor-datacapture-label",
|
|
3
|
+
"version": "8.0.0-beta.1",
|
|
4
|
+
"description": "Scandit Data Capture SDK for Capacitor",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"private": false,
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Scandit",
|
|
9
|
+
"email": "support@scandit.com"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/Scandit/scandit-capacitor-datacapture-label",
|
|
12
|
+
"main": "dist/index.js",
|
|
13
|
+
"module": "dist/index.js",
|
|
14
|
+
"types": "dist/dts/index.d.ts",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/Scandit/scandit-capacitor-datacapture-label.git"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/Scandit/scandit-capacitor-datacapture-label/issues"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"capacitor",
|
|
24
|
+
"plugin",
|
|
25
|
+
"native"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"lint": "eslint ./src",
|
|
29
|
+
"build": "rollup -c rollup.config.js --bundleConfigAsCjs",
|
|
30
|
+
"clean": "rimraf ./dist",
|
|
31
|
+
"watch": "tsc --watch"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"scandit-capacitor-datacapture-core": "8.0.0-beta.1",
|
|
35
|
+
"scandit-capacitor-datacapture-barcode": "8.0.0-beta.1",
|
|
36
|
+
"scandit-datacapture-frameworks-core": "8.0.0-beta.1",
|
|
37
|
+
"scandit-datacapture-frameworks-barcode": "8.0.0-beta.1",
|
|
38
|
+
"scandit-datacapture-frameworks-label": "8.0.0-beta.1"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@capacitor/android": ">=5.0.0 <8.0.0",
|
|
42
|
+
"@capacitor/core": ">=5.0.0 <8.0.0",
|
|
43
|
+
"@capacitor/ios": ">=5.0.0 <8.0.0",
|
|
44
|
+
"@capacitor/docgen": "^0.2.1",
|
|
45
|
+
"@types/node": "18.15.3",
|
|
46
|
+
"rimraf": "4.4.0",
|
|
47
|
+
"rollup": "3.26.2",
|
|
48
|
+
"@rollup/plugin-node-resolve": "15.0.2",
|
|
49
|
+
"@rollup/plugin-typescript": "11.1.2",
|
|
50
|
+
"@rollup/plugin-commonjs": "24.1.0",
|
|
51
|
+
"rollup-plugin-modify": "3.0.0",
|
|
52
|
+
"typescript": "4.9.5",
|
|
53
|
+
"eslint": "8.37.0",
|
|
54
|
+
"@typescript-eslint/parser": "5.57.1",
|
|
55
|
+
"@typescript-eslint/eslint-plugin": "5.57.1"
|
|
56
|
+
},
|
|
57
|
+
"files": [
|
|
58
|
+
"dist/",
|
|
59
|
+
"ios/",
|
|
60
|
+
"android/",
|
|
61
|
+
"ScanditCapacitorDatacaptureLabel.podspec",
|
|
62
|
+
"Package.swift"
|
|
63
|
+
],
|
|
64
|
+
"capacitor": {
|
|
65
|
+
"ios": {
|
|
66
|
+
"src": "ios"
|
|
67
|
+
},
|
|
68
|
+
"android": {
|
|
69
|
+
"src": "android"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|