From 7110b7600f0240280f5e138fb2662c0380040585 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Tue, 19 Mar 2024 11:20:46 +0100 Subject: [PATCH] fix: Remove `enableHighQualityPhotos` entirely --- package/example/src/CameraPage.tsx | 1 - package/ios/CameraView.swift | 6 ++---- package/ios/CameraViewManager.m | 1 - package/ios/Core/CameraConfiguration.swift | 3 +-- package/ios/Core/CameraSession+Configuration.swift | 5 ----- package/ios/Core/CameraSession+Photo.swift | 6 ------ package/src/CameraProps.ts | 12 ------------ 7 files changed, 3 insertions(+), 31 deletions(-) diff --git a/package/example/src/CameraPage.tsx b/package/example/src/CameraPage.tsx index d2d2c7a5ca..164315bcb0 100644 --- a/package/example/src/CameraPage.tsx +++ b/package/example/src/CameraPage.tsx @@ -212,7 +212,6 @@ export function CameraPage({ navigation }: Props): React.ReactElement { video={true} audio={hasMicrophonePermission} frameProcessor={frameProcessor} - enableHighQualityPhotos={true} /> diff --git a/package/ios/CameraView.swift b/package/ios/CameraView.swift index 44c662e42d..16254df1a2 100644 --- a/package/ios/CameraView.swift +++ b/package/ios/CameraView.swift @@ -25,7 +25,6 @@ public final class CameraView: UIView, CameraSessionDelegate { // props that require reconfiguring @objc var cameraId: NSString? @objc var enableDepthData = false - @objc var enableHighQualityPhotos = false @objc var enablePortraitEffectsMatteDelivery = false @objc var enableBufferCompression = false // use cases @@ -179,10 +178,9 @@ public final class CameraView: UIView, CameraSessionDelegate { // Photo if photo { - config.photo = .enabled(config: CameraConfiguration.Photo(enableHighQualityPhotos: enableHighQualityPhotos, + config.photo = .enabled(config: CameraConfiguration.Photo(qualityBalance: getPhotoQualityBalance(), enableDepthData: enableDepthData, - enablePortraitEffectsMatte: enablePortraitEffectsMatteDelivery, - qualityBalance: getPhotoQualityBalance())) + enablePortraitEffectsMatte: enablePortraitEffectsMatteDelivery)) } else { config.photo = .disabled } diff --git a/package/ios/CameraViewManager.m b/package/ios/CameraViewManager.m index ca4b34d370..00e3f03eab 100644 --- a/package/ios/CameraViewManager.m +++ b/package/ios/CameraViewManager.m @@ -25,7 +25,6 @@ @interface RCT_EXTERN_REMAP_MODULE (CameraView, CameraViewManager, RCTViewManage RCT_EXPORT_VIEW_PROPERTY(isActive, BOOL); RCT_EXPORT_VIEW_PROPERTY(cameraId, NSString); RCT_EXPORT_VIEW_PROPERTY(enableDepthData, BOOL); -RCT_EXPORT_VIEW_PROPERTY(enableHighQualityPhotos, BOOL); RCT_EXPORT_VIEW_PROPERTY(enablePortraitEffectsMatteDelivery, BOOL); RCT_EXPORT_VIEW_PROPERTY(enableBufferCompression, BOOL); // use cases diff --git a/package/ios/Core/CameraConfiguration.swift b/package/ios/Core/CameraConfiguration.swift index 7269fa4cc3..3ecaf831ce 100644 --- a/package/ios/Core/CameraConfiguration.swift +++ b/package/ios/Core/CameraConfiguration.swift @@ -147,10 +147,9 @@ class CameraConfiguration { A Photo Output configuration */ struct Photo: Equatable { - var enableHighQualityPhotos = false + var qualityBalance = QualityBalance.balanced var enableDepthData = false var enablePortraitEffectsMatte = false - var qualityBalance = QualityBalance.balanced } /** diff --git a/package/ios/Core/CameraSession+Configuration.swift b/package/ios/Core/CameraSession+Configuration.swift index 89c8f30620..e29f81bff9 100644 --- a/package/ios/Core/CameraSession+Configuration.swift +++ b/package/ios/Core/CameraSession+Configuration.swift @@ -80,11 +80,6 @@ extension CameraSession { let qualityPrioritization = AVCapturePhotoOutput.QualityPrioritization(fromQualityBalance: photo.qualityBalance) photoOutput.maxPhotoQualityPrioritization = qualityPrioritization } - if photo.enableHighQualityPhotos { - // This is deprecated in favor of `maxPhotoDimensions`, but maxPhotoDimensions is by default - // already set to the highest resolution possible (i think?), so we don't need to set that again. - photoOutput.isHighResolutionCaptureEnabled = true - } // TODO: Enable isResponsiveCaptureEnabled? (iOS 17+) // TODO: Enable isFastCapturePrioritizationEnabled? (iOS 17+) if photo.enableDepthData { diff --git a/package/ios/Core/CameraSession+Photo.swift b/package/ios/Core/CameraSession+Photo.swift index 57f0b0eec8..cc3089642c 100644 --- a/package/ios/Core/CameraSession+Photo.swift +++ b/package/ios/Core/CameraSession+Photo.swift @@ -41,12 +41,6 @@ extension CameraSession { // Create photo settings let photoSettings = AVCapturePhotoSettings() - // high resolution capture - if photo.enableHighQualityPhotos { - // TODO: On iOS 16+ this will be removed in favor of maxPhotoDimensions. - photoSettings.isHighResolutionPhotoEnabled = photoOutput.isHighResolutionCaptureEnabled - } - // depth data photoSettings.isDepthDataDeliveryEnabled = photoOutput.isDepthDataDeliveryEnabled if #available(iOS 12.0, *) { diff --git a/package/src/CameraProps.ts b/package/src/CameraProps.ts index 2e65934bac..03800cf785 100644 --- a/package/src/CameraProps.ts +++ b/package/src/CameraProps.ts @@ -265,18 +265,6 @@ export interface CameraProps extends ViewProps { * @default false */ enablePortraitEffectsMatteDelivery?: boolean - /** - * Indicates whether the Camera should prepare the photo pipeline to provide maximum quality photos. - * - * This enables: - * * High Resolution Capture ([`isHighResolutionCaptureEnabled`](https://developer.apple.com/documentation/avfoundation/avcapturephotooutput/1648721-ishighresolutioncaptureenabled)) - * * Virtual Device fusion for greater detail ([`isVirtualDeviceConstituentPhotoDeliveryEnabled`](https://developer.apple.com/documentation/avfoundation/avcapturephotooutput/3192189-isvirtualdeviceconstituentphotod)) - * * Dual Device fusion for greater detail ([`isDualCameraDualPhotoDeliveryEnabled`](https://developer.apple.com/documentation/avfoundation/avcapturephotosettings/2873917-isdualcameradualphotodeliveryena)) - * - * @platform iOS - * @default false - */ - enableHighQualityPhotos?: boolean /** * If `true`, show a debug view to display the FPS of the Video Pipeline (Frame Processor). * This is useful for debugging your Frame Processor's speed.