Skip to content

Commit 67bf684

Browse files
authored
[camera_avfoundation] Remove availability checks below the package minimum iOS 13 (flutter#13214)
Remove guarded `cinematicExtended` check. iOS 13 is always available: https://github.com/flutter/packages/blob/01d08731727c8dfcd9519cdbf376aa40499dc8f7/packages/camera/camera_avfoundation/darwin/camera_avfoundation/Package.swift#L12 Also made the Swift switch more idiomatic since there isn't an internal `if` anymore. ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent a8d8f4c commit 67bf684

4 files changed

Lines changed: 27 additions & 16 deletions

File tree

‎packages/camera/camera_avfoundation/CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.11.0+1
2+
3+
* Removes availability checks for iOS versions below the package minimum iOS 13.
4+
15
## 0.11.0
26

37
* Adds support for custom video output path in video recording.

‎packages/camera/camera_avfoundation/darwin/Tests/CameraPropertiesTests.swift‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,23 @@ final class CameraPropertiesTests: XCTestCase {
3434
getPixelFormat(for: .yuv420))
3535
}
3636

37+
// MARK: - Video Stabilization Mode Tests
38+
39+
func testGetAVCaptureVideoStabilizationModeForPigeonVideoStabilizationMode() {
40+
XCTAssertEqual(
41+
AVCaptureVideoStabilizationMode.off,
42+
getAvCaptureVideoStabilizationMode(.off))
43+
XCTAssertEqual(
44+
AVCaptureVideoStabilizationMode.standard,
45+
getAvCaptureVideoStabilizationMode(.standard))
46+
XCTAssertEqual(
47+
AVCaptureVideoStabilizationMode.cinematic,
48+
getAvCaptureVideoStabilizationMode(.cinematic))
49+
XCTAssertEqual(
50+
AVCaptureVideoStabilizationMode.cinematicExtended,
51+
getAvCaptureVideoStabilizationMode(.cinematicExtended))
52+
}
53+
3754
// MARK: - Device Orientation Tests
3855

3956
func testGetUIDeviceOrientationForPigeonDeviceOrientation() {

‎packages/camera/camera_avfoundation/darwin/camera_avfoundation/Sources/camera_avfoundation/CameraProperties.swift‎

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,11 @@ func getPixelFormat(for imageFormat: PlatformImageFormatGroup) -> OSType {
8282
func getAvCaptureVideoStabilizationMode(
8383
_ videoStabilizationMode: PlatformVideoStabilizationMode
8484
) -> AVCaptureVideoStabilizationMode {
85-
8685
switch videoStabilizationMode {
87-
case .off:
88-
return .off
89-
case .standard:
90-
return .standard
91-
case .cinematic:
92-
return .cinematic
93-
case .cinematicExtended:
94-
if #available(iOS 13.0, *) {
95-
return .cinematicExtended
96-
} else {
97-
return .cinematic
98-
}
99-
@unknown default:
100-
return .off
86+
case .off: .off
87+
case .standard: .standard
88+
case .cinematic: .cinematic
89+
case .cinematicExtended: .cinematicExtended
90+
@unknown default: .off
10191
}
10292
}

‎packages/camera/camera_avfoundation/pubspec.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: camera_avfoundation
22
description: iOS implementation of the camera plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_avfoundation
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
5-
version: 0.11.0
5+
version: 0.11.0+1
66

77
environment:
88
sdk: ^3.11.0

0 commit comments

Comments
 (0)