diff --git a/camera/README.md b/camera/README.md index 09851033f..4bc55139f 100644 --- a/camera/README.md +++ b/camera/README.md @@ -249,14 +249,15 @@ Request camera and photo album permissions #### GalleryImageOptions -| Prop | Type | Description | Default | Since | -| ------------------------ | -------------------------------------- | ------------------------------------------------------------------------------------------ | --------------------------- | ----- | -| **`quality`** | number | The quality of image to return as JPEG, from 0-100 | | 1.2.0 | -| **`width`** | number | The desired maximum width of the saved image. The aspect ratio is respected. | | 1.2.0 | -| **`height`** | number | The desired maximum height of the saved image. The aspect ratio is respected. | | 1.2.0 | -| **`correctOrientation`** | boolean | Whether to automatically rotate the image "up" to correct for orientation in portrait mode | : true | 1.2.0 | -| **`presentationStyle`** | 'fullscreen' \| 'popover' | iOS only: The presentation style of the Camera. | : 'fullscreen' | 1.2.0 | -| **`limit`** | number | iOS only: Maximum number of pictures the user will be able to choose. | 0 (unlimited) | 1.2.0 | +| Prop | Type | Description | Default | Since | +| ------------------------ | -------------------------------------- | -------------------------------------------------------------------------------------------------------- | --------------------------- | ----- | +| **`exif`** | boolean | Whether to include the exif data in the response. If set to `true`, the `photos` permission is required. | : true | 4.2.0 | +| **`quality`** | number | The quality of image to return as JPEG, from 0-100 | | 1.2.0 | +| **`width`** | number | The desired maximum width of the saved image. The aspect ratio is respected. | | 1.2.0 | +| **`height`** | number | The desired maximum height of the saved image. The aspect ratio is respected. | | 1.2.0 | +| **`correctOrientation`** | boolean | Whether to automatically rotate the image "up" to correct for orientation in portrait mode | : true | 1.2.0 | +| **`presentationStyle`** | 'fullscreen' \| 'popover' | iOS only: The presentation style of the Camera. | : 'fullscreen' | 1.2.0 | +| **`limit`** | number | iOS only: Maximum number of pictures the user will be able to choose. | 0 (unlimited) | 1.2.0 | #### PermissionStatus diff --git a/camera/ios/Plugin/CameraPlugin.swift b/camera/ios/Plugin/CameraPlugin.swift index c5985d96f..2c492662e 100644 --- a/camera/ios/Plugin/CameraPlugin.swift +++ b/camera/ios/Plugin/CameraPlugin.swift @@ -434,14 +434,15 @@ private extension CameraPlugin { } func showPhotos() { + let exif = self.call?.getBool("exif") ?? true // check for permission let authStatus = PHPhotoLibrary.authorizationStatus() - if authStatus == .restricted || authStatus == .denied { + if exif && (authStatus == .restricted || authStatus == .denied) { call?.reject("User denied access to photos") return } // we either already have permission or can prompt - if authStatus == .authorized { + if !exif || authStatus == .authorized { presentSystemAppropriateImagePicker() } else { PHPhotoLibrary.requestAuthorization({ [weak self] (status) in diff --git a/camera/ios/Plugin/ImageSaver.swift b/camera/ios/Plugin/ImageSaver.swift index 1b4979494..a811d889f 100644 --- a/camera/ios/Plugin/ImageSaver.swift +++ b/camera/ios/Plugin/ImageSaver.swift @@ -4,7 +4,7 @@ class ImageSaver: NSObject { var onResult: ((Error?) -> Void) = {_ in } - init(image: UIImage, onResult:@escaping ((Error?) -> Void)) { + init(image: UIImage, onResult: @escaping ((Error?) -> Void)) { self.onResult = onResult super.init() UIImageWriteToSavedPhotosAlbum(image, self, #selector(saveResult), nil) diff --git a/camera/src/definitions.ts b/camera/src/definitions.ts index be10deca8..2bccae782 100644 --- a/camera/src/definitions.ts +++ b/camera/src/definitions.ts @@ -276,6 +276,17 @@ export interface GalleryPhoto { format: string; } export interface GalleryImageOptions { + /** + * Whether to include the exif data in the response. + * + * If set to `true`, the `photos` permission is required. + * + * Only available on iOS. + * + * @default true + * @since 4.2.0 + */ + exif?: boolean; /** * The quality of image to return as JPEG, from 0-100 *