parent
eec9a3eb6e
commit
fb6ebd9ee1
@ -38,22 +38,22 @@ 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: [String: Any]?
|
||||||
// TODO: Remove this #if once Xcode 15 is rolled out
|
// TODO: Remove this #if once Xcode 15 is rolled out
|
||||||
#if swift(>=5.9)
|
#if swift(>=5.9)
|
||||||
if #available(iOS 17.0, *),
|
if #available(iOS 17.0, *),
|
||||||
let userPreferred = AVCaptureDevice.userPreferredCamera {
|
let userPreferred = AVCaptureDevice.userPreferredCamera {
|
||||||
preferredDevice = userPreferred.toDictionary()
|
preferredDevice = userPreferred.toDictionary()
|
||||||
} else {
|
} else {
|
||||||
preferredDevice = devices[0]
|
preferredDevice = devices.first
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
preferredDevice = devices[0]
|
preferredDevice = devices.first
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return [
|
return [
|
||||||
"availableCameraDevices": devices,
|
"availableCameraDevices": devices,
|
||||||
"userPreferredCameraDevice": preferredDevice,
|
"userPreferredCameraDevice": preferredDevice as Any,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user