@scr2em/capacitor-scanner 6.0.0
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/CapacitorScanner.podspec +17 -0
- package/Package.swift +24 -0
- package/README.md +161 -0
- package/android/build.gradle +74 -0
- package/android/src/main/AndroidManifest.xml +5 -0
- package/android/src/main/java/com/leadliaion/capacitorscanner/BarcodeFormatHelper.java +40 -0
- package/android/src/main/java/com/leadliaion/capacitorscanner/CapacitorScannerPlugin.java +489 -0
- package/android/src/main/java/com/leadliaion/capacitorscanner/Draft.java +575 -0
- package/android/src/main/java/com/leadliaion/capacitorscanner/VoteStatus.java +11 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +242 -0
- package/dist/esm/definitions.d.ts +42 -0
- package/dist/esm/definitions.js +15 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/plugin.cjs.js +23 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +26 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Sources/CapacitorScannerPlugin/CapacitorScannerHelpers.swift +71 -0
- package/ios/Sources/CapacitorScannerPlugin/CapacitorScannerPlugin.swift +346 -0
- package/ios/Sources/CapacitorScannerPlugin/ScanSettings.swift +8 -0
- package/package.json +82 -0
package/dist/docs.json
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
{
|
|
2
|
+
"api": {
|
|
3
|
+
"name": "CapacitorScannerPlugin",
|
|
4
|
+
"slug": "capacitorscannerplugin",
|
|
5
|
+
"docs": "",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"methods": [
|
|
8
|
+
{
|
|
9
|
+
"name": "startScanning",
|
|
10
|
+
"signature": "(options?: ScannerOptions | undefined) => Promise<void>",
|
|
11
|
+
"parameters": [
|
|
12
|
+
{
|
|
13
|
+
"name": "options",
|
|
14
|
+
"docs": "",
|
|
15
|
+
"type": "ScannerOptions | undefined"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"returns": "Promise<void>",
|
|
19
|
+
"tags": [],
|
|
20
|
+
"docs": "",
|
|
21
|
+
"complexTypes": [
|
|
22
|
+
"ScannerOptions"
|
|
23
|
+
],
|
|
24
|
+
"slug": "startscanning"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "stopScanning",
|
|
28
|
+
"signature": "() => Promise<void>",
|
|
29
|
+
"parameters": [],
|
|
30
|
+
"returns": "Promise<void>",
|
|
31
|
+
"tags": [],
|
|
32
|
+
"docs": "",
|
|
33
|
+
"complexTypes": [],
|
|
34
|
+
"slug": "stopscanning"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "openSettings",
|
|
38
|
+
"signature": "() => Promise<void>",
|
|
39
|
+
"parameters": [],
|
|
40
|
+
"returns": "Promise<void>",
|
|
41
|
+
"tags": [],
|
|
42
|
+
"docs": "",
|
|
43
|
+
"complexTypes": [],
|
|
44
|
+
"slug": "opensettings"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "capturePhoto",
|
|
48
|
+
"signature": "() => Promise<CapturePhotoResult>",
|
|
49
|
+
"parameters": [],
|
|
50
|
+
"returns": "Promise<CapturePhotoResult>",
|
|
51
|
+
"tags": [],
|
|
52
|
+
"docs": "",
|
|
53
|
+
"complexTypes": [
|
|
54
|
+
"CapturePhotoResult"
|
|
55
|
+
],
|
|
56
|
+
"slug": "capturephoto"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "checkPermissions",
|
|
60
|
+
"signature": "() => Promise<PermissionsResult>",
|
|
61
|
+
"parameters": [],
|
|
62
|
+
"returns": "Promise<PermissionsResult>",
|
|
63
|
+
"tags": [],
|
|
64
|
+
"docs": "",
|
|
65
|
+
"complexTypes": [
|
|
66
|
+
"PermissionsResult"
|
|
67
|
+
],
|
|
68
|
+
"slug": "checkpermissions"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "requestPermissions",
|
|
72
|
+
"signature": "() => Promise<PermissionsResult>",
|
|
73
|
+
"parameters": [],
|
|
74
|
+
"returns": "Promise<PermissionsResult>",
|
|
75
|
+
"tags": [],
|
|
76
|
+
"docs": "",
|
|
77
|
+
"complexTypes": [
|
|
78
|
+
"PermissionsResult"
|
|
79
|
+
],
|
|
80
|
+
"slug": "requestpermissions"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "addListener",
|
|
84
|
+
"signature": "(event: 'barcodeScanned', listenerFunc: (result: BarcodeScannedEvent) => void) => Promise<void>",
|
|
85
|
+
"parameters": [
|
|
86
|
+
{
|
|
87
|
+
"name": "event",
|
|
88
|
+
"docs": "",
|
|
89
|
+
"type": "'barcodeScanned'"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "listenerFunc",
|
|
93
|
+
"docs": "",
|
|
94
|
+
"type": "(result: BarcodeScannedEvent) => void"
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"returns": "Promise<void>",
|
|
98
|
+
"tags": [],
|
|
99
|
+
"docs": "",
|
|
100
|
+
"complexTypes": [
|
|
101
|
+
"BarcodeScannedEvent"
|
|
102
|
+
],
|
|
103
|
+
"slug": "addlistenerbarcodescanned-"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"name": "removeAllListeners",
|
|
107
|
+
"signature": "() => Promise<void>",
|
|
108
|
+
"parameters": [],
|
|
109
|
+
"returns": "Promise<void>",
|
|
110
|
+
"tags": [],
|
|
111
|
+
"docs": "",
|
|
112
|
+
"complexTypes": [],
|
|
113
|
+
"slug": "removealllisteners"
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
"properties": []
|
|
117
|
+
},
|
|
118
|
+
"interfaces": [],
|
|
119
|
+
"enums": [
|
|
120
|
+
{
|
|
121
|
+
"name": "BarcodeFormat",
|
|
122
|
+
"slug": "barcodeformat",
|
|
123
|
+
"members": [
|
|
124
|
+
{
|
|
125
|
+
"name": "Aztec",
|
|
126
|
+
"value": "'AZTEC'",
|
|
127
|
+
"tags": [],
|
|
128
|
+
"docs": ""
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"name": "Code39",
|
|
132
|
+
"value": "'CODE_39'",
|
|
133
|
+
"tags": [],
|
|
134
|
+
"docs": ""
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"name": "Code93",
|
|
138
|
+
"value": "'CODE_93'",
|
|
139
|
+
"tags": [],
|
|
140
|
+
"docs": ""
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "Code128",
|
|
144
|
+
"value": "'CODE_128'",
|
|
145
|
+
"tags": [],
|
|
146
|
+
"docs": ""
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"name": "DataMatrix",
|
|
150
|
+
"value": "'DATA_MATRIX'",
|
|
151
|
+
"tags": [],
|
|
152
|
+
"docs": ""
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "Ean8",
|
|
156
|
+
"value": "'EAN_8'",
|
|
157
|
+
"tags": [],
|
|
158
|
+
"docs": ""
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"name": "Ean13",
|
|
162
|
+
"value": "'EAN_13'",
|
|
163
|
+
"tags": [],
|
|
164
|
+
"docs": ""
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "Itf14",
|
|
168
|
+
"value": "'ITF14'",
|
|
169
|
+
"tags": [],
|
|
170
|
+
"docs": ""
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"name": "Pdf417",
|
|
174
|
+
"value": "'PDF_417'",
|
|
175
|
+
"tags": [],
|
|
176
|
+
"docs": ""
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"name": "QrCode",
|
|
180
|
+
"value": "'QR_CODE'",
|
|
181
|
+
"tags": [],
|
|
182
|
+
"docs": ""
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"name": "UpcE",
|
|
186
|
+
"value": "'UPC_E'",
|
|
187
|
+
"tags": [],
|
|
188
|
+
"docs": ""
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
"typeAliases": [
|
|
194
|
+
{
|
|
195
|
+
"name": "ScannerOptions",
|
|
196
|
+
"slug": "scanneroptions",
|
|
197
|
+
"docs": "",
|
|
198
|
+
"types": [
|
|
199
|
+
{
|
|
200
|
+
"text": "{\n formats?: BarcodeFormat[];\n cameraDirection?: 'BACK' | 'FRONT';\n}",
|
|
201
|
+
"complexTypes": [
|
|
202
|
+
"BarcodeFormat"
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"name": "CapturePhotoResult",
|
|
209
|
+
"slug": "capturephotoresult",
|
|
210
|
+
"docs": "",
|
|
211
|
+
"types": [
|
|
212
|
+
{
|
|
213
|
+
"text": "{ imageBase64: string }",
|
|
214
|
+
"complexTypes": []
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"name": "PermissionsResult",
|
|
220
|
+
"slug": "permissionsresult",
|
|
221
|
+
"docs": "",
|
|
222
|
+
"types": [
|
|
223
|
+
{
|
|
224
|
+
"text": "{ camera: 'prompt' | 'denied' | 'granted' }",
|
|
225
|
+
"complexTypes": []
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"name": "BarcodeScannedEvent",
|
|
231
|
+
"slug": "barcodescannedevent",
|
|
232
|
+
"docs": "",
|
|
233
|
+
"types": [
|
|
234
|
+
{
|
|
235
|
+
"text": "{ scannedCode: string; format: string }",
|
|
236
|
+
"complexTypes": []
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
],
|
|
241
|
+
"pluginConfigs": []
|
|
242
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface CapacitorScannerPlugin {
|
|
2
|
+
startScanning(options?: ScannerOptions): Promise<void>;
|
|
3
|
+
stopScanning(): Promise<void>;
|
|
4
|
+
openSettings(): Promise<void>;
|
|
5
|
+
capturePhoto(): Promise<CapturePhotoResult>;
|
|
6
|
+
checkPermissions(): Promise<PermissionsResult>;
|
|
7
|
+
requestPermissions(): Promise<PermissionsResult>;
|
|
8
|
+
addListener(event: 'barcodeScanned', listenerFunc: (result: BarcodeScannedEvent) => void): Promise<void>;
|
|
9
|
+
removeAllListeners(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare type ScannerOptions = {
|
|
12
|
+
formats?: BarcodeFormat[];
|
|
13
|
+
cameraDirection?: 'BACK' | 'FRONT';
|
|
14
|
+
};
|
|
15
|
+
export declare type BarcodeScannedEvent = {
|
|
16
|
+
scannedCode: string;
|
|
17
|
+
format: string;
|
|
18
|
+
};
|
|
19
|
+
export declare type PermissionsResult = {
|
|
20
|
+
camera: 'prompt' | 'denied' | 'granted';
|
|
21
|
+
};
|
|
22
|
+
export declare type CapturePhotoResult = {
|
|
23
|
+
imageBase64: string;
|
|
24
|
+
};
|
|
25
|
+
export declare enum BarcodeFormat {
|
|
26
|
+
Aztec = "AZTEC",
|
|
27
|
+
Code39 = "CODE_39",
|
|
28
|
+
Code93 = "CODE_93",
|
|
29
|
+
Code128 = "CODE_128",
|
|
30
|
+
DataMatrix = "DATA_MATRIX",
|
|
31
|
+
Ean8 = "EAN_8",
|
|
32
|
+
Ean13 = "EAN_13",
|
|
33
|
+
Itf14 = "ITF14",
|
|
34
|
+
Pdf417 = "PDF_417",
|
|
35
|
+
QrCode = "QR_CODE",
|
|
36
|
+
UpcE = "UPC_E"
|
|
37
|
+
}
|
|
38
|
+
declare global {
|
|
39
|
+
interface PluginRegistry {
|
|
40
|
+
QRScanner: CapacitorScannerPlugin;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export var BarcodeFormat;
|
|
2
|
+
(function (BarcodeFormat) {
|
|
3
|
+
BarcodeFormat["Aztec"] = "AZTEC";
|
|
4
|
+
BarcodeFormat["Code39"] = "CODE_39";
|
|
5
|
+
BarcodeFormat["Code93"] = "CODE_93";
|
|
6
|
+
BarcodeFormat["Code128"] = "CODE_128";
|
|
7
|
+
BarcodeFormat["DataMatrix"] = "DATA_MATRIX";
|
|
8
|
+
BarcodeFormat["Ean8"] = "EAN_8";
|
|
9
|
+
BarcodeFormat["Ean13"] = "EAN_13";
|
|
10
|
+
BarcodeFormat["Itf14"] = "ITF14";
|
|
11
|
+
BarcodeFormat["Pdf417"] = "PDF_417";
|
|
12
|
+
BarcodeFormat["QrCode"] = "QR_CODE";
|
|
13
|
+
BarcodeFormat["UpcE"] = "UPC_E";
|
|
14
|
+
})(BarcodeFormat || (BarcodeFormat = {}));
|
|
15
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAsBA,MAAM,CAAN,IAAY,aAYX;AAZD,WAAY,aAAa;IACvB,gCAAe,CAAA;IACf,mCAAkB,CAAA;IAClB,mCAAkB,CAAA;IAClB,qCAAoB,CAAA;IACpB,2CAA0B,CAAA;IAC1B,+BAAc,CAAA;IACd,iCAAgB,CAAA;IAChB,gCAAe,CAAA;IACf,mCAAkB,CAAA;IAClB,mCAAkB,CAAA;IAClB,+BAAc,CAAA;AAChB,CAAC,EAZW,aAAa,KAAb,aAAa,QAYxB","sourcesContent":["export interface CapacitorScannerPlugin {\n startScanning(options?: ScannerOptions): Promise<void>;\n stopScanning(): Promise<void>;\n openSettings(): Promise<void>;\n capturePhoto(): Promise<CapturePhotoResult>;\n checkPermissions(): Promise<PermissionsResult>;\n requestPermissions(): Promise<PermissionsResult>;\n addListener(event: 'barcodeScanned', listenerFunc: (result: BarcodeScannedEvent) => void): Promise<void>;\n removeAllListeners(): Promise<void>;\n}\n\nexport type ScannerOptions = {\n formats?: BarcodeFormat[];\n cameraDirection?: 'BACK' | 'FRONT';\n};\n\nexport type BarcodeScannedEvent = { scannedCode: string; format: string };\n\nexport type PermissionsResult = { camera: 'prompt' | 'denied' | 'granted' };\n\nexport type CapturePhotoResult = { imageBase64: string };\n\nexport enum BarcodeFormat {\n Aztec = 'AZTEC',\n Code39 = 'CODE_39',\n Code93 = 'CODE_93',\n Code128 = 'CODE_128',\n DataMatrix = 'DATA_MATRIX',\n Ean8 = 'EAN_8',\n Ean13 = 'EAN_13',\n Itf14 = 'ITF14',\n Pdf417 = 'PDF_417',\n QrCode = 'QR_CODE',\n UpcE = 'UPC_E',\n}\n\ndeclare global {\n interface PluginRegistry {\n QRScanner: CapacitorScannerPlugin;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAAyB,kBAAkB,CAAC,CAAC;AAE3F,cAAc,eAAe,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { CapacitorScannerPlugin } from './definitions';\n\nexport const CapacitorScanner = registerPlugin<CapacitorScannerPlugin>('CapacitorScanner');\n\nexport * from './definitions';\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@capacitor/core');
|
|
4
|
+
|
|
5
|
+
exports.BarcodeFormat = void 0;
|
|
6
|
+
(function (BarcodeFormat) {
|
|
7
|
+
BarcodeFormat["Aztec"] = "AZTEC";
|
|
8
|
+
BarcodeFormat["Code39"] = "CODE_39";
|
|
9
|
+
BarcodeFormat["Code93"] = "CODE_93";
|
|
10
|
+
BarcodeFormat["Code128"] = "CODE_128";
|
|
11
|
+
BarcodeFormat["DataMatrix"] = "DATA_MATRIX";
|
|
12
|
+
BarcodeFormat["Ean8"] = "EAN_8";
|
|
13
|
+
BarcodeFormat["Ean13"] = "EAN_13";
|
|
14
|
+
BarcodeFormat["Itf14"] = "ITF14";
|
|
15
|
+
BarcodeFormat["Pdf417"] = "PDF_417";
|
|
16
|
+
BarcodeFormat["QrCode"] = "QR_CODE";
|
|
17
|
+
BarcodeFormat["UpcE"] = "UPC_E";
|
|
18
|
+
})(exports.BarcodeFormat || (exports.BarcodeFormat = {}));
|
|
19
|
+
|
|
20
|
+
const CapacitorScanner = core.registerPlugin('CapacitorScanner');
|
|
21
|
+
|
|
22
|
+
exports.CapacitorScanner = CapacitorScanner;
|
|
23
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js"],"sourcesContent":["export var BarcodeFormat;\n(function (BarcodeFormat) {\n BarcodeFormat[\"Aztec\"] = \"AZTEC\";\n BarcodeFormat[\"Code39\"] = \"CODE_39\";\n BarcodeFormat[\"Code93\"] = \"CODE_93\";\n BarcodeFormat[\"Code128\"] = \"CODE_128\";\n BarcodeFormat[\"DataMatrix\"] = \"DATA_MATRIX\";\n BarcodeFormat[\"Ean8\"] = \"EAN_8\";\n BarcodeFormat[\"Ean13\"] = \"EAN_13\";\n BarcodeFormat[\"Itf14\"] = \"ITF14\";\n BarcodeFormat[\"Pdf417\"] = \"PDF_417\";\n BarcodeFormat[\"QrCode\"] = \"QR_CODE\";\n BarcodeFormat[\"UpcE\"] = \"UPC_E\";\n})(BarcodeFormat || (BarcodeFormat = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nexport const CapacitorScanner = registerPlugin('CapacitorScanner');\nexport * from './definitions';\n//# sourceMappingURL=index.js.map"],"names":["BarcodeFormat","registerPlugin"],"mappings":";;;;AAAWA,+BAAc;AACzB,CAAC,UAAU,aAAa,EAAE;AAC1B,IAAI,aAAa,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACrC,IAAI,aAAa,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;AACxC,IAAI,aAAa,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;AACxC,IAAI,aAAa,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC;AAC1C,IAAI,aAAa,CAAC,YAAY,CAAC,GAAG,aAAa,CAAC;AAChD,IAAI,aAAa,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC;AACpC,IAAI,aAAa,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC;AACtC,IAAI,aAAa,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACrC,IAAI,aAAa,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;AACxC,IAAI,aAAa,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;AACxC,IAAI,aAAa,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC;AACpC,CAAC,EAAEA,qBAAa,KAAKA,qBAAa,GAAG,EAAE,CAAC,CAAC;;ACZ7B,MAAC,gBAAgB,GAAGC,mBAAc,CAAC,kBAAkB;;;;"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var CapacitorScanner = (function (exports, core) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
exports.BarcodeFormat = void 0;
|
|
5
|
+
(function (BarcodeFormat) {
|
|
6
|
+
BarcodeFormat["Aztec"] = "AZTEC";
|
|
7
|
+
BarcodeFormat["Code39"] = "CODE_39";
|
|
8
|
+
BarcodeFormat["Code93"] = "CODE_93";
|
|
9
|
+
BarcodeFormat["Code128"] = "CODE_128";
|
|
10
|
+
BarcodeFormat["DataMatrix"] = "DATA_MATRIX";
|
|
11
|
+
BarcodeFormat["Ean8"] = "EAN_8";
|
|
12
|
+
BarcodeFormat["Ean13"] = "EAN_13";
|
|
13
|
+
BarcodeFormat["Itf14"] = "ITF14";
|
|
14
|
+
BarcodeFormat["Pdf417"] = "PDF_417";
|
|
15
|
+
BarcodeFormat["QrCode"] = "QR_CODE";
|
|
16
|
+
BarcodeFormat["UpcE"] = "UPC_E";
|
|
17
|
+
})(exports.BarcodeFormat || (exports.BarcodeFormat = {}));
|
|
18
|
+
|
|
19
|
+
const CapacitorScanner = core.registerPlugin('CapacitorScanner');
|
|
20
|
+
|
|
21
|
+
exports.CapacitorScanner = CapacitorScanner;
|
|
22
|
+
|
|
23
|
+
return exports;
|
|
24
|
+
|
|
25
|
+
})({}, capacitorExports);
|
|
26
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js"],"sourcesContent":["export var BarcodeFormat;\n(function (BarcodeFormat) {\n BarcodeFormat[\"Aztec\"] = \"AZTEC\";\n BarcodeFormat[\"Code39\"] = \"CODE_39\";\n BarcodeFormat[\"Code93\"] = \"CODE_93\";\n BarcodeFormat[\"Code128\"] = \"CODE_128\";\n BarcodeFormat[\"DataMatrix\"] = \"DATA_MATRIX\";\n BarcodeFormat[\"Ean8\"] = \"EAN_8\";\n BarcodeFormat[\"Ean13\"] = \"EAN_13\";\n BarcodeFormat[\"Itf14\"] = \"ITF14\";\n BarcodeFormat[\"Pdf417\"] = \"PDF_417\";\n BarcodeFormat[\"QrCode\"] = \"QR_CODE\";\n BarcodeFormat[\"UpcE\"] = \"UPC_E\";\n})(BarcodeFormat || (BarcodeFormat = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nexport const CapacitorScanner = registerPlugin('CapacitorScanner');\nexport * from './definitions';\n//# sourceMappingURL=index.js.map"],"names":["BarcodeFormat","registerPlugin"],"mappings":";;;AAAWA,mCAAc;IACzB,CAAC,UAAU,aAAa,EAAE;IAC1B,IAAI,aAAa,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACrC,IAAI,aAAa,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IACxC,IAAI,aAAa,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IACxC,IAAI,aAAa,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC;IAC1C,IAAI,aAAa,CAAC,YAAY,CAAC,GAAG,aAAa,CAAC;IAChD,IAAI,aAAa,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC;IACpC,IAAI,aAAa,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC;IACtC,IAAI,aAAa,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACrC,IAAI,aAAa,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IACxC,IAAI,aAAa,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IACxC,IAAI,aAAa,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC;IACpC,CAAC,EAAEA,qBAAa,KAAKA,qBAAa,GAAG,EAAE,CAAC,CAAC;;ACZ7B,UAAC,gBAAgB,GAAGC,mBAAc,CAAC,kBAAkB;;;;;;;;;;"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
|
|
2
|
+
import Foundation
|
|
3
|
+
import AVFoundation
|
|
4
|
+
|
|
5
|
+
public typealias BarcodeFormat = AVMetadataObject.ObjectType
|
|
6
|
+
|
|
7
|
+
public class CapacitorScannerHelpers {
|
|
8
|
+
|
|
9
|
+
public static func getAllSupportedFormats() -> [BarcodeFormat] {
|
|
10
|
+
return [.aztec, .code39, .code93, .code128, .dataMatrix, .ean8, .ean13, .itf14, .pdf417, .qr, .upce]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public static func convertStringToBarcodeScannerFormat(_ value: String) -> BarcodeFormat? {
|
|
14
|
+
switch value {
|
|
15
|
+
case "AZTEC":
|
|
16
|
+
return BarcodeFormat.aztec
|
|
17
|
+
case "CODE_39":
|
|
18
|
+
return BarcodeFormat.code39
|
|
19
|
+
case "CODE_93":
|
|
20
|
+
return BarcodeFormat.code93
|
|
21
|
+
case "CODE_128":
|
|
22
|
+
return BarcodeFormat.code128
|
|
23
|
+
case "DATA_MATRIX":
|
|
24
|
+
return BarcodeFormat.dataMatrix
|
|
25
|
+
case "EAN_8":
|
|
26
|
+
return BarcodeFormat.ean8
|
|
27
|
+
case "EAN_13":
|
|
28
|
+
return BarcodeFormat.ean13
|
|
29
|
+
case "ITF14":
|
|
30
|
+
return BarcodeFormat.itf14
|
|
31
|
+
case "PDF_417":
|
|
32
|
+
return BarcodeFormat.pdf417
|
|
33
|
+
case "QR_CODE":
|
|
34
|
+
return BarcodeFormat.qr
|
|
35
|
+
case "UPC_E":
|
|
36
|
+
return BarcodeFormat.upce
|
|
37
|
+
default:
|
|
38
|
+
return nil
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public static func convertBarcodeScannerFormatToString(_ format: BarcodeFormat) -> String? {
|
|
43
|
+
switch format {
|
|
44
|
+
case BarcodeFormat.aztec:
|
|
45
|
+
return "AZTEC"
|
|
46
|
+
case BarcodeFormat.code39:
|
|
47
|
+
return "CODE_39"
|
|
48
|
+
case BarcodeFormat.code93:
|
|
49
|
+
return "CODE_93"
|
|
50
|
+
case BarcodeFormat.code128:
|
|
51
|
+
return "CODE_128"
|
|
52
|
+
case BarcodeFormat.dataMatrix:
|
|
53
|
+
return "DATA_MATRIX"
|
|
54
|
+
case BarcodeFormat.ean8:
|
|
55
|
+
return "EAN_8"
|
|
56
|
+
case BarcodeFormat.ean13:
|
|
57
|
+
return "EAN_13"
|
|
58
|
+
case BarcodeFormat.itf14:
|
|
59
|
+
return "ITF14"
|
|
60
|
+
case BarcodeFormat.pdf417:
|
|
61
|
+
return "PDF_417"
|
|
62
|
+
case BarcodeFormat.qr:
|
|
63
|
+
return "QR_CODE"
|
|
64
|
+
case BarcodeFormat.upce:
|
|
65
|
+
return "UPC_E"
|
|
66
|
+
default:
|
|
67
|
+
return nil
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
}
|