capacitor-camera-view 2.0.2 → 2.1.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/README.md +19 -9
- package/android/build.gradle +8 -5
- package/android/src/main/java/com/michaelwolz/capacitorcameraview/CameraView.kt +217 -126
- package/android/src/main/java/com/michaelwolz/capacitorcameraview/CameraViewPlugin.kt +70 -30
- package/android/src/main/java/com/michaelwolz/capacitorcameraview/model/CameraResult.kt +47 -0
- package/android/src/main/java/com/michaelwolz/capacitorcameraview/model/CameraSessionConfiguration.kt +11 -1
- package/android/src/main/java/com/michaelwolz/capacitorcameraview/utils.kt +94 -5
- package/dist/docs.json +81 -0
- package/dist/esm/definitions.d.ts +44 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +7 -1
- package/dist/esm/web.js +67 -2
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +68 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +68 -2
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CameraViewPlugin/CameraError.swift +97 -2
- package/ios/Sources/CameraViewPlugin/CameraEvents.swift +109 -0
- package/ios/Sources/CameraViewPlugin/CameraSessionConfiguration.swift +29 -2
- package/ios/Sources/CameraViewPlugin/CameraViewManager+BarcodeScan.swift +30 -41
- package/ios/Sources/CameraViewPlugin/CameraViewManager+PhotoCapture.swift +45 -13
- package/ios/Sources/CameraViewPlugin/CameraViewManager+VideoDataOutput.swift +4 -3
- package/ios/Sources/CameraViewPlugin/CameraViewManager.swift +112 -41
- package/ios/Sources/CameraViewPlugin/CameraViewPlugin.swift +83 -84
- package/ios/Sources/CameraViewPlugin/TempFileManager.swift +181 -0
- package/ios/Sources/CameraViewPlugin/Utils.swift +102 -0
- package/package.json +17 -17
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import AVFoundation
|
|
2
2
|
|
|
3
|
+
// MARK: - Camera Type Conversion
|
|
4
|
+
|
|
3
5
|
/// Converts string camera type identifiers from JavaScript to native AVCaptureDevice.DeviceType values
|
|
4
6
|
/// - Parameter stringType: The string camera type from JavaScript
|
|
5
7
|
/// - Returns: The corresponding AVCaptureDevice.DeviceType or nil if no match
|
|
@@ -56,9 +58,109 @@ public func convertToNativeCameraTypes(_ stringTypes: [String]) -> [AVCaptureDev
|
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
/// Creates a temporary file URL for storing captured images
|
|
61
|
+
/// @deprecated Use TempFileManager.shared.createTempImageFile() for automatic cleanup
|
|
59
62
|
public func createTempImageFile() throws -> URL {
|
|
60
63
|
let timestamp = Int(Date().timeIntervalSince1970 * 1000)
|
|
61
64
|
let fileName = "camera_capture_\(timestamp).jpg"
|
|
62
65
|
let tempDir = FileManager.default.temporaryDirectory
|
|
63
66
|
return tempDir.appendingPathComponent(fileName)
|
|
64
67
|
}
|
|
68
|
+
|
|
69
|
+
// MARK: - Barcode Type Conversion
|
|
70
|
+
|
|
71
|
+
/// All supported barcode types for detection.
|
|
72
|
+
/// These are enabled by default when no specific types are configured.
|
|
73
|
+
public let ALL_SUPPORTED_BARCODE_TYPES: [AVMetadataObject.ObjectType] = [
|
|
74
|
+
.qr,
|
|
75
|
+
.code128,
|
|
76
|
+
.code39,
|
|
77
|
+
.code39Mod43,
|
|
78
|
+
.code93,
|
|
79
|
+
.ean8,
|
|
80
|
+
.ean13,
|
|
81
|
+
.interleaved2of5,
|
|
82
|
+
.itf14,
|
|
83
|
+
.pdf417,
|
|
84
|
+
.aztec,
|
|
85
|
+
.dataMatrix,
|
|
86
|
+
.upce
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
/// Converts a string barcode type identifier from JavaScript to native AVMetadataObject.ObjectType
|
|
90
|
+
/// - Parameter stringType: The string barcode type from JavaScript
|
|
91
|
+
/// - Returns: The corresponding AVMetadataObject.ObjectType or nil if no match
|
|
92
|
+
public func convertToNativeBarcodeType(_ stringType: String) -> AVMetadataObject.ObjectType? {
|
|
93
|
+
switch stringType {
|
|
94
|
+
case "qr":
|
|
95
|
+
return .qr
|
|
96
|
+
case "code128":
|
|
97
|
+
return .code128
|
|
98
|
+
case "code39":
|
|
99
|
+
return .code39
|
|
100
|
+
case "code39Mod43":
|
|
101
|
+
return .code39Mod43
|
|
102
|
+
case "code93":
|
|
103
|
+
return .code93
|
|
104
|
+
case "ean8":
|
|
105
|
+
return .ean8
|
|
106
|
+
case "ean13":
|
|
107
|
+
return .ean13
|
|
108
|
+
case "interleaved2of5":
|
|
109
|
+
return .interleaved2of5
|
|
110
|
+
case "itf14":
|
|
111
|
+
return .itf14
|
|
112
|
+
case "pdf417":
|
|
113
|
+
return .pdf417
|
|
114
|
+
case "aztec":
|
|
115
|
+
return .aztec
|
|
116
|
+
case "dataMatrix":
|
|
117
|
+
return .dataMatrix
|
|
118
|
+
case "upce":
|
|
119
|
+
return .upce
|
|
120
|
+
default:
|
|
121
|
+
return nil
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/// Converts AVMetadataObject.ObjectType to JavaScript string value
|
|
126
|
+
/// - Parameter barcodeType: The AVMetadataObject.ObjectType
|
|
127
|
+
/// - Returns: The corresponding string or nil if no match
|
|
128
|
+
public func convertToStringBarcodeType(_ barcodeType: AVMetadataObject.ObjectType) -> String? {
|
|
129
|
+
switch barcodeType {
|
|
130
|
+
case .qr:
|
|
131
|
+
return "qr"
|
|
132
|
+
case .code128:
|
|
133
|
+
return "code128"
|
|
134
|
+
case .code39:
|
|
135
|
+
return "code39"
|
|
136
|
+
case .code39Mod43:
|
|
137
|
+
return "code39Mod43"
|
|
138
|
+
case .code93:
|
|
139
|
+
return "code93"
|
|
140
|
+
case .ean8:
|
|
141
|
+
return "ean8"
|
|
142
|
+
case .ean13:
|
|
143
|
+
return "ean13"
|
|
144
|
+
case .interleaved2of5:
|
|
145
|
+
return "interleaved2of5"
|
|
146
|
+
case .itf14:
|
|
147
|
+
return "itf14"
|
|
148
|
+
case .pdf417:
|
|
149
|
+
return "pdf417"
|
|
150
|
+
case .aztec:
|
|
151
|
+
return "aztec"
|
|
152
|
+
case .dataMatrix:
|
|
153
|
+
return "dataMatrix"
|
|
154
|
+
case .upce:
|
|
155
|
+
return "upce"
|
|
156
|
+
default:
|
|
157
|
+
return nil
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/// Converts an array of string barcode type identifiers to native AVMetadataObject.ObjectType values
|
|
162
|
+
/// - Parameter stringTypes: Array of string barcode types from JavaScript
|
|
163
|
+
/// - Returns: Array of AVMetadataObject.ObjectType values (invalid types are filtered out)
|
|
164
|
+
public func convertToNativeBarcodeTypes(_ stringTypes: [String]) -> [AVMetadataObject.ObjectType] {
|
|
165
|
+
return stringTypes.compactMap { convertToNativeBarcodeType($0) }
|
|
166
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "capacitor-camera-view",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "A Capacitor plugin for embedding a live camera feed directly into your app.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -48,33 +48,33 @@
|
|
|
48
48
|
"prepublishOnly": "npm run build"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@capacitor/android": "^8.
|
|
52
|
-
"@capacitor/core": "^8.
|
|
51
|
+
"@capacitor/android": "^8.1.0",
|
|
52
|
+
"@capacitor/core": "^8.1.0",
|
|
53
53
|
"@capacitor/docgen": "^0.3.1",
|
|
54
|
-
"@capacitor/ios": "^8.
|
|
55
|
-
"@commitlint/config-conventional": "^20.
|
|
54
|
+
"@capacitor/ios": "^8.1.0",
|
|
55
|
+
"@commitlint/config-conventional": "^20.4.2",
|
|
56
56
|
"@ionic/prettier-config": "^4.0.0",
|
|
57
57
|
"@ionic/swiftlint-config": "^2.0.0",
|
|
58
58
|
"@semantic-release/changelog": "^6.0.3",
|
|
59
59
|
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
60
60
|
"@semantic-release/git": "^10.0.1",
|
|
61
|
-
"@semantic-release/github": "^12.0.
|
|
62
|
-
"@semantic-release/npm": "^13.1.
|
|
61
|
+
"@semantic-release/github": "^12.0.6",
|
|
62
|
+
"@semantic-release/npm": "^13.1.4",
|
|
63
63
|
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
64
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
65
|
-
"@typescript-eslint/parser": "^8.
|
|
66
|
-
"commitlint": "^20.
|
|
64
|
+
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
65
|
+
"@typescript-eslint/parser": "^8.56.0",
|
|
66
|
+
"commitlint": "^20.4.2",
|
|
67
67
|
"eslint": "^9.39.2",
|
|
68
68
|
"eslint-config-prettier": "^10.1.8",
|
|
69
|
-
"eslint-plugin-prettier": "^5.5.
|
|
69
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
70
70
|
"husky": "^9.1.7",
|
|
71
|
-
"prettier": "^3.
|
|
72
|
-
"prettier-plugin-java": "^2.
|
|
71
|
+
"prettier": "^3.8.1",
|
|
72
|
+
"prettier-plugin-java": "^2.8.1",
|
|
73
73
|
"prettier-plugin-organize-imports": "^4.3.0",
|
|
74
|
-
"prettier-plugin-packagejson": "^
|
|
75
|
-
"rimraf": "^6.1.
|
|
76
|
-
"rollup": "^4.
|
|
77
|
-
"semantic-release": "^25.0.
|
|
74
|
+
"prettier-plugin-packagejson": "^3.0.0",
|
|
75
|
+
"rimraf": "^6.1.3",
|
|
76
|
+
"rollup": "^4.58.0",
|
|
77
|
+
"semantic-release": "^25.0.3",
|
|
78
78
|
"swiftlint": "^2.0.0",
|
|
79
79
|
"typescript": "^5.9.3"
|
|
80
80
|
},
|