@capacitor/camera 8.1.0-test.20260331 → 8.1.0-test.20260402

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Package.swift CHANGED
@@ -11,7 +11,7 @@ let package = Package(
11
11
  ],
12
12
  dependencies: [
13
13
  .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
14
- .package(url: "https://github.com/ionic-team/ion-ios-camera.git", branch: "main") // TODO: update to a stable release when available
14
+ .package(url: "https://github.com/ionic-team/ion-ios-camera.git", branch: "fix/editable") // TODO extra: revert to main before merging PR; TODO: update to a stable release when available
15
15
  ],
16
16
  targets: [
17
17
  .target(
package/README.md CHANGED
@@ -373,20 +373,19 @@ Allows the user to pick multiple pictures from the photo gallery.
373
373
 
374
374
  #### TakePhotoOptions
375
375
 
376
- | Prop | Type | Description | Default | Since |
377
- | ------------------------ | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- | ----- |
378
- | **`quality`** | <code>number</code> | The quality of image to return, from 0-100. Only applicable for <a href="#encodingtype">`EncodingType.JPEG`</a>. Note: This option is only supported on Android and iOS. | <code>100</code> | 8.1.0 |
379
- | **`targetWidth`** | <code>number</code> | The target width of photos to apply. Must be a positive number, and used along `targetHeight`. Note: This option is only supported on Android and iOS. | | 8.1.0 |
380
- | **`targetHeight`** | <code>number</code> | The target width of photos to apply. Must be a positive number, and used along `targetWidth`. Note: This option is only supported on Android and iOS. | | 8.1.0 |
381
- | **`correctOrientation`** | <code>boolean</code> | Whether to automatically rotate the image "up" to correct for orientation in portrait mode. Note: This option is only supported on Android and iOS | <code>true</code> | 8.1.0 |
382
- | **`encodingType`** | <code><a href="#encodingtype">EncodingType</a></code> | The encoding type for the captured photo - JPEG or PNG. Note: This option is only supported on Android and iOS. | <code>EncodingType.JPEG</code> | 8.1.0 |
383
- | **`saveToGallery`** | <code>boolean</code> | Whether to save the photo to the gallery. Note: This option is only supported on Android and iOS. | <code>false</code> | 8.1.0 |
384
- | **`cameraDirection`** | <code><a href="#cameradirection">CameraDirection</a></code> | iOS and Web only: The camera direction. | <code>CameraDirection.Rear</code> | 8.1.0 |
385
- | **`allowEdit`** | <code>boolean</code> | Whether to allow the user to crop or make small edits. Note: This option is only supported on Android and iOS. | <code>false</code> | 8.1.0 |
386
- | **`editInApp`** | <code>boolean</code> | If `true`, will use an in-app editor for photo edition. If `false`, will open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available. Only applicable with `allowEdit` set to true. Note: This option is only supported on Android and iOS. | <code>true</code> | 8.1.0 |
387
- | **`presentationStyle`** | <code>'fullscreen' \| 'popover'</code> | iOS only: The presentation style of the Camera. | <code>'fullscreen'</code> | 8.1.0 |
388
- | **`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 | | 8.1.0 |
389
- | **`includeMetadata`** | <code>boolean</code> | Whether or not <a href="#mediaresult">MediaResult</a> should include its metadata. If an error occurs when obtaining the metadata, it will return empty. | <code>false</code> | 8.1.0 |
376
+ | Prop | Type | Description | Default | Since |
377
+ | ------------------------ | ----------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- | ----- |
378
+ | **`quality`** | <code>number</code> | The quality of image to return, from 0-100. Only applicable for <a href="#encodingtype">`EncodingType.JPEG`</a>. Note: This option is only supported on Android and iOS. | <code>100</code> | 8.1.0 |
379
+ | **`targetWidth`** | <code>number</code> | The target width of photos to apply. Must be a positive number, and used along `targetHeight`. Note: This option is only supported on Android and iOS. | | 8.1.0 |
380
+ | **`targetHeight`** | <code>number</code> | The target width of photos to apply. Must be a positive number, and used along `targetWidth`. Note: This option is only supported on Android and iOS. | | 8.1.0 |
381
+ | **`correctOrientation`** | <code>boolean</code> | Whether to automatically rotate the image "up" to correct for orientation in portrait mode. Note: This option is only supported on Android and iOS | <code>true</code> | 8.1.0 |
382
+ | **`encodingType`** | <code><a href="#encodingtype">EncodingType</a></code> | The encoding type for the captured photo - JPEG or PNG. Note: This option is only supported on Android and iOS. | <code>EncodingType.JPEG</code> | 8.1.0 |
383
+ | **`saveToGallery`** | <code>boolean</code> | Whether to save the photo to the gallery. Note: This option is only supported on Android and iOS. | <code>false</code> | 8.1.0 |
384
+ | **`cameraDirection`** | <code><a href="#cameradirection">CameraDirection</a></code> | iOS and Web only: The camera direction. | <code>CameraDirection.Rear</code> | 8.1.0 |
385
+ | **`editable`** | <code>'in-app' \| 'external' \| 'no'</code> | Determines if and how the user can edit the photo. - 'in-app': Use an in-app editor for photo edition. - 'external': Open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available. Note: iOS does not support external editing and will use 'in-app' instead. - 'no': No editing allowed. Not available on Web. | <code>'no'</code> | 8.1.0 |
386
+ | **`presentationStyle`** | <code>'fullscreen' \| 'popover'</code> | iOS only: The presentation style of the Camera. | <code>'fullscreen'</code> | 8.1.0 |
387
+ | **`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 | | 8.1.0 |
388
+ | **`includeMetadata`** | <code>boolean</code> | Whether or not <a href="#mediaresult">MediaResult</a> should include its metadata. If an error occurs when obtaining the metadata, it will return empty. | <code>false</code> | 8.1.0 |
390
389
 
391
390
 
392
391
  #### RecordVideoOptions
@@ -414,20 +413,19 @@ Allows the user to pick multiple pictures from the photo gallery.
414
413
 
415
414
  #### ChooseFromGalleryOptions
416
415
 
417
- | Prop | Type | Description | Default | Since |
418
- | ---------------------------- | ----------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | ----- |
419
- | **`mediaType`** | <code><a href="#mediatypeselection">MediaTypeSelection</a></code> | The type of media to select. Can be pictures, videos, or both. | <code>MediaTypeSelection.Photo</code> | 8.1.0 |
420
- | **`allowMultipleSelection`** | <code>boolean</code> | Whether or not to allow selecting multiple media files from the gallery. | <code>false</code> | 8.1.0 |
421
- | **`limit`** | <code>number</code> | The maximum number of media files that the user can choose. Only applicable if `allowMultipleSelection` is `true`. Any non-positive number will be treated as unlimited. Note: This option is only supported on Android 13+ and iOS. | <code>0</code> | 8.1.0 |
422
- | **`includeMetadata`** | <code>boolean</code> | Whether or not <a href="#mediaresult">MediaResult</a> should include its metadata. If an error occurs when obtaining the metadata, it will return empty. | <code>false</code> | 8.1.0 |
423
- | **`allowEdit`** | <code>boolean</code> | Whether to allow the user to crop or make small edits. Only applicable for <a href="#mediatypeselection">`MediaTypeSelection.Photo`</a> and `allowMultipleSelection` set to `false`. Note: This option is only supported on Android and iOS. | <code>false</code> | 8.1.0 |
424
- | **`editInApp`** | <code>boolean</code> | If `true`, will use an in-app editor for photo edition. If `false`, will open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available. Only applicable with `allowEdit` set to true. Note: This option is only supported on Android and iOS. | <code>true</code> | 8.1.0 |
425
- | **`presentationStyle`** | <code>'fullscreen' \| 'popover'</code> | iOS only: The presentation style of media picker. | <code>'fullscreen'</code> | 8.1.0 |
426
- | **`quality`** | <code>number</code> | The quality of images to return, from 0-100. Only applicable for <a href="#mediatype">`MediaType.Photo`</a> and JPEG format. Note: This option is only supported on Android and iOS. | <code>100</code> | 8.1.0 |
427
- | **`targetWidth`** | <code>number</code> | The target width of photos to apply. Must be a positive number, and used along `targetHeight`. Not applicable when videos are selected. Note: This option is only supported on Android and iOS. | | 1.0.0 |
428
- | **`targetHeight`** | <code>number</code> | The target width of photos to apply. Must be a positive number, and used along `targetWidth`. Not applicable when videos are selected. Note: This option is only supported on Android and iOS. | | 8.1.0 |
429
- | **`correctOrientation`** | <code>boolean</code> | Whether to automatically rotate the image "up" to correct for orientation in portrait mode. Not applicable when videos are selected. Note: This option is only supported on Android and iOS | <code>true</code> | 8.1.0 |
430
- | **`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 | | 8.1.0 |
416
+ | Prop | Type | Description | Default | Since |
417
+ | ---------------------------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | ----- |
418
+ | **`mediaType`** | <code><a href="#mediatypeselection">MediaTypeSelection</a></code> | The type of media to select. Can be pictures, videos, or both. | <code>MediaTypeSelection.Photo</code> | 8.1.0 |
419
+ | **`allowMultipleSelection`** | <code>boolean</code> | Whether or not to allow selecting multiple media files from the gallery. | <code>false</code> | 8.1.0 |
420
+ | **`limit`** | <code>number</code> | The maximum number of media files that the user can choose. Only applicable if `allowMultipleSelection` is `true`. Any non-positive number will be treated as unlimited. Note: This option is only supported on Android 13+ and iOS. | <code>0</code> | 8.1.0 |
421
+ | **`includeMetadata`** | <code>boolean</code> | Whether or not <a href="#mediaresult">MediaResult</a> should include its metadata. If an error occurs when obtaining the metadata, it will return empty. | <code>false</code> | 8.1.0 |
422
+ | **`editable`** | <code>'in-app' \| 'external' \| 'no'</code> | Determines if and how the user can edit the photo. - 'in-app': Use an in-app editor for photo edition. - 'external': Open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available. Note: iOS does not support external editing and will use 'in-app' instead. - 'no': No editing allowed. Only applicable for <a href="#mediatypeselection">`MediaTypeSelection.Photo`</a> and `allowMultipleSelection` set to `false`. Not available on Web. | <code>'no'</code> | 8.1.0 |
423
+ | **`presentationStyle`** | <code>'fullscreen' \| 'popover'</code> | iOS only: The presentation style of media picker. | <code>'fullscreen'</code> | 8.1.0 |
424
+ | **`quality`** | <code>number</code> | The quality of images to return, from 0-100. Only applicable for <a href="#mediatype">`MediaType.Photo`</a> and JPEG format. Note: This option is only supported on Android and iOS. | <code>100</code> | 8.1.0 |
425
+ | **`targetWidth`** | <code>number</code> | The target width of photos to apply. Must be a positive number, and used along `targetHeight`. Not applicable when videos are selected. Note: This option is only supported on Android and iOS. | | 1.0.0 |
426
+ | **`targetHeight`** | <code>number</code> | The target width of photos to apply. Must be a positive number, and used along `targetWidth`. Not applicable when videos are selected. Note: This option is only supported on Android and iOS. | | 8.1.0 |
427
+ | **`correctOrientation`** | <code>boolean</code> | Whether to automatically rotate the image "up" to correct for orientation in portrait mode. Not applicable when videos are selected. Note: This option is only supported on Android and iOS | <code>true</code> | 8.1.0 |
428
+ | **`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 | | 8.1.0 |
431
429
 
432
430
 
433
431
  #### EditPhotoResult
@@ -89,5 +89,5 @@ dependencies {
89
89
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
90
90
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
91
91
  implementation 'com.google.code.gson:gson:2.10.1'
92
- implementation 'io.ionic.libs:ioncamera-android:0.1.0@aar'
92
+ implementation 'io.ionic.libs:ioncamera-android:0.1.0'
93
93
  }
@@ -201,8 +201,7 @@ class IonCameraFlow(
201
201
  allowMultipleSelection = call.getBoolean("allowMultipleSelection") ?: false,
202
202
  limit = call.getInt("limit") ?: 0,
203
203
  includeMetadata = call.getBoolean("includeMetadata") ?: false,
204
- allowEdit = call.getBoolean("allowEdit") ?: false,
205
- editInApp = call.getBoolean("editInApp") ?: true,
204
+ editable = IonEditableMode.fromString(call.getString("editable")),
206
205
  quality = call.getInt("quality") ?: DEFAULT_QUALITY,
207
206
  width = call.getInt("targetWidth") ?: 0,
208
207
  height = call.getInt("targetHeight") ?: 0,
@@ -215,8 +214,7 @@ class IonCameraFlow(
215
214
  var allowMultipleSelection: Boolean = false,
216
215
  var limit: Int = 0,
217
216
  var includeMetadata: Boolean = false,
218
- var allowEdit: Boolean = false,
219
- var editInApp: Boolean = true,
217
+ var editable: IonEditableMode = IonEditableMode.NO,
220
218
  var quality: Int = 90,
221
219
  var width: Int = 0,
222
220
  var height: Int = 0,
@@ -235,8 +233,7 @@ class IonCameraFlow(
235
233
  settings.correctOrientation = call.getBoolean("correctOrientation") ?: IonCameraSettings.DEFAULT_CORRECT_ORIENTATION
236
234
  settings.encodingType = call.getInt("encodingType") ?: IonCameraSettings.DEFAULT_ENCODING_TYPE
237
235
  settings.saveToGallery = call.getBoolean("saveToGallery") ?: IonCameraSettings.DEFAULT_SAVE_IMAGE_TO_GALLERY
238
- settings.allowEdit = call.getBoolean("allowEdit") ?: false
239
- settings.editInApp = call.getBoolean("editInApp") ?: true
236
+ settings.editable = IonEditableMode.fromString(call.getString("editable"))
240
237
  settings.includeMetadata = call.getBoolean("includeMetadata") ?: false
241
238
  settings.shouldResize = settings.targetWidth > 0 || settings.targetHeight > 0
242
239
  return settings
@@ -355,7 +352,10 @@ class IonCameraFlow(
355
352
  )
356
353
 
357
354
  val imageBase64 = call.getString("inputImage")
358
- if (imageBase64 == null) return
355
+ if (imageBase64.isNullOrEmpty()) {
356
+ sendError(IONCAMRError.INVALID_ARGUMENT_ERROR)
357
+ return
358
+ }
359
359
  manager.editImage(activity, imageBase64, editLauncher)
360
360
  }
361
361
 
@@ -389,10 +389,11 @@ class IonCameraFlow(
389
389
  sendError(IONCAMRError.INVALID_ARGUMENT_ERROR)
390
390
  return
391
391
  }
392
- if (settings.allowEdit) {
393
- if (settings.editInApp) {
392
+ when (settings.editable) {
393
+ IonEditableMode.IN_APP -> {
394
394
  editPhoto()
395
- } else {
395
+ }
396
+ IonEditableMode.EXTERNAL -> {
396
397
  val editor = editManager ?: run {
397
398
  sendError(IONCAMRError.CONTEXT_ERROR)
398
399
  return
@@ -419,8 +420,9 @@ class IonCameraFlow(
419
420
  editPhoto()
420
421
  }
421
422
  }
422
- } else {
423
- processResult(result.data)
423
+ IonEditableMode.NO -> {
424
+ processResult(result.data)
425
+ }
424
426
  }
425
427
  }
426
428
  Activity.RESULT_CANCELED -> {
@@ -469,36 +471,40 @@ class IonCameraFlow(
469
471
  return
470
472
  }
471
473
 
472
- if (settings.allowEdit && uris.size == 1 && settings.mediaType == IONCAMRMediaType.PICTURE) {
474
+ if (settings.editable != IonEditableMode.NO && uris.size == 1 && settings.mediaType == IONCAMRMediaType.PICTURE) {
473
475
  val originalUri = uris.first()
474
- if (settings.editInApp) {
475
- editor.openCropActivity(
476
- activity,
477
- originalUri,
478
- galleryCropLauncher
479
- )
480
- } else {
481
- val tempUri = if (originalUri.scheme == "content") {
482
- IonCameraUtils.getGalleryTempImage(activity, originalUri)
483
- } else {
484
- originalUri
485
- }
486
-
487
- if (tempUri == null) {
488
- sendError(IONCAMRError.EDIT_IMAGE_ERROR)
489
- return
490
- }
491
-
492
- val editIntent = createEditIntent(tempUri)
493
- if (editIntent != null) {
494
- galleryCropLauncher.launch(editIntent)
495
- } else {
476
+ when (settings.editable) {
477
+ IonEditableMode.IN_APP -> {
496
478
  editor.openCropActivity(
497
479
  activity,
498
480
  originalUri,
499
481
  galleryCropLauncher
500
482
  )
501
483
  }
484
+ IonEditableMode.EXTERNAL -> {
485
+ val tempUri = if (originalUri.scheme == "content") {
486
+ IonCameraUtils.getGalleryTempImage(activity, originalUri)
487
+ } else {
488
+ originalUri
489
+ }
490
+
491
+ if (tempUri == null) {
492
+ sendError(IONCAMRError.EDIT_IMAGE_ERROR)
493
+ return
494
+ }
495
+
496
+ val editIntent = createEditIntent(tempUri)
497
+ if (editIntent != null) {
498
+ galleryCropLauncher.launch(editIntent)
499
+ } else {
500
+ editor.openCropActivity(
501
+ activity,
502
+ originalUri,
503
+ galleryCropLauncher
504
+ )
505
+ }
506
+ }
507
+ else -> {}
502
508
  }
503
509
  } else {
504
510
  processResultFromGallery(result)
@@ -535,7 +541,7 @@ class IonCameraFlow(
535
541
  lastEditUri = null
536
542
  }
537
543
  Activity.RESULT_CANCELED -> {
538
- if (!settings.editInApp && !lastEditUri.isNullOrEmpty()) {
544
+ if (settings.editable == IonEditableMode.EXTERNAL && !lastEditUri.isNullOrEmpty()) {
539
545
  val intent = Intent().apply {
540
546
  putExtra(IONCAMRImageEditorActivity.IMAGE_OUTPUT_URI_EXTRAS, lastEditUri)
541
547
  }
@@ -693,7 +699,7 @@ class IonCameraFlow(
693
699
  lastEditUri = null
694
700
  }
695
701
  Activity.RESULT_CANCELED -> {
696
- if (!settings.editInApp && !lastEditUri.isNullOrEmpty()) {
702
+ if (settings.editable == IonEditableMode.EXTERNAL && !lastEditUri.isNullOrEmpty()) {
697
703
  val intent = Intent().apply {
698
704
  putExtra(IONCAMRImageEditorActivity.IMAGE_OUTPUT_URI_EXTRAS, lastEditUri)
699
705
  }
@@ -933,7 +939,7 @@ class IonCameraFlow(
933
939
  targetHeight = targetHeight,
934
940
  encodingType = encodingType,
935
941
  mediaType = MEDIA_TYPE_PHOTO,
936
- allowEdit = allowEdit,
942
+ allowEdit = editable != IonEditableMode.NO,
937
943
  correctOrientation = correctOrientation,
938
944
  saveToPhotoAlbum = saveToGallery,
939
945
  includeMetadata = includeMetadata,
@@ -7,8 +7,7 @@ class IonCameraSettings {
7
7
  var correctOrientation: Boolean = DEFAULT_CORRECT_ORIENTATION
8
8
  var encodingType: Int = 0 //JPEG
9
9
  var saveToGallery: Boolean = DEFAULT_SAVE_IMAGE_TO_GALLERY
10
- var allowEdit: Boolean = false
11
- var editInApp: Boolean = true
10
+ var editable: IonEditableMode = IonEditableMode.NO
12
11
  var includeMetadata: Boolean = false
13
12
  var shouldResize: Boolean = false
14
13
 
@@ -0,0 +1,16 @@
1
+ package com.capacitorjs.plugins.camera
2
+
3
+ enum class IonEditableMode(val value: String) {
4
+ NO("no"),
5
+ IN_APP("in-app"),
6
+ EXTERNAL("external");
7
+
8
+ companion object {
9
+ fun fromString(value: String?): IonEditableMode {
10
+ if (value == null) return NO
11
+ return values().find {
12
+ it.value.equals(value, ignoreCase = true)
13
+ } ?: NO
14
+ }
15
+ }
16
+ }
@@ -7,8 +7,7 @@ class IonGallerySettings {
7
7
  var allowMultipleSelection: Boolean = false
8
8
  var limit: Int = 0
9
9
  var includeMetadata: Boolean = false
10
- var allowEdit: Boolean = false
11
- var editInApp: Boolean = true
10
+ var editable: IonEditableMode = IonEditableMode.NO
12
11
  var quality: Int = DEFAULT_QUALITY
13
12
  var width: Int = 0
14
13
  var height: Int = 0
package/dist/docs.json CHANGED
@@ -565,26 +565,10 @@
565
565
  "type": "CameraDirection"
566
566
  },
567
567
  {
568
- "name": "allowEdit",
568
+ "name": "editable",
569
569
  "tags": [
570
570
  {
571
- "text": "false",
572
- "name": "default"
573
- },
574
- {
575
- "text": "8.1.0",
576
- "name": "since"
577
- }
578
- ],
579
- "docs": "Whether to allow the user to crop or make small edits.\nNote: This option is only supported on Android and iOS.",
580
- "complexTypes": [],
581
- "type": "boolean | undefined"
582
- },
583
- {
584
- "name": "editInApp",
585
- "tags": [
586
- {
587
- "text": "true",
571
+ "text": "'no'",
588
572
  "name": "default"
589
573
  },
590
574
  {
@@ -592,9 +576,9 @@
592
576
  "name": "since"
593
577
  }
594
578
  ],
595
- "docs": "If `true`, will use an in-app editor for photo edition.\nIf `false`, will open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available.\nOnly applicable with `allowEdit` set to true.\nNote: This option is only supported on Android and iOS.",
579
+ "docs": "Determines if and how the user can edit the photo.\n- 'in-app': Use an in-app editor for photo edition.\n- 'external': Open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available. Note: iOS does not support external editing and will use 'in-app' instead.\n- 'no': No editing allowed.\nNot available on Web.",
596
580
  "complexTypes": [],
597
- "type": "boolean | undefined"
581
+ "type": "'in-app' | 'external' | 'no' | undefined"
598
582
  },
599
583
  {
600
584
  "name": "presentationStyle",
@@ -817,26 +801,10 @@
817
801
  "type": "boolean | undefined"
818
802
  },
819
803
  {
820
- "name": "allowEdit",
804
+ "name": "editable",
821
805
  "tags": [
822
806
  {
823
- "text": "false",
824
- "name": "default"
825
- },
826
- {
827
- "text": "8.1.0",
828
- "name": "since"
829
- }
830
- ],
831
- "docs": "Whether to allow the user to crop or make small edits.\nOnly applicable for `MediaTypeSelection.Photo` and `allowMultipleSelection` set to `false`.\nNote: This option is only supported on Android and iOS.",
832
- "complexTypes": [],
833
- "type": "boolean | undefined"
834
- },
835
- {
836
- "name": "editInApp",
837
- "tags": [
838
- {
839
- "text": "true",
807
+ "text": "'no'",
840
808
  "name": "default"
841
809
  },
842
810
  {
@@ -844,9 +812,9 @@
844
812
  "name": "since"
845
813
  }
846
814
  ],
847
- "docs": "If `true`, will use an in-app editor for photo edition.\nIf `false`, will open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available.\nOnly applicable with `allowEdit` set to true.\nNote: This option is only supported on Android and iOS.",
815
+ "docs": "Determines if and how the user can edit the photo.\n- 'in-app': Use an in-app editor for photo edition.\n- 'external': Open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available. Note: iOS does not support external editing and will use 'in-app' instead.\n- 'no': No editing allowed.\nOnly applicable for `MediaTypeSelection.Photo` and `allowMultipleSelection` set to `false`.\nNot available on Web.",
848
816
  "complexTypes": [],
849
- "type": "boolean | undefined"
817
+ "type": "'in-app' | 'external' | 'no' | undefined"
850
818
  },
851
819
  {
852
820
  "name": "presentationStyle",
@@ -150,23 +150,16 @@ export interface TakePhotoOptions {
150
150
  */
151
151
  cameraDirection?: CameraDirection;
152
152
  /**
153
- * Whether to allow the user to crop or make small edits.
154
- * Note: This option is only supported on Android and iOS.
155
- * @default false
156
- *
157
- * @since 8.1.0
158
- */
159
- allowEdit?: boolean;
160
- /**
161
- * If `true`, will use an in-app editor for photo edition.
162
- * If `false`, will open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available.
163
- * Only applicable with `allowEdit` set to true.
164
- * Note: This option is only supported on Android and iOS.
153
+ * Determines if and how the user can edit the photo.
154
+ * - 'in-app': Use an in-app editor for photo edition.
155
+ * - 'external': Open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available. Note: iOS does not support external editing and will use 'in-app' instead.
156
+ * - 'no': No editing allowed.
157
+ * Not available on Web.
158
+ * @default 'no'
165
159
  *
166
- * @default true
167
160
  * @since 8.1.0
168
161
  */
169
- editInApp?: boolean;
162
+ editable?: 'in-app' | 'external' | 'no';
170
163
  /**
171
164
  * iOS only: The presentation style of the Camera.
172
165
  * @default 'fullscreen'
@@ -262,24 +255,17 @@ export interface ChooseFromGalleryOptions {
262
255
  */
263
256
  includeMetadata?: boolean;
264
257
  /**
265
- * Whether to allow the user to crop or make small edits.
258
+ * Determines if and how the user can edit the photo.
259
+ * - 'in-app': Use an in-app editor for photo edition.
260
+ * - 'external': Open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available. Note: iOS does not support external editing and will use 'in-app' instead.
261
+ * - 'no': No editing allowed.
266
262
  * Only applicable for `MediaTypeSelection.Photo` and `allowMultipleSelection` set to `false`.
267
- * Note: This option is only supported on Android and iOS.
268
- * @default false
269
- *
270
- * @since 8.1.0
271
- */
272
- allowEdit?: boolean;
273
- /**
274
- * If `true`, will use an in-app editor for photo edition.
275
- * If `false`, will open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available.
276
- * Only applicable with `allowEdit` set to true.
277
- * Note: This option is only supported on Android and iOS.
263
+ * Not available on Web.
264
+ * @default 'no'
278
265
  *
279
- * @default true
280
266
  * @since 8.1.0
281
267
  */
282
- editInApp?: boolean;
268
+ editable?: 'in-app' | 'external' | 'no';
283
269
  /**
284
270
  * iOS only: The presentation style of media picker.
285
271
  * @default 'fullscreen'
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAozBA;;;GAGG;AACH,MAAM,CAAN,IAAY,YAaX;AAbD,WAAY,YAAY;IACtB;;OAEG;IACH,iCAAiB,CAAA;IACjB;;OAEG;IACH,iCAAiB,CAAA;IACjB;;OAEG;IACH,iCAAiB,CAAA;AACnB,CAAC,EAbW,YAAY,KAAZ,YAAY,QAavB;AAED,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,kCAAe,CAAA;AACjB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,qCAAiB,CAAA;IACjB,uCAAmB,CAAA;AACrB,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B;AAED,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,2CAAS,CAAA;IACT,2CAAS,CAAA;AACX,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,6DAAS,CAAA;IACT,6DAAS,CAAA;IACT,yDAAO,CAAA;AACT,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B;AAED,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,+CAAQ,CAAA;IACR,6CAAO,CAAA;AACT,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB","sourcesContent":["import type { PermissionState } from '@capacitor/core';\n\nexport type CameraPermissionState = PermissionState | 'limited';\n\nexport type CameraPermissionType = 'camera' | 'photos';\n\nexport interface PermissionStatus {\n camera: CameraPermissionState;\n photos: CameraPermissionState;\n}\n\nexport interface CameraPluginPermissions {\n permissions: CameraPermissionType[];\n}\n\nexport interface CameraPlugin {\n /**\n * Open the device's camera and allow the user to take a photo.\n *\n * @since 8.1.0\n */\n takePhoto(options: TakePhotoOptions): Promise<MediaResult>;\n\n /**\n * Open the device's camera and allow the user to record a video.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n recordVideo(options: RecordVideoOptions): Promise<MediaResult>;\n\n /**\n * Open a native video player.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n playVideo(options: PlayVideoOptions): Promise<void>;\n\n /**\n * Allow users to choose pictures, videos, or both, directly from their gallery.\n *\n * @since 8.1.0\n */\n chooseFromGallery(options: ChooseFromGalleryOptions): Promise<MediaResults>;\n\n /**\n * Open an in-app screen to edit a given photo using the provided base64 string.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n editPhoto(options: EditPhotoOptions): Promise<EditPhotoResult>;\n\n /**\n * Open an in-app screen to edit a photo using the provided URI.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n editURIPhoto(options: EditURIPhotoOptions): Promise<MediaResult>;\n\n /**\n * Allows the user to update their limited photo library selection.\n * Returns all the limited photos after the picker dismissal.\n * If instead the user gave full access to the photos it returns an empty array.\n *\n * @since 4.1.0\n */\n pickLimitedLibraryPhotos(): Promise<GalleryPhotos>;\n /**\n * Return an array of photos selected from the limited photo library.\n *\n * @since 4.1.0\n */\n getLimitedLibraryPhotos(): Promise<GalleryPhotos>;\n\n /**\n * Check camera and photo album permissions\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request camera and photo album permissions\n *\n * @since 1.0.0\n */\n requestPermissions(permissions?: CameraPluginPermissions): Promise<PermissionStatus>;\n\n /**\n * Prompt the user to pick a photo from an album, or take a new photo\n * with the camera.\n *\n * @since 1.0.0\n * @deprecated Use `takePhoto` for a camera photo, or `chooseFromGallery` to select from the gallery. For creating a prompt for the user to select which source, use `@capacitor/action-sheet` or any UI component of your choosing. Refer to the Camera API documentation for more information on migrating.\n */\n getPhoto(options: ImageOptions): Promise<Photo>;\n\n /**\n * Allows the user to pick multiple pictures from the photo gallery.\n *\n * @since 1.2.0\n * @deprecated Use `chooseFromGallery` instead. Refer to the Camera API documentation for more information on migrating.\n */\n pickImages(options: GalleryImageOptions): Promise<GalleryPhotos>;\n}\n\nexport interface TakePhotoOptions {\n /**\n * The quality of image to return, from 0-100.\n * Only applicable for `EncodingType.JPEG`.\n * Note: This option is only supported on Android and iOS.\n *\n * @default 100\n * @since 8.1.0\n */\n quality?: number;\n\n /**\n * The target width of photos to apply.\n * Must be a positive number, and used along `targetHeight`.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 8.1.0\n */\n targetWidth?: number;\n\n /**\n * The target width of photos to apply.\n * Must be a positive number, and used along `targetWidth`.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 8.1.0\n */\n targetHeight?: number;\n\n /**\n * Whether to automatically rotate the image \"up\" to correct for orientation\n * in portrait mode.\n * Note: This option is only supported on Android and iOS\n * @default true\n *\n * @since 8.1.0\n */\n correctOrientation?: boolean;\n\n /**\n * The encoding type for the captured photo - JPEG or PNG.\n * Note: This option is only supported on Android and iOS.\n * @default EncodingType.JPEG\n *\n * @since 8.1.0\n */\n encodingType?: EncodingType;\n\n /**\n * Whether to save the photo to the gallery.\n * Note: This option is only supported on Android and iOS.\n * @default false\n *\n * @since 8.1.0\n */\n saveToGallery?: boolean;\n\n /**\n * iOS and Web only: The camera direction.\n * @default CameraDirection.Rear\n *\n * @since 8.1.0\n */\n cameraDirection?: CameraDirection;\n\n /**\n * Whether to allow the user to crop or make small edits.\n * Note: This option is only supported on Android and iOS.\n * @default false\n *\n * @since 8.1.0\n */\n allowEdit?: boolean;\n\n /**\n * If `true`, will use an in-app editor for photo edition.\n * If `false`, will open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available.\n * Only applicable with `allowEdit` set to true.\n * Note: This option is only supported on Android and iOS.\n *\n * @default true\n * @since 8.1.0\n */\n editInApp?: boolean;\n\n /**\n * iOS only: The presentation style of the Camera.\n * @default 'fullscreen'\n *\n * @since 8.1.0\n */\n presentationStyle?: 'fullscreen' | 'popover';\n\n /**\n * Web only: Whether to use the PWA Element experience or file input. The\n * default is to use PWA Elements if installed and fall back to file input.\n * To always use file input, set this to `true`.\n *\n * Learn more about PWA Elements: https://capacitorjs.com/docs/web/pwa-elements\n *\n * @since 8.1.0\n */\n webUseInput?: boolean;\n\n /**\n * Whether or not MediaResult should include its metadata.\n * If an error occurs when obtaining the metadata, it will return empty.\n * @default false\n *\n * @since 8.1.0\n */\n includeMetadata?: boolean;\n}\n\nexport interface RecordVideoOptions {\n /**\n * Whether to save the video to the gallery.\n * @default false\n *\n * @since 8.1.0\n */\n saveToGallery?: boolean;\n\n /**\n * Whether or not MediaResult should include its metadata.\n * If an error occurs when obtaining the metadata, it will return empty.\n * @default false\n *\n * @since 8.1.0\n */\n includeMetadata?: boolean;\n\n /**\n * Whether the to store the video in persistent app storage or in temporary cache.\n * If you plan to use the returned `MediaResult#URI` across app launches, you may want to set to true.\n * Otherwise, you can set to false.\n * @default true\n *\n * @since 8.1.0\n */\n isPersistent?: boolean;\n}\n\nexport interface PlayVideoOptions {\n /**\n * The URI of the video to play.\n * You may use the `MediaResult#URI` returned from `recordVideo` or `chooseFromGallery` directly.\n *\n * @since 8.1.0\n */\n uri: string;\n}\n\nexport interface ChooseFromGalleryOptions {\n /**\n * The type of media to select. Can be pictures, videos, or both.\n * @default MediaTypeSelection.Photo\n *\n * @since 8.1.0\n */\n mediaType?: MediaTypeSelection;\n\n /**\n * Whether or not to allow selecting multiple media files from the gallery.\n * @default false\n *\n * @since 8.1.0\n */\n allowMultipleSelection?: boolean;\n\n /**\n * The maximum number of media files that the user can choose.\n * Only applicable if `allowMultipleSelection` is `true`.\n * Any non-positive number will be treated as unlimited.\n * Note: This option is only supported on Android 13+ and iOS.\n * @default 0\n *\n * @since 8.1.0\n */\n limit?: number;\n\n /**\n * Whether or not MediaResult should include its metadata.\n * If an error occurs when obtaining the metadata, it will return empty.\n * @default false\n *\n * @since 8.1.0\n */\n includeMetadata?: boolean;\n\n /**\n * Whether to allow the user to crop or make small edits.\n * Only applicable for `MediaTypeSelection.Photo` and `allowMultipleSelection` set to `false`.\n * Note: This option is only supported on Android and iOS.\n * @default false\n *\n * @since 8.1.0\n */\n allowEdit?: boolean;\n\n /**\n * If `true`, will use an in-app editor for photo edition.\n * If `false`, will open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available.\n * Only applicable with `allowEdit` set to true.\n * Note: This option is only supported on Android and iOS.\n *\n * @default true\n * @since 8.1.0\n */\n editInApp?: boolean;\n\n /**\n * iOS only: The presentation style of media picker.\n * @default 'fullscreen'\n *\n * @since 8.1.0\n */\n presentationStyle?: 'fullscreen' | 'popover';\n\n /**\n * The quality of images to return, from 0-100.\n * Only applicable for `MediaType.Photo` and JPEG format.\n * Note: This option is only supported on Android and iOS.\n *\n * @default 100\n * @since 8.1.0\n */\n quality?: number;\n\n /**\n * The target width of photos to apply.\n * Must be a positive number, and used along `targetHeight`.\n * Not applicable when videos are selected.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.0.0\n */\n targetWidth?: number;\n\n /**\n * The target width of photos to apply.\n * Must be a positive number, and used along `targetWidth`.\n * Not applicable when videos are selected.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 8.1.0\n */\n targetHeight?: number;\n\n /**\n * Whether to automatically rotate the image \"up\" to correct for orientation\n * in portrait mode.\n * Not applicable when videos are selected.\n * Note: This option is only supported on Android and iOS\n * @default true\n *\n * @since 8.1.0\n */\n correctOrientation?: boolean;\n\n /**\n * Web only: Whether to use the PWA Element experience or file input. The\n * default is to use PWA Elements if installed and fall back to file input.\n * To always use file input, set this to `true`.\n *\n * Learn more about PWA Elements: https://capacitorjs.com/docs/web/pwa-elements\n *\n * @since 8.1.0\n */\n webUseInput?: boolean;\n}\n\nexport interface EditURIPhotoOptions {\n /**\n * The URI that contains the photo to edit.\n *\n * @since 8.1.0\n */\n uri: string;\n\n /**\n * Whether to save the edited photo to the gallery.\n * @default false\n *\n * @since 8.1.0\n */\n\n saveToGallery?: boolean;\n\n /**\n * Whether or not MediaResult should include its metadata.\n * If an error occurs when obtaining the metadata, it will return empty.\n * @default false\n *\n * @since 8.1.0\n */\n includeMetadata?: boolean;\n}\n\nexport interface EditPhotoOptions {\n /**\n * The base64 encoded image to edit.\n *\n * @since 8.1.0\n */\n inputImage: string;\n}\n\nexport interface EditPhotoResult {\n /**\n * The edited image, base64 encoded.\n *\n * @since 8.1.0\n */\n outputImage: string;\n}\n\nexport interface MediaResult {\n /**\n * The type of media result. Either `Photo` or `Video`.\n *\n * @since 8.1.0\n */\n type: MediaType;\n\n /**\n * The URI pointing to the media file.\n * Not available on Web. Use `webPath` instead for Web.\n *\n * @since 8.1.0\n */\n uri?: string;\n\n /**\n * Returns the thumbnail of the media, base64 encoded.\n * On Web, for `MediaType.Photo`, the full image is returned here, also base64 encoded.\n * On Web, for `MediaType.Video`, a full-resolution JPEG frame captured from the video is returned, base64 encoded at 80% quality.\n *\n * @since 8.1.0\n */\n thumbnail?: string;\n\n /**\n * Whether if the media was saved to the gallery successfully or not.\n * Only applicable if `saveToGallery` was set to `true` in input options.\n * Otherwise, `false` is always returned for `save`.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n saved: boolean;\n\n /**\n * webPath returns a path that can be used to set the src attribute of a media item for efficient\n * loading and rendering.\n *\n * @since 8.1.0\n */\n webPath?: string;\n\n /**\n * Metadata associated to the media result.\n * Only included if `includeMetadata` was set to `true` in input options.\n *\n * @since 8.1.0\n */\n metadata?: MediaMetadata;\n}\n\nexport interface MediaMetadata {\n /**\n * File size of the media, in bytes.\n *\n * @since 8.1.0\n */\n size?: number;\n\n /**\n * Only applicable for `MediaType.Video` - the duration of the media, in seconds.\n *\n * @since 8.1.0\n */\n duration?: number;\n\n /**\n * The format of the image, ex: jpeg, png, mp4.\n *\n * Web supports jpeg, png and gif, but the exact availability may vary depending on the browser.\n * gif is only supported for `chooseFromGallery` on Web.\n *\n * @since 8.1.0\n */\n format: string;\n\n /**\n * The resolution of the media, in `<width>x<height>` format. Example: '1920x1080'.\n *\n * @since 8.1.0\n */\n resolution?: string;\n\n /**\n * The date and time the media was created, in ISO 8601 format.\n * If creation date is not available (e.g. Android 7 and below), the last modified date is returned.\n * For Web, the last modified date is always returned.\n *\n * @since 8.1.0\n */\n creationDate?: string;\n\n /**\n * Exif data, if any, retreived from the media item.\n * Only available for `MediaType.Photo`.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n exif?: string;\n}\n\nexport interface MediaResults {\n /**\n * The list of media results.\n *\n * @since 8.1.0\n */\n results: MediaResult[];\n}\n\n/**\n * @deprecated This interface is only meant to be used for deprecated `getPhoto` method.\n * It will be removed in a future major version of the plugin, along with `getPhoto`.\n */\nexport interface ImageOptions {\n /**\n * The quality of image to return as JPEG, from 0-100\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.0.0\n */\n quality?: number;\n /**\n * Whether to allow the user to crop or make small edits (platform specific).\n * Note: This option is only supported on Android and iOS.\n * On iOS it's only supported for CameraSource.Camera, but not for CameraSource.Photos.\n *\n * @since 1.0.0\n */\n allowEditing?: boolean;\n /**\n * How the data should be returned. Currently, only 'Base64', 'DataUrl' or 'Uri' is supported\n *\n * @since 1.0.0\n */\n resultType: CameraResultType;\n /**\n * Whether to save the photo to the gallery.\n * If the photo was picked from the gallery, it will only be saved if edited.\n * Note: This option is only supported on Android and iOS.\n * @default false\n *\n * @since 1.0.0\n */\n saveToGallery?: boolean;\n /**\n * The desired maximum width of the saved image. The aspect ratio is respected.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.0.0\n */\n width?: number;\n /**\n * The desired maximum height of the saved image. The aspect ratio is respected.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.0.0\n */\n height?: number;\n /**\n * Whether to automatically rotate the image \"up\" to correct for orientation\n * in portrait mode.\n * Note: This option is only supported on Android and iOS.\n * @default true\n *\n * @since 1.0.0\n */\n correctOrientation?: boolean;\n /**\n * The source to get the photo from. By default this prompts the user to select\n * either the photo album or take a photo.\n * @default CameraSource.Prompt\n *\n * @since 1.0.0\n */\n source?: CameraSource;\n /**\n * iOS and Web only: The camera direction.\n * @default CameraDirection.Rear\n *\n * @since 1.0.0\n */\n direction?: CameraDirection;\n\n /**\n * iOS only: The presentation style of the Camera.\n * @default 'fullscreen'\n *\n * @since 1.0.0\n */\n presentationStyle?: 'fullscreen' | 'popover';\n\n /**\n * Web only: Whether to use the PWA Element experience or file input. The\n * default is to use PWA Elements if installed and fall back to file input.\n * To always use file input, set this to `true`.\n *\n * Learn more about PWA Elements: https://capacitorjs.com/docs/web/pwa-elements\n *\n * @since 1.0.0\n */\n webUseInput?: boolean;\n\n /**\n * Text value to use when displaying the prompt.\n * @default 'Photo'\n *\n * @since 1.0.0\n *\n */\n promptLabelHeader?: string;\n\n /**\n * Text value to use when displaying the prompt.\n * iOS only: The label of the 'cancel' button.\n * @default 'Cancel'\n *\n * @since 1.0.0\n */\n promptLabelCancel?: string;\n\n /**\n * Text value to use when displaying the prompt.\n * The label of the button to select a saved image.\n * @default 'From Photos'\n *\n * @since 1.0.0\n */\n promptLabelPhoto?: string;\n\n /**\n * Text value to use when displaying the prompt.\n * The label of the button to open the camera.\n * @default 'Take Picture'\n *\n * @since 1.0.0\n */\n promptLabelPicture?: string;\n}\n\n/**\n * @deprecated This interface is only meant to be used for received the result of deprecated `getPhoto` method.\n * It will be removed in a future major version of the plugin, along with `getPhoto`.\n */\nexport interface Photo {\n /**\n * The base64 encoded string representation of the image, if using CameraResultType.Base64.\n *\n * @since 1.0.0\n */\n base64String?: string;\n /**\n * The url starting with 'data:image/jpeg;base64,' and the base64 encoded string representation of the image, if using CameraResultType.DataUrl.\n *\n * Note: On web, the file format could change depending on the browser.\n * @since 1.0.0\n */\n dataUrl?: string;\n /**\n * If using CameraResultType.Uri, the path will contain a full,\n * platform-specific file URL that can be read later using the Filesystem API.\n *\n * @since 1.0.0\n */\n path?: string;\n /**\n * webPath returns a path that can be used to set the src attribute of an image for efficient\n * loading and rendering.\n *\n * @since 1.0.0\n */\n webPath?: string;\n /**\n * Exif data, if any, retrieved from the image\n *\n * @since 1.0.0\n */\n exif?: any;\n /**\n * The format of the image, ex: jpeg, png, gif.\n *\n * iOS and Android only support jpeg.\n * Web supports jpeg, png and gif, but the exact availability may vary depending on the browser.\n * gif is only supported if `webUseInput` is set to `true` or if `source` is set to `Photos`.\n *\n * @since 1.0.0\n */\n format: string;\n /**\n * Whether if the image was saved to the gallery or not.\n *\n * On Android and iOS, saving to the gallery can fail if the user didn't\n * grant the required permissions.\n * On Web there is no gallery, so always returns false.\n *\n * @since 1.1.0\n */\n saved: boolean;\n}\n\nexport interface GalleryPhotos {\n /**\n * Array of all the picked photos.\n *\n * @since 1.2.0\n */\n photos: GalleryPhoto[];\n}\n\nexport interface GalleryPhoto {\n /**\n * Full, platform-specific file URL that can be read later using the Filesystem API.\n *\n * @since 1.2.0\n */\n path?: string;\n /**\n * webPath returns a path that can be used to set the src attribute of an image for efficient\n * loading and rendering.\n *\n * @since 1.2.0\n */\n webPath: string;\n /**\n * Exif data, if any, retrieved from the image\n *\n * @since 1.2.0\n */\n exif?: any;\n /**\n * The format of the image, ex: jpeg, png, gif.\n *\n * iOS and Android only support jpeg.\n * Web supports jpeg, png and gif.\n *\n * @since 1.2.0\n */\n format: string;\n}\n\n/**\n * @deprecated This interface is only meant to be used for deprecated `pickImages` method.\n * It will be removed in a future major version of the plugin, along with `pickImages`.\n */\nexport interface GalleryImageOptions {\n /**\n * The quality of image to return as JPEG, from 0-100\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.2.0\n */\n quality?: number;\n /**\n * The desired maximum width of the saved image. The aspect ratio is respected.\n *\n * @since 1.2.0\n */\n width?: number;\n /**\n * The desired maximum height of the saved image. The aspect ratio is respected.\n *\n * @since 1.2.0\n */\n height?: number;\n /**\n * Whether to automatically rotate the image \"up\" to correct for orientation\n * in portrait mode\n * @default true\n *\n * @since 1.2.0\n */\n correctOrientation?: boolean;\n\n /**\n * iOS only: The presentation style of the Camera.\n * @default 'fullscreen'\n *\n * @since 1.2.0\n */\n presentationStyle?: 'fullscreen' | 'popover';\n\n /**\n * Maximum number of pictures the user will be able to choose.\n * Note: This option is only supported on Android 13+ and iOS.\n *\n * @default 0 (unlimited)\n *\n * @since 1.2.0\n */\n limit?: number;\n}\n\n/**\n * @deprecated This enum is only meant to be used for deprecated `getPhoto` method.\n * It will be removed in a future major version of the plugin, along with `getPhoto`.\n */\nexport enum CameraSource {\n /**\n * Prompts the user to select either the photo album or take a photo.\n */\n Prompt = 'PROMPT',\n /**\n * Take a new photo using the camera.\n */\n Camera = 'CAMERA',\n /**\n * Pick an existing photo from the gallery or photo album.\n */\n Photos = 'PHOTOS',\n}\n\nexport enum CameraDirection {\n Rear = 'REAR',\n Front = 'FRONT',\n}\n\n/**\n * @deprecated This enum is only meant to be used for `ImageOptions` in deprecated `getPhoto` method.\n * It will be removed in a future major version of the plugin, along with `getPhoto`.\n */\nexport enum CameraResultType {\n Uri = 'uri',\n Base64 = 'base64',\n DataUrl = 'dataUrl',\n}\n\nexport enum MediaType {\n Photo = 0,\n Video = 1,\n}\n\nexport enum MediaTypeSelection {\n Photo = 0,\n Video = 1,\n All = 2,\n}\n\nexport enum EncodingType {\n JPEG = 0,\n PNG = 1,\n}\n\n/**\n * @deprecated Use `Photo`.\n * @since 1.0.0\n */\nexport type CameraPhoto = Photo;\n\n/**\n * @deprecated Use `ImageOptions`.\n * @since 1.0.0\n */\nexport type CameraOptions = ImageOptions;\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAoyBA;;;GAGG;AACH,MAAM,CAAN,IAAY,YAaX;AAbD,WAAY,YAAY;IACtB;;OAEG;IACH,iCAAiB,CAAA;IACjB;;OAEG;IACH,iCAAiB,CAAA;IACjB;;OAEG;IACH,iCAAiB,CAAA;AACnB,CAAC,EAbW,YAAY,KAAZ,YAAY,QAavB;AAED,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,kCAAe,CAAA;AACjB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,qCAAiB,CAAA;IACjB,uCAAmB,CAAA;AACrB,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B;AAED,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,2CAAS,CAAA;IACT,2CAAS,CAAA;AACX,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,6DAAS,CAAA;IACT,6DAAS,CAAA;IACT,yDAAO,CAAA;AACT,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B;AAED,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,+CAAQ,CAAA;IACR,6CAAO,CAAA;AACT,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB","sourcesContent":["import type { PermissionState } from '@capacitor/core';\n\nexport type CameraPermissionState = PermissionState | 'limited';\n\nexport type CameraPermissionType = 'camera' | 'photos';\n\nexport interface PermissionStatus {\n camera: CameraPermissionState;\n photos: CameraPermissionState;\n}\n\nexport interface CameraPluginPermissions {\n permissions: CameraPermissionType[];\n}\n\nexport interface CameraPlugin {\n /**\n * Open the device's camera and allow the user to take a photo.\n *\n * @since 8.1.0\n */\n takePhoto(options: TakePhotoOptions): Promise<MediaResult>;\n\n /**\n * Open the device's camera and allow the user to record a video.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n recordVideo(options: RecordVideoOptions): Promise<MediaResult>;\n\n /**\n * Open a native video player.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n playVideo(options: PlayVideoOptions): Promise<void>;\n\n /**\n * Allow users to choose pictures, videos, or both, directly from their gallery.\n *\n * @since 8.1.0\n */\n chooseFromGallery(options: ChooseFromGalleryOptions): Promise<MediaResults>;\n\n /**\n * Open an in-app screen to edit a given photo using the provided base64 string.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n editPhoto(options: EditPhotoOptions): Promise<EditPhotoResult>;\n\n /**\n * Open an in-app screen to edit a photo using the provided URI.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n editURIPhoto(options: EditURIPhotoOptions): Promise<MediaResult>;\n\n /**\n * Allows the user to update their limited photo library selection.\n * Returns all the limited photos after the picker dismissal.\n * If instead the user gave full access to the photos it returns an empty array.\n *\n * @since 4.1.0\n */\n pickLimitedLibraryPhotos(): Promise<GalleryPhotos>;\n /**\n * Return an array of photos selected from the limited photo library.\n *\n * @since 4.1.0\n */\n getLimitedLibraryPhotos(): Promise<GalleryPhotos>;\n\n /**\n * Check camera and photo album permissions\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request camera and photo album permissions\n *\n * @since 1.0.0\n */\n requestPermissions(permissions?: CameraPluginPermissions): Promise<PermissionStatus>;\n\n /**\n * Prompt the user to pick a photo from an album, or take a new photo\n * with the camera.\n *\n * @since 1.0.0\n * @deprecated Use `takePhoto` for a camera photo, or `chooseFromGallery` to select from the gallery. For creating a prompt for the user to select which source, use `@capacitor/action-sheet` or any UI component of your choosing. Refer to the Camera API documentation for more information on migrating.\n */\n getPhoto(options: ImageOptions): Promise<Photo>;\n\n /**\n * Allows the user to pick multiple pictures from the photo gallery.\n *\n * @since 1.2.0\n * @deprecated Use `chooseFromGallery` instead. Refer to the Camera API documentation for more information on migrating.\n */\n pickImages(options: GalleryImageOptions): Promise<GalleryPhotos>;\n}\n\nexport interface TakePhotoOptions {\n /**\n * The quality of image to return, from 0-100.\n * Only applicable for `EncodingType.JPEG`.\n * Note: This option is only supported on Android and iOS.\n *\n * @default 100\n * @since 8.1.0\n */\n quality?: number;\n\n /**\n * The target width of photos to apply.\n * Must be a positive number, and used along `targetHeight`.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 8.1.0\n */\n targetWidth?: number;\n\n /**\n * The target width of photos to apply.\n * Must be a positive number, and used along `targetWidth`.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 8.1.0\n */\n targetHeight?: number;\n\n /**\n * Whether to automatically rotate the image \"up\" to correct for orientation\n * in portrait mode.\n * Note: This option is only supported on Android and iOS\n * @default true\n *\n * @since 8.1.0\n */\n correctOrientation?: boolean;\n\n /**\n * The encoding type for the captured photo - JPEG or PNG.\n * Note: This option is only supported on Android and iOS.\n * @default EncodingType.JPEG\n *\n * @since 8.1.0\n */\n encodingType?: EncodingType;\n\n /**\n * Whether to save the photo to the gallery.\n * Note: This option is only supported on Android and iOS.\n * @default false\n *\n * @since 8.1.0\n */\n saveToGallery?: boolean;\n\n /**\n * iOS and Web only: The camera direction.\n * @default CameraDirection.Rear\n *\n * @since 8.1.0\n */\n cameraDirection?: CameraDirection;\n\n /**\n * Determines if and how the user can edit the photo.\n * - 'in-app': Use an in-app editor for photo edition.\n * - 'external': Open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available. Note: iOS does not support external editing and will use 'in-app' instead.\n * - 'no': No editing allowed.\n * Not available on Web.\n * @default 'no'\n *\n * @since 8.1.0\n */\n editable?: 'in-app' | 'external' | 'no';\n\n /**\n * iOS only: The presentation style of the Camera.\n * @default 'fullscreen'\n *\n * @since 8.1.0\n */\n presentationStyle?: 'fullscreen' | 'popover';\n\n /**\n * Web only: Whether to use the PWA Element experience or file input. The\n * default is to use PWA Elements if installed and fall back to file input.\n * To always use file input, set this to `true`.\n *\n * Learn more about PWA Elements: https://capacitorjs.com/docs/web/pwa-elements\n *\n * @since 8.1.0\n */\n webUseInput?: boolean;\n\n /**\n * Whether or not MediaResult should include its metadata.\n * If an error occurs when obtaining the metadata, it will return empty.\n * @default false\n *\n * @since 8.1.0\n */\n includeMetadata?: boolean;\n}\n\nexport interface RecordVideoOptions {\n /**\n * Whether to save the video to the gallery.\n * @default false\n *\n * @since 8.1.0\n */\n saveToGallery?: boolean;\n\n /**\n * Whether or not MediaResult should include its metadata.\n * If an error occurs when obtaining the metadata, it will return empty.\n * @default false\n *\n * @since 8.1.0\n */\n includeMetadata?: boolean;\n\n /**\n * Whether the to store the video in persistent app storage or in temporary cache.\n * If you plan to use the returned `MediaResult#URI` across app launches, you may want to set to true.\n * Otherwise, you can set to false.\n * @default true\n *\n * @since 8.1.0\n */\n isPersistent?: boolean;\n}\n\nexport interface PlayVideoOptions {\n /**\n * The URI of the video to play.\n * You may use the `MediaResult#URI` returned from `recordVideo` or `chooseFromGallery` directly.\n *\n * @since 8.1.0\n */\n uri: string;\n}\n\nexport interface ChooseFromGalleryOptions {\n /**\n * The type of media to select. Can be pictures, videos, or both.\n * @default MediaTypeSelection.Photo\n *\n * @since 8.1.0\n */\n mediaType?: MediaTypeSelection;\n\n /**\n * Whether or not to allow selecting multiple media files from the gallery.\n * @default false\n *\n * @since 8.1.0\n */\n allowMultipleSelection?: boolean;\n\n /**\n * The maximum number of media files that the user can choose.\n * Only applicable if `allowMultipleSelection` is `true`.\n * Any non-positive number will be treated as unlimited.\n * Note: This option is only supported on Android 13+ and iOS.\n * @default 0\n *\n * @since 8.1.0\n */\n limit?: number;\n\n /**\n * Whether or not MediaResult should include its metadata.\n * If an error occurs when obtaining the metadata, it will return empty.\n * @default false\n *\n * @since 8.1.0\n */\n includeMetadata?: boolean;\n\n /**\n * Determines if and how the user can edit the photo.\n * - 'in-app': Use an in-app editor for photo edition.\n * - 'external': Open a separate (platform-specific) native app to handle photo edition, falling back to the in-app editor if none is available. Note: iOS does not support external editing and will use 'in-app' instead.\n * - 'no': No editing allowed.\n * Only applicable for `MediaTypeSelection.Photo` and `allowMultipleSelection` set to `false`.\n * Not available on Web.\n * @default 'no'\n *\n * @since 8.1.0\n */\n editable?: 'in-app' | 'external' | 'no';\n\n /**\n * iOS only: The presentation style of media picker.\n * @default 'fullscreen'\n *\n * @since 8.1.0\n */\n presentationStyle?: 'fullscreen' | 'popover';\n\n /**\n * The quality of images to return, from 0-100.\n * Only applicable for `MediaType.Photo` and JPEG format.\n * Note: This option is only supported on Android and iOS.\n *\n * @default 100\n * @since 8.1.0\n */\n quality?: number;\n\n /**\n * The target width of photos to apply.\n * Must be a positive number, and used along `targetHeight`.\n * Not applicable when videos are selected.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.0.0\n */\n targetWidth?: number;\n\n /**\n * The target width of photos to apply.\n * Must be a positive number, and used along `targetWidth`.\n * Not applicable when videos are selected.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 8.1.0\n */\n targetHeight?: number;\n\n /**\n * Whether to automatically rotate the image \"up\" to correct for orientation\n * in portrait mode.\n * Not applicable when videos are selected.\n * Note: This option is only supported on Android and iOS\n * @default true\n *\n * @since 8.1.0\n */\n correctOrientation?: boolean;\n\n /**\n * Web only: Whether to use the PWA Element experience or file input. The\n * default is to use PWA Elements if installed and fall back to file input.\n * To always use file input, set this to `true`.\n *\n * Learn more about PWA Elements: https://capacitorjs.com/docs/web/pwa-elements\n *\n * @since 8.1.0\n */\n webUseInput?: boolean;\n}\n\nexport interface EditURIPhotoOptions {\n /**\n * The URI that contains the photo to edit.\n *\n * @since 8.1.0\n */\n uri: string;\n\n /**\n * Whether to save the edited photo to the gallery.\n * @default false\n *\n * @since 8.1.0\n */\n\n saveToGallery?: boolean;\n\n /**\n * Whether or not MediaResult should include its metadata.\n * If an error occurs when obtaining the metadata, it will return empty.\n * @default false\n *\n * @since 8.1.0\n */\n includeMetadata?: boolean;\n}\n\nexport interface EditPhotoOptions {\n /**\n * The base64 encoded image to edit.\n *\n * @since 8.1.0\n */\n inputImage: string;\n}\n\nexport interface EditPhotoResult {\n /**\n * The edited image, base64 encoded.\n *\n * @since 8.1.0\n */\n outputImage: string;\n}\n\nexport interface MediaResult {\n /**\n * The type of media result. Either `Photo` or `Video`.\n *\n * @since 8.1.0\n */\n type: MediaType;\n\n /**\n * The URI pointing to the media file.\n * Not available on Web. Use `webPath` instead for Web.\n *\n * @since 8.1.0\n */\n uri?: string;\n\n /**\n * Returns the thumbnail of the media, base64 encoded.\n * On Web, for `MediaType.Photo`, the full image is returned here, also base64 encoded.\n * On Web, for `MediaType.Video`, a full-resolution JPEG frame captured from the video is returned, base64 encoded at 80% quality.\n *\n * @since 8.1.0\n */\n thumbnail?: string;\n\n /**\n * Whether if the media was saved to the gallery successfully or not.\n * Only applicable if `saveToGallery` was set to `true` in input options.\n * Otherwise, `false` is always returned for `save`.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n saved: boolean;\n\n /**\n * webPath returns a path that can be used to set the src attribute of a media item for efficient\n * loading and rendering.\n *\n * @since 8.1.0\n */\n webPath?: string;\n\n /**\n * Metadata associated to the media result.\n * Only included if `includeMetadata` was set to `true` in input options.\n *\n * @since 8.1.0\n */\n metadata?: MediaMetadata;\n}\n\nexport interface MediaMetadata {\n /**\n * File size of the media, in bytes.\n *\n * @since 8.1.0\n */\n size?: number;\n\n /**\n * Only applicable for `MediaType.Video` - the duration of the media, in seconds.\n *\n * @since 8.1.0\n */\n duration?: number;\n\n /**\n * The format of the image, ex: jpeg, png, mp4.\n *\n * Web supports jpeg, png and gif, but the exact availability may vary depending on the browser.\n * gif is only supported for `chooseFromGallery` on Web.\n *\n * @since 8.1.0\n */\n format: string;\n\n /**\n * The resolution of the media, in `<width>x<height>` format. Example: '1920x1080'.\n *\n * @since 8.1.0\n */\n resolution?: string;\n\n /**\n * The date and time the media was created, in ISO 8601 format.\n * If creation date is not available (e.g. Android 7 and below), the last modified date is returned.\n * For Web, the last modified date is always returned.\n *\n * @since 8.1.0\n */\n creationDate?: string;\n\n /**\n * Exif data, if any, retreived from the media item.\n * Only available for `MediaType.Photo`.\n * Not available on Web.\n *\n * @since 8.1.0\n */\n exif?: string;\n}\n\nexport interface MediaResults {\n /**\n * The list of media results.\n *\n * @since 8.1.0\n */\n results: MediaResult[];\n}\n\n/**\n * @deprecated This interface is only meant to be used for deprecated `getPhoto` method.\n * It will be removed in a future major version of the plugin, along with `getPhoto`.\n */\nexport interface ImageOptions {\n /**\n * The quality of image to return as JPEG, from 0-100\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.0.0\n */\n quality?: number;\n /**\n * Whether to allow the user to crop or make small edits (platform specific).\n * Note: This option is only supported on Android and iOS.\n * On iOS it's only supported for CameraSource.Camera, but not for CameraSource.Photos.\n *\n * @since 1.0.0\n */\n allowEditing?: boolean;\n /**\n * How the data should be returned. Currently, only 'Base64', 'DataUrl' or 'Uri' is supported\n *\n * @since 1.0.0\n */\n resultType: CameraResultType;\n /**\n * Whether to save the photo to the gallery.\n * If the photo was picked from the gallery, it will only be saved if edited.\n * Note: This option is only supported on Android and iOS.\n * @default false\n *\n * @since 1.0.0\n */\n saveToGallery?: boolean;\n /**\n * The desired maximum width of the saved image. The aspect ratio is respected.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.0.0\n */\n width?: number;\n /**\n * The desired maximum height of the saved image. The aspect ratio is respected.\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.0.0\n */\n height?: number;\n /**\n * Whether to automatically rotate the image \"up\" to correct for orientation\n * in portrait mode.\n * Note: This option is only supported on Android and iOS.\n * @default true\n *\n * @since 1.0.0\n */\n correctOrientation?: boolean;\n /**\n * The source to get the photo from. By default this prompts the user to select\n * either the photo album or take a photo.\n * @default CameraSource.Prompt\n *\n * @since 1.0.0\n */\n source?: CameraSource;\n /**\n * iOS and Web only: The camera direction.\n * @default CameraDirection.Rear\n *\n * @since 1.0.0\n */\n direction?: CameraDirection;\n\n /**\n * iOS only: The presentation style of the Camera.\n * @default 'fullscreen'\n *\n * @since 1.0.0\n */\n presentationStyle?: 'fullscreen' | 'popover';\n\n /**\n * Web only: Whether to use the PWA Element experience or file input. The\n * default is to use PWA Elements if installed and fall back to file input.\n * To always use file input, set this to `true`.\n *\n * Learn more about PWA Elements: https://capacitorjs.com/docs/web/pwa-elements\n *\n * @since 1.0.0\n */\n webUseInput?: boolean;\n\n /**\n * Text value to use when displaying the prompt.\n * @default 'Photo'\n *\n * @since 1.0.0\n *\n */\n promptLabelHeader?: string;\n\n /**\n * Text value to use when displaying the prompt.\n * iOS only: The label of the 'cancel' button.\n * @default 'Cancel'\n *\n * @since 1.0.0\n */\n promptLabelCancel?: string;\n\n /**\n * Text value to use when displaying the prompt.\n * The label of the button to select a saved image.\n * @default 'From Photos'\n *\n * @since 1.0.0\n */\n promptLabelPhoto?: string;\n\n /**\n * Text value to use when displaying the prompt.\n * The label of the button to open the camera.\n * @default 'Take Picture'\n *\n * @since 1.0.0\n */\n promptLabelPicture?: string;\n}\n\n/**\n * @deprecated This interface is only meant to be used for received the result of deprecated `getPhoto` method.\n * It will be removed in a future major version of the plugin, along with `getPhoto`.\n */\nexport interface Photo {\n /**\n * The base64 encoded string representation of the image, if using CameraResultType.Base64.\n *\n * @since 1.0.0\n */\n base64String?: string;\n /**\n * The url starting with 'data:image/jpeg;base64,' and the base64 encoded string representation of the image, if using CameraResultType.DataUrl.\n *\n * Note: On web, the file format could change depending on the browser.\n * @since 1.0.0\n */\n dataUrl?: string;\n /**\n * If using CameraResultType.Uri, the path will contain a full,\n * platform-specific file URL that can be read later using the Filesystem API.\n *\n * @since 1.0.0\n */\n path?: string;\n /**\n * webPath returns a path that can be used to set the src attribute of an image for efficient\n * loading and rendering.\n *\n * @since 1.0.0\n */\n webPath?: string;\n /**\n * Exif data, if any, retrieved from the image\n *\n * @since 1.0.0\n */\n exif?: any;\n /**\n * The format of the image, ex: jpeg, png, gif.\n *\n * iOS and Android only support jpeg.\n * Web supports jpeg, png and gif, but the exact availability may vary depending on the browser.\n * gif is only supported if `webUseInput` is set to `true` or if `source` is set to `Photos`.\n *\n * @since 1.0.0\n */\n format: string;\n /**\n * Whether if the image was saved to the gallery or not.\n *\n * On Android and iOS, saving to the gallery can fail if the user didn't\n * grant the required permissions.\n * On Web there is no gallery, so always returns false.\n *\n * @since 1.1.0\n */\n saved: boolean;\n}\n\nexport interface GalleryPhotos {\n /**\n * Array of all the picked photos.\n *\n * @since 1.2.0\n */\n photos: GalleryPhoto[];\n}\n\nexport interface GalleryPhoto {\n /**\n * Full, platform-specific file URL that can be read later using the Filesystem API.\n *\n * @since 1.2.0\n */\n path?: string;\n /**\n * webPath returns a path that can be used to set the src attribute of an image for efficient\n * loading and rendering.\n *\n * @since 1.2.0\n */\n webPath: string;\n /**\n * Exif data, if any, retrieved from the image\n *\n * @since 1.2.0\n */\n exif?: any;\n /**\n * The format of the image, ex: jpeg, png, gif.\n *\n * iOS and Android only support jpeg.\n * Web supports jpeg, png and gif.\n *\n * @since 1.2.0\n */\n format: string;\n}\n\n/**\n * @deprecated This interface is only meant to be used for deprecated `pickImages` method.\n * It will be removed in a future major version of the plugin, along with `pickImages`.\n */\nexport interface GalleryImageOptions {\n /**\n * The quality of image to return as JPEG, from 0-100\n * Note: This option is only supported on Android and iOS.\n *\n * @since 1.2.0\n */\n quality?: number;\n /**\n * The desired maximum width of the saved image. The aspect ratio is respected.\n *\n * @since 1.2.0\n */\n width?: number;\n /**\n * The desired maximum height of the saved image. The aspect ratio is respected.\n *\n * @since 1.2.0\n */\n height?: number;\n /**\n * Whether to automatically rotate the image \"up\" to correct for orientation\n * in portrait mode\n * @default true\n *\n * @since 1.2.0\n */\n correctOrientation?: boolean;\n\n /**\n * iOS only: The presentation style of the Camera.\n * @default 'fullscreen'\n *\n * @since 1.2.0\n */\n presentationStyle?: 'fullscreen' | 'popover';\n\n /**\n * Maximum number of pictures the user will be able to choose.\n * Note: This option is only supported on Android 13+ and iOS.\n *\n * @default 0 (unlimited)\n *\n * @since 1.2.0\n */\n limit?: number;\n}\n\n/**\n * @deprecated This enum is only meant to be used for deprecated `getPhoto` method.\n * It will be removed in a future major version of the plugin, along with `getPhoto`.\n */\nexport enum CameraSource {\n /**\n * Prompts the user to select either the photo album or take a photo.\n */\n Prompt = 'PROMPT',\n /**\n * Take a new photo using the camera.\n */\n Camera = 'CAMERA',\n /**\n * Pick an existing photo from the gallery or photo album.\n */\n Photos = 'PHOTOS',\n}\n\nexport enum CameraDirection {\n Rear = 'REAR',\n Front = 'FRONT',\n}\n\n/**\n * @deprecated This enum is only meant to be used for `ImageOptions` in deprecated `getPhoto` method.\n * It will be removed in a future major version of the plugin, along with `getPhoto`.\n */\nexport enum CameraResultType {\n Uri = 'uri',\n Base64 = 'base64',\n DataUrl = 'dataUrl',\n}\n\nexport enum MediaType {\n Photo = 0,\n Video = 1,\n}\n\nexport enum MediaTypeSelection {\n Photo = 0,\n Video = 1,\n All = 2,\n}\n\nexport enum EncodingType {\n JPEG = 0,\n PNG = 1,\n}\n\n/**\n * @deprecated Use `Photo`.\n * @since 1.0.0\n */\nexport type CameraPhoto = Photo;\n\n/**\n * @deprecated Use `ImageOptions`.\n * @since 1.0.0\n */\nexport type CameraOptions = ImageOptions;\n"]}
@@ -35,6 +35,23 @@ public class CameraPlugin: CAPPlugin, CAPBridgedPlugin {
35
35
  private lazy var videoManager = IONCAMRFactory.createVideoManagerWrapper(withDelegate: self, and: self.bridge?.viewController ?? UIViewController())
36
36
 
37
37
  private var imageCounter = 0
38
+
39
+ public override func load() {
40
+ NotificationCenter.default.addObserver(
41
+ self,
42
+ selector: #selector(onAppTerminate),
43
+ name: UIApplication.willTerminateNotification,
44
+ object: nil
45
+ )
46
+ }
47
+
48
+ deinit {
49
+ NotificationCenter.default.removeObserver(self)
50
+ }
51
+
52
+ @objc private func onAppTerminate() {
53
+ cameraManager.cleanTemporaryFiles()
54
+ }
38
55
 
39
56
  private func decodeParameters<T: Decodable>(from call: CAPPluginCall) -> T? {
40
57
  guard let dict = call.options as? [String: Any],
@@ -79,8 +96,14 @@ public class CameraPlugin: CAPPlugin, CAPBridgedPlugin {
79
96
  }
80
97
 
81
98
  @objc func editPhoto(_ call: CAPPluginCall) {
82
- handleCall(call, error: .editPictureIssue) { (options: IONCAMRPhotoEditOptions) in
83
- self.editManager.editPhoto(with: options)
99
+ struct Options: Decodable { let inputImage: String }
100
+ handleCall(call, error: .editPictureIssue) { (options: Options) in
101
+ guard let imageData = Data(base64Encoded: options.inputImage),
102
+ let image = UIImage(data: imageData) else {
103
+ self.sendError(.editPictureIssue)
104
+ return
105
+ }
106
+ self.editManager.editPhoto(image)
84
107
  }
85
108
  }
86
109
 
@@ -675,7 +698,12 @@ extension CameraPlugin: IONCAMRCallbackDelegate {
675
698
  }
676
699
 
677
700
  private func resolveMediaResult(_ item: [String: Any]) -> [String: Any] {
678
- guard let uri = item["uri"] as? String else { return item }
701
+ guard let uri = item["uri"] as? String, !uri.isEmpty else {
702
+ if let thumbnail = item["thumbnail"] as? String {
703
+ return ["outputImage": thumbnail]
704
+ }
705
+ return item
706
+ }
679
707
  var result = item
680
708
  result["webPath"] = resolveWebPath(from: uri)
681
709
  if var metadata = result["metadata"] as? [String: Any] {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/camera",
3
- "version": "8.1.0-test.20260331",
3
+ "version": "8.1.0-test.20260402",
4
4
  "description": "The Camera API provides the ability to take a photo with the camera or choose an existing one from the photo album.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",