Skip to content

Commit 82998e1

Browse files
authored
feat: add GS1 DataBar and GS1 DataBar Expanded on iOS (#3403)
fix: enable gs1DataBar and gs1DataBarExtended on the native side
1 parent b982eca commit 82998e1

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

docs/docs/guides/CODE_SCANNING.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ A Code Scanner is a separate Camera output (just like photo or video) that can d
2323
- **Aztec**: Square Aztec codes
2424
- **Data Matrix**: Square Data Matrix codes
2525
- **Barcode (EAN)**: EAN-13 or EAN-8 Barcodes
26-
- **Barcode (Code)**: Code-128, Code-39 or Code-93 Barcodes
27-
- **Barcode (other)**: Codabar, Interleaved2of5 (ITF), ITF-14, UPC-E or PDF-417 Barcodes
26+
- **Barcode (Code)**: Code-128, Code-39, or Code-93 Barcodes
27+
- **Barcode (GS1)**: GS1 DataBar, GS1 DataBar Limited, GS1 DataBar Expanded, and their stacked versions
28+
- **Barcode (other)**: Codabar, Interleaved 2 of 5 (ITF), ITF-14, UPC-E, or PDF-417 Barcodes
2829

2930
## Setup
3031

package/ios/Core/Parsers/AVMetadataObject.ObjectType+descriptor.swift

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,24 @@ extension AVMetadataObject.ObjectType {
2828
throw CameraError.codeScanner(.codeTypeNotSupported(codeType: string))
2929
}
3030
return
31+
case "gs1-data-bar":
32+
if #available(iOS 15.4, *) {
33+
self = .gs1DataBar
34+
} else {
35+
throw CameraError.codeScanner(.codeTypeNotSupported(codeType: string))
36+
}
37+
case "gs1-data-bar-limited":
38+
if #available(iOS 15.4, *) {
39+
self = .gs1DataBarLimited
40+
} else {
41+
throw CameraError.codeScanner(.codeTypeNotSupported(codeType: string))
42+
}
43+
case "gs1-data-bar-expanded":
44+
if #available(iOS 15.4, *) {
45+
self = .gs1DataBarExpanded
46+
} else {
47+
throw CameraError.codeScanner(.codeTypeNotSupported(codeType: string))
48+
}
3149
case "ean-13":
3250
self = .ean13
3351
return
@@ -69,6 +87,21 @@ extension AVMetadataObject.ObjectType {
6987
return "codabar"
7088
}
7189
}
90+
if #available(iOS 15.4, *) {
91+
if self == .gs1DataBar {
92+
return "gs1-data-bar"
93+
}
94+
}
95+
if #available(iOS 15.4, *) {
96+
if self == .gs1DataBarLimited {
97+
return "gs1-data-bar-limited"
98+
}
99+
}
100+
if #available(iOS 15.4, *) {
101+
if self == .gs1DataBarExpanded {
102+
return "gs1-data-bar-expanded"
103+
}
104+
}
72105

73106
switch self {
74107
case .code128:

package/src/types/CodeScanner.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ export type CodeType =
88
| 'code-39'
99
| 'code-93'
1010
| 'codabar'
11+
| 'gs1-data-bar'
12+
| 'gs1-data-bar-limited'
13+
| 'gs1-data-bar-expanded'
1114
| 'ean-13'
1215
| 'ean-8'
1316
| 'itf'

0 commit comments

Comments
 (0)