Skip to content

Commit 7af0dbf

Browse files
Fix Swift compiler warnings
1 parent a87b8eb commit 7af0dbf

10 files changed

Lines changed: 11 additions & 19 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.1.6
2+
3+
* Fix Swift compiler warnings: remove unused variables in DeviceEnumerator, PhotoHandler, RecordHandler, and CameraSession
4+
15
## 1.1.5
26

37
* Fix SPM integration by adding missing FlutterFramework dependency to iOS and macOS Package.swift

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Add `camera_desktop` alongside `camera` in your `pubspec.yaml`:
3030
```yaml
3131
dependencies:
3232
camera: ^0.11.0
33-
camera_desktop: ^1.1.5
33+
camera_desktop: ^1.1.6
3434
```
3535
3636
That's it. All three desktop platforms are covered, no additional packages needed.

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ packages:
6363
path: ".."
6464
relative: true
6565
source: path
66-
version: "1.1.5"
66+
version: "1.1.6"
6767
camera_platform_interface:
6868
dependency: "direct main"
6969
description:

ios/camera_desktop.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'camera_desktop'
3-
s.version = '1.1.5'
3+
s.version = '1.1.6'
44
s.summary = 'Flutter camera plugin (iOS stub).'
55
s.description = <<-DESC
66
Flutter camera plugin for desktop platforms. iOS stub for platform declaration.

macos/camera_desktop.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'camera_desktop'
3-
s.version = '1.1.5'
3+
s.version = '1.1.6'
44
s.summary = 'Flutter camera plugin for macOS using AVFoundation.'
55
s.description = <<-DESC
66
A Flutter camera plugin for desktop platforms. On macOS, uses AVFoundation

macos/camera_desktop/Sources/camera_desktop/CameraSession.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,9 @@ class CameraSession: NSObject {
251251
let desiredPreset = DeviceEnumerator.sessionPreset(for: config.resolutionPreset)
252252
let fallbackPresets: [AVCaptureSession.Preset] = [.hd1920x1080, .hd1280x720, .high, .medium]
253253
var chosenPreset: AVCaptureSession.Preset = .medium
254-
var usedFallback = false
255254
if device.supportsSessionPreset(desiredPreset) && session.canSetSessionPreset(desiredPreset) {
256255
chosenPreset = desiredPreset
257256
} else {
258-
usedFallback = true
259257
for fp in fallbackPresets {
260258
if device.supportsSessionPreset(fp) && session.canSetSessionPreset(fp) {
261259
chosenPreset = fp
@@ -371,8 +369,6 @@ class CameraSession: NSObject {
371369
name: .AVCaptureSessionInterruptionEnded,
372370
object: session)
373371

374-
let mirrorEnabled = vOutput.connection(with: .video)?.isVideoMirrored ?? false
375-
376372
captureSession = session
377373
pendingInitResult = result
378374
firstFrameReceived = false
@@ -451,7 +447,7 @@ class CameraSession: NSObject {
451447

452448
sessionQueue.async { [self] in
453449
do {
454-
let path = try self.recordHandler.startRecording(
450+
_ = try self.recordHandler.startRecording(
455451
width: self.actualWidth,
456452
height: self.actualHeight,
457453
targetFps: self.config.targetFps,
@@ -480,8 +476,6 @@ class CameraSession: NSObject {
480476
}
481477

482478
recordHandler.stopRecording { path in
483-
if let path = path {
484-
}
485479
DispatchQueue.main.async {
486480
if let path = path {
487481
result(path)

macos/camera_desktop/Sources/camera_desktop/DeviceEnumerator.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ class DeviceEnumerator {
3838
return aScore < bScore
3939
}
4040

41-
let result = sorted.map { $0.1 }
42-
for (device, _) in sorted {
43-
}
44-
return result
41+
return sorted.map { $0.1 }
4542
}
4643

4744
/// Returns a sort score for camera ordering.

macos/camera_desktop/Sources/camera_desktop/PhotoHandler.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ class PhotoHandler {
88
/// Takes a picture from the given pixel buffer and writes a JPEG to the output path.
99
/// Returns true on success, false on failure.
1010
static func takePicture(from buffer: CVPixelBuffer, outputPath: String) -> Bool {
11-
let width = CVPixelBufferGetWidth(buffer)
12-
let height = CVPixelBufferGetHeight(buffer)
1311
let ciImage = CIImage(cvPixelBuffer: buffer)
1412
let colorSpace = CGColorSpaceCreateDeviceRGB()
1513
guard let jpegData = ciContext.jpegRepresentation(

macos/camera_desktop/Sources/camera_desktop/RecordHandler.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ class RecordHandler: NSObject {
197197
if writer.status == .completed {
198198
completion(path)
199199
} else {
200-
let errorMsg = writer.error?.localizedDescription ?? "unknown error"
201200
completion(nil)
202201
}
203202
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: >-
33
A Flutter camera plugin for desktop platforms (Linux, macOS, Windows).
44
Implements camera_platform_interface for easy integration
55
with the standard camera package.
6-
version: 1.1.5
6+
version: 1.1.6
77
homepage: https://github.com/hugocornellier/camera_desktop
88
repository: https://github.com/hugocornellier/camera_desktop
99
issue_tracker: https://github.com/hugocornellier/camera_desktop/issues

0 commit comments

Comments
 (0)