fix: Fix build on Xcode 14 (#2033)
* fix: Fix build on Xcode 14 * Format * Make CI run on `macOS-latest` * Nested if
This commit is contained in:
parent
9573ae19cb
commit
2666ac53a6
4
.github/workflows/build-ios.yml
vendored
4
.github/workflows/build-ios.yml
vendored
@ -21,7 +21,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build iOS Example App
|
name: Build iOS Example App
|
||||||
runs-on: macOS-13
|
runs-on: macOS-latest
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
working-directory: package/example/ios
|
working-directory: package/example/ios
|
||||||
@ -80,7 +80,7 @@ jobs:
|
|||||||
|
|
||||||
build-no-frame-processors:
|
build-no-frame-processors:
|
||||||
name: Build iOS Example App without Frame Processors
|
name: Build iOS Example App without Frame Processors
|
||||||
runs-on: macOS-13
|
runs-on: macOS-latest
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
working-directory: package/example/ios
|
working-directory: package/example/ios
|
||||||
|
2
.github/workflows/validate-ios.yml
vendored
2
.github/workflows/validate-ios.yml
vendored
@ -27,7 +27,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
WORKING_DIRECTORY: ios
|
WORKING_DIRECTORY: ios
|
||||||
SwiftFormat:
|
SwiftFormat:
|
||||||
runs-on: macOS-13
|
runs-on: macOS-latest
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
working-directory: ./package/ios
|
working-directory: ./package/ios
|
||||||
|
@ -38,13 +38,15 @@ class CameraDevicesManager: RCTEventEmitter {
|
|||||||
|
|
||||||
override func constantsToExport() -> [AnyHashable: Any]! {
|
override func constantsToExport() -> [AnyHashable: Any]! {
|
||||||
let devices = getDevicesJson()
|
let devices = getDevicesJson()
|
||||||
let preferredDevice: [String: Any]?
|
let preferredDevice = devices.first
|
||||||
if #available(iOS 17.0, *),
|
|
||||||
let userPreferred = AVCaptureDevice.userPreferredCamera {
|
#if swift(>=5.9)
|
||||||
preferredDevice = userPreferred.toDictionary()
|
if #available(iOS 17.0, *) {
|
||||||
} else {
|
if let userPreferred = AVCaptureDevice.userPreferredCamera {
|
||||||
preferredDevice = devices.first
|
preferredDevice = userPreferred.toDictionary()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return [
|
return [
|
||||||
"availableCameraDevices": devices,
|
"availableCameraDevices": devices,
|
||||||
|
@ -32,20 +32,26 @@ extension AVCaptureOutput {
|
|||||||
func setOrientation(_ orientation: Orientation) {
|
func setOrientation(_ orientation: Orientation) {
|
||||||
// Set orientation for each connection
|
// Set orientation for each connection
|
||||||
connections.forEach { connection in
|
connections.forEach { connection in
|
||||||
if #available(iOS 17.0, *) {
|
#if swift(>=5.9)
|
||||||
// Camera Sensors are always in landscape rotation (90deg).
|
if #available(iOS 17.0, *) {
|
||||||
// We are setting the target rotation here, so we need to rotate by landscape once.
|
// Camera Sensors are always in landscape rotation (90deg).
|
||||||
let cameraOrientation = orientation.rotateBy(orientation: .landscapeLeft)
|
// We are setting the target rotation here, so we need to rotate by landscape once.
|
||||||
let degrees = cameraOrientation.toDegrees()
|
let cameraOrientation = orientation.rotateBy(orientation: .landscapeLeft)
|
||||||
|
let degrees = cameraOrientation.toDegrees()
|
||||||
|
|
||||||
if connection.isVideoRotationAngleSupported(degrees) {
|
if connection.isVideoRotationAngleSupported(degrees) {
|
||||||
connection.videoRotationAngle = degrees
|
connection.videoRotationAngle = degrees
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if connection.isVideoOrientationSupported {
|
||||||
|
connection.videoOrientation = orientation.toAVCaptureVideoOrientation()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
#else
|
||||||
if connection.isVideoOrientationSupported {
|
if connection.isVideoOrientationSupported {
|
||||||
connection.videoOrientation = orientation.toAVCaptureVideoOrientation()
|
connection.videoOrientation = orientation.toAVCaptureVideoOrientation()
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user