From 83a7722e4a8ed5d53ab2a8795d446f3f3e2d1641 Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Fri, 28 Jun 2024 12:31:11 +0200 Subject: [PATCH] feat(camera): Add Camera option for disabling PWA elements picker --- camera/README.md | 1 + camera/src/definitions.ts | 9 +++++++++ camera/src/web.ts | 3 +++ 3 files changed, 13 insertions(+) diff --git a/camera/README.md b/camera/README.md index 49a48d096..c1d74a7f5 100644 --- a/camera/README.md +++ b/camera/README.md @@ -254,6 +254,7 @@ Request camera and photo album permissions | **`direction`** | CameraDirection | iOS and Web only: The camera direction. | : CameraDirection.Rear | 1.0.0 | | **`presentationStyle`** | 'fullscreen' \| 'popover' | iOS only: The presentation style of the Camera. | : 'fullscreen' | 1.0.0 | | **`webUseInput`** | boolean | Web only: Whether to use the PWA Element experience or file input. The default is to use PWA Elements if installed and fall back to file input. To always use file input, set this to `true`. Learn more about PWA Elements: https://capacitorjs.com/docs/web/pwa-elements | | 1.0.0 | +| **`webHidePicker`** | boolean | Hide the PWA elements file picker button from the camera UI. Requires PWA elements 3.3.0 or newer. | false | 6.1.0 | | **`promptLabelHeader`** | string | Text value to use when displaying the prompt. | : 'Photo' | 1.0.0 | | **`promptLabelCancel`** | string | Text value to use when displaying the prompt. iOS only: The label of the 'cancel' button. | : 'Cancel' | 1.0.0 | | **`promptLabelPhoto`** | string | Text value to use when displaying the prompt. The label of the button to select a saved image. | : 'From Photos' | 1.0.0 | diff --git a/camera/src/definitions.ts b/camera/src/definitions.ts index 83e39aa9a..f2bf2eb27 100644 --- a/camera/src/definitions.ts +++ b/camera/src/definitions.ts @@ -146,6 +146,15 @@ export interface ImageOptions { */ webUseInput?: boolean; + /** + * Hide the PWA elements file picker button from the camera UI. + * Requires PWA elements 3.3.0 or newer. + * @default false + * + * @since 6.1.0 + */ + webHidePicker?: boolean; + /** * Text value to use when displaying the prompt. * @default: 'Photo' diff --git a/camera/src/web.ts b/camera/src/web.ts index 10e7e3fad..071d6304b 100644 --- a/camera/src/web.ts +++ b/camera/src/web.ts @@ -58,6 +58,9 @@ export class CameraWeb extends WebPlugin implements CameraPlugin { const cameraModal: any = document.createElement('pwa-camera-modal'); cameraModal.facingMode = options.direction === CameraDirection.Front ? 'user' : 'environment'; + if (options.webHidePicker) { + cameraModal.hidePicker = options.webHidePicker; + } document.body.appendChild(cameraModal); try { await cameraModal.componentOnReady();