Skip to content

Commit

Permalink
feat(camera): Add Camera option for disabling PWA elements picker
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Jun 28, 2024
1 parent 33bdae1 commit 83a7722
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions camera/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ Request camera and photo album permissions
| **`direction`** | <code><a href="#cameradirection">CameraDirection</a></code> | iOS and Web only: The camera direction. | <code>: CameraDirection.Rear</code> | 1.0.0 |
| **`presentationStyle`** | <code>'fullscreen' \| 'popover'</code> | iOS only: The presentation style of the Camera. | <code>: 'fullscreen'</code> | 1.0.0 |
| **`webUseInput`** | <code>boolean</code> | 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`** | <code>boolean</code> | Hide the PWA elements file picker button from the camera UI. Requires PWA elements 3.3.0 or newer. | <code>false</code> | 6.1.0 |
| **`promptLabelHeader`** | <code>string</code> | Text value to use when displaying the prompt. | <code>: 'Photo'</code> | 1.0.0 |
| **`promptLabelCancel`** | <code>string</code> | Text value to use when displaying the prompt. iOS only: The label of the 'cancel' button. | <code>: 'Cancel'</code> | 1.0.0 |
| **`promptLabelPhoto`** | <code>string</code> | Text value to use when displaying the prompt. The label of the button to select a saved image. | <code>: 'From Photos'</code> | 1.0.0 |
Expand Down
9 changes: 9 additions & 0 deletions camera/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
3 changes: 3 additions & 0 deletions camera/src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 83a7722

Please sign in to comment.