From db8960580f05ff7fd02d0fd623fe32f81ddd0169 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Wed, 17 Mar 2021 18:07:05 +0100 Subject: [PATCH] Feature/supports focus (#72) * Add `supportsFocus` prop to CameraDevice * Add true-depth camera again * Revert "Add true-depth camera again" This reverts commit 5814b8ca7a15b3273ff29498144bb352619a4c1d. --- .../com/mrousavy/camera/CameraViewModule.kt | 1 + ios/CameraViewManager.swift | 1 + src/CameraDevice.ts | 27 +++++++++++-------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/android/src/main/java/com/mrousavy/camera/CameraViewModule.kt b/android/src/main/java/com/mrousavy/camera/CameraViewModule.kt index da12ec6..3dce48e 100644 --- a/android/src/main/java/com/mrousavy/camera/CameraViewModule.kt +++ b/android/src/main/java/com/mrousavy/camera/CameraViewModule.kt @@ -184,6 +184,7 @@ class CameraViewModule(reactContext: ReactApplicationContext) : ReactContextBase map.putBoolean("supportsRawCapture", supportsRawCapture) map.putBoolean("supportsDepthCapture", supportsDepthCapture) map.putBoolean("supportsLowLightBoost", supportsLowLightBoost) + map.putBoolean("supportsFocus", true) // I believe every device here supports focussing if (zoomRange != null) { map.putDouble("minZoom", zoomRange.lower.toDouble()) map.putDouble("maxZoom", zoomRange.upper.toDouble()) diff --git a/ios/CameraViewManager.swift b/ios/CameraViewManager.swift index 3b0d6d6..10b8ab2 100644 --- a/ios/CameraViewManager.swift +++ b/ios/CameraViewManager.swift @@ -111,6 +111,7 @@ final class CameraViewManager: RCTViewManager { "supportsDepthCapture": false, // TODO: supportsDepthCapture "supportsRawCapture": false, // TODO: supportsRawCapture "supportsLowLightBoost": $0.isLowLightBoostSupported, + "supportsFocus": $0.isFocusPointOfInterestSupported, "formats": $0.formats.map { (format) -> [String: Any] in format.toDictionary() }, diff --git a/src/CameraDevice.ts b/src/CameraDevice.ts index a120aca..a7d2330 100644 --- a/src/CameraDevice.ts +++ b/src/CameraDevice.ts @@ -220,15 +220,20 @@ export interface CameraDevice { * Whether this camera device supports low light boost. */ supportsLowLightBoost: boolean; - - // TODO: supportsDepthCapture - // /** - // * Whether this camera supports taking photos with depth data - // */ - // supportsDepthCapture: boolean; - // TODO: supportsRawCapture - // /** - // * Whether this camera supports taking photos in RAW format - // */ - // supportsRawCapture: boolean; + /** + * Whether this camera supports taking photos with depth data. + * + * **! Work in Progress !** + */ + supportsDepthCapture: boolean; + /** + * Whether this camera supports taking photos in RAW format + * + * **! Work in Progress !** + */ + supportsRawCapture: boolean; + /** + * Specifies whether this device supports focussing ({@linkcode Camera.focus | Camera.focus(...)}) + */ + supportsFocus: boolean; }