@capacitor/camera 6.0.0-alpha.2 → 6.0.0-beta.1

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.
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
10
10
  s.homepage = 'https://capacitorjs.com'
11
11
  s.author = package['author']
12
12
  s.source = { :git => 'https://github.com/ionic-team/capacitor-plugins.git', :tag => package['name'] + '@' + package['version'] }
13
- s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}', 'camera/ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
13
+ s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}', 'camera/ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
14
  s.ios.deployment_target = '13.0'
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.1'
package/Package.swift ADDED
@@ -0,0 +1,28 @@
1
+ // swift-tools-version: 5.9
2
+ import PackageDescription
3
+
4
+ let package = Package(
5
+ name: "CapacitorCamera",
6
+ platforms: [.iOS(.v13)],
7
+ products: [
8
+ .library(
9
+ name: "CameraPlugin",
10
+ targets: ["CameraPlugin"])
11
+ ],
12
+ dependencies: [
13
+ .package(url: "https://github.com/ionic-team/capacitor6-spm-test.git", branch: "main")
14
+ ],
15
+ targets: [
16
+ .target(
17
+ name: "CameraPlugin",
18
+ dependencies: [
19
+ .product(name: "Capacitor", package: "capacitor6-spm-test"),
20
+ .product(name: "Cordova", package: "capacitor6-spm-test")
21
+ ],
22
+ path: "ios/Sources/CameraPlugin"),
23
+ .testTarget(
24
+ name: "CameraPluginTests",
25
+ dependencies: ["CameraPlugin"],
26
+ path: "ios/Tests/CameraPluginTests")
27
+ ]
28
+ )
package/README.md CHANGED
@@ -21,7 +21,30 @@ Read about [Configuring `Info.plist`](https://capacitorjs.com/docs/ios/configura
21
21
 
22
22
  ## Android
23
23
 
24
- This API requires no permissions, unless using `saveToGallery: true`, in that case the following permissions should be added to your `AndroidManifest.xml`:
24
+ When picking existing images from the device gallery, the Android Photo Picker component is now used. The Photo Picker is available on devices that meet the following criteria:
25
+
26
+ - Run Android 11 (API level 30) or higher
27
+ - Receive changes to Modular System Components through Google System Updates
28
+
29
+ Older devices and Android Go devices running Android 11 or 12 that support Google Play services can install a backported version of the photo picker. To enable the automatic installation of the backported photo picker module through Google Play services, add the following entry to the `<application>` tag in your `AndroidManifest.xml` file:
30
+
31
+ ```xml
32
+ <!-- Trigger Google Play services to install the backported photo picker module. -->
33
+ <!--suppress AndroidDomInspection -->
34
+ <service android:name="com.google.android.gms.metadata.ModuleDependencies"
35
+ android:enabled="false"
36
+ android:exported="false"
37
+ tools:ignore="MissingClass">
38
+ <intent-filter>
39
+ <action android:name="com.google.android.gms.metadata.MODULE_DEPENDENCIES" />
40
+ </intent-filter>
41
+ <meta-data android:name="photopicker_activity:0:required" android:value="" />
42
+ </service>
43
+ ```
44
+
45
+ If that entry is not added, the devices that don't support the Photo Picker, the Photo Picker component fallbacks to `Intent.ACTION_OPEN_DOCUMENT`.
46
+
47
+ The Camera plugin requires no permissions, unless using `saveToGallery: true`, in that case the following permissions should be added to your `AndroidManifest.xml`:
25
48
 
26
49
  ```xml
27
50
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
@@ -17,7 +17,7 @@ buildscript {
17
17
  }
18
18
  }
19
19
  dependencies {
20
- classpath 'com.android.tools.build:gradle:8.2.0-rc02'
20
+ classpath 'com.android.tools.build:gradle:8.2.0'
21
21
  if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
22
22
  classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
23
23
  }
package/dist/esm/web.js CHANGED
@@ -5,7 +5,7 @@ export class CameraWeb extends WebPlugin {
5
5
  // eslint-disable-next-line no-async-promise-executor
6
6
  return new Promise(async (resolve, reject) => {
7
7
  if (options.webUseInput || options.source === CameraSource.Photos) {
8
- this.fileInputExperience(options, resolve);
8
+ this.fileInputExperience(options, resolve, reject);
9
9
  }
10
10
  else if (options.source === CameraSource.Prompt) {
11
11
  let actionSheet = document.querySelector('pwa-action-sheet');
@@ -22,7 +22,7 @@ export class CameraWeb extends WebPlugin {
22
22
  actionSheet.addEventListener('onSelection', async (e) => {
23
23
  const selection = e.detail;
24
24
  if (selection === 0) {
25
- this.fileInputExperience(options, resolve);
25
+ this.fileInputExperience(options, resolve, reject);
26
26
  }
27
27
  else {
28
28
  this.cameraExperience(options, resolve, reject);
@@ -36,8 +36,8 @@ export class CameraWeb extends WebPlugin {
36
36
  }
37
37
  async pickImages(_options) {
38
38
  // eslint-disable-next-line no-async-promise-executor
39
- return new Promise(async (resolve) => {
40
- this.multipleFileInputExperience(resolve);
39
+ return new Promise(async (resolve, reject) => {
40
+ this.multipleFileInputExperience(resolve, reject);
41
41
  });
42
42
  }
43
43
  async cameraExperience(options, resolve, reject) {
@@ -65,15 +65,15 @@ export class CameraWeb extends WebPlugin {
65
65
  cameraModal.present();
66
66
  }
67
67
  catch (e) {
68
- this.fileInputExperience(options, resolve);
68
+ this.fileInputExperience(options, resolve, reject);
69
69
  }
70
70
  }
71
71
  else {
72
72
  console.error(`Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`);
73
- this.fileInputExperience(options, resolve);
73
+ this.fileInputExperience(options, resolve, reject);
74
74
  }
75
75
  }
76
- fileInputExperience(options, resolve) {
76
+ fileInputExperience(options, resolve, reject) {
77
77
  let input = document.querySelector('#_capacitor-camera-input');
78
78
  const cleanup = () => {
79
79
  var _a;
@@ -123,6 +123,10 @@ export class CameraWeb extends WebPlugin {
123
123
  cleanup();
124
124
  }
125
125
  });
126
+ input.addEventListener('cancel', (_e) => {
127
+ reject(new CapacitorException('User cancelled photos app'));
128
+ cleanup();
129
+ });
126
130
  }
127
131
  input.accept = 'image/*';
128
132
  input.capture = true;
@@ -138,7 +142,7 @@ export class CameraWeb extends WebPlugin {
138
142
  }
139
143
  input.click();
140
144
  }
141
- multipleFileInputExperience(resolve) {
145
+ multipleFileInputExperience(resolve, reject) {
142
146
  let input = document.querySelector('#_capacitor-camera-input-multiple');
143
147
  const cleanup = () => {
144
148
  var _a;
@@ -171,6 +175,10 @@ export class CameraWeb extends WebPlugin {
171
175
  resolve({ photos });
172
176
  cleanup();
173
177
  });
178
+ input.addEventListener('cancel', (_e) => {
179
+ reject(new CapacitorException('User cancelled photos app'));
180
+ cleanup();
181
+ });
174
182
  }
175
183
  input.accept = 'image/*';
176
184
  input.click();
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAU9D,MAAM,OAAO,SAAU,SAAQ,SAAS;IACtC,KAAK,CAAC,QAAQ,CAAC,OAAqB;QAClC,qDAAqD;QACrD,OAAO,IAAI,OAAO,CAAQ,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;YAClD,IAAI,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,MAAM,KAAK,YAAY,CAAC,MAAM,EAAE;gBACjE,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;aAC5C;iBAAM,IAAI,OAAO,CAAC,MAAM,KAAK,YAAY,CAAC,MAAM,EAAE;gBACjD,IAAI,WAAW,GAAQ,QAAQ,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;gBAClE,IAAI,CAAC,WAAW,EAAE;oBAChB,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;oBACzD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;iBACxC;gBACD,WAAW,CAAC,MAAM,GAAG,OAAO,CAAC,iBAAiB,IAAI,OAAO,CAAC;gBAC1D,WAAW,CAAC,U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AAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,wBAAwB;QAC5B,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,uBAAuB;QAC3B,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IACpD,CAAC;CACF;AAED,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["import { WebPlugin, CapacitorException } from '@capacitor/core';\n\nimport { CameraSource, CameraDirection } from './definitions';\nimport type {\n CameraPlugin,\n GalleryImageOptions,\n GalleryPhotos,\n ImageOptions,\n PermissionStatus,\n Photo,\n} from './definitions';\n\nexport class CameraWeb extends WebPlugin implements CameraPlugin {\n async getPhoto(options: ImageOptions): Promise<Photo> {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise<Photo>(async (resolve, reject) => {\n if (options.webUseInput || options.source === CameraSource.Photos) {\n this.fileInputExperience(options, resolve);\n } else if (options.source === CameraSource.Prompt) {\n let actionSheet: any = document.querySelector('pwa-action-sheet');\n if (!actionSheet) {\n actionSheet = document.createElement('pwa-action-sheet');\n document.body.appendChild(actionSheet);\n }\n actionSheet.header = options.promptLabelHeader || 'Photo';\n actionSheet.cancelable = false;\n actionSheet.options = [\n { title: options.promptLabelPhoto || 'From Photos' },\n { title: options.promptLabelPicture || 'Take Picture' },\n ];\n actionSheet.addEventListener('onSelection', async (e: any) => {\n const selection = e.detail;\n if (selection === 0) {\n this.fileInputExperience(options, resolve);\n } else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n } else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n\n async pickImages(_options: GalleryImageOptions): Promise<GalleryPhotos> {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise<GalleryPhotos>(async resolve => {\n this.multipleFileInputExperience(resolve);\n });\n }\n\n private async cameraExperience(\n options: ImageOptions,\n resolve: any,\n reject: any,\n ) {\n if (customElements.get('pwa-camera-modal')) {\n const cameraModal: any = document.createElement('pwa-camera-modal');\n cameraModal.facingMode =\n options.direction === CameraDirection.Front ? 'user' : 'environment';\n document.body.appendChild(cameraModal);\n try {\n await cameraModal.componentOnReady();\n cameraModal.addEventListener('onPhoto', async (e: any) => {\n const photo = e.detail;\n\n if (photo === null) {\n reject(new CapacitorException('User cancelled photos app'));\n } else if (photo instanceof Error) {\n reject(photo);\n } else {\n resolve(await this._getCameraPhoto(photo, options));\n }\n\n cameraModal.dismiss();\n document.body.removeChild(cameraModal);\n });\n\n cameraModal.present();\n } catch (e) {\n this.fileInputExperience(options, resolve);\n }\n } else {\n console.error(\n `Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`,\n );\n this.fileInputExperience(options, resolve);\n }\n }\n\n private fileInputExperience(options: ImageOptions, resolve: any) {\n let input = document.querySelector(\n '#_capacitor-camera-input',\n ) as HTMLInputElement;\n\n const cleanup = () => {\n input.parentNode?.removeChild(input);\n };\n\n if (!input) {\n input = document.createElement('input') as HTMLInputElement;\n input.id = '_capacitor-camera-input';\n input.type = 'file';\n input.hidden = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e: any) => {\n const file = input.files![0];\n let format = 'jpeg';\n\n if (file.type === 'image/png') {\n format = 'png';\n } else if (file.type === 'image/gif') {\n format = 'gif';\n }\n\n if (\n options.resultType === 'dataUrl' ||\n options.resultType === 'base64'\n ) {\n const reader = new FileReader();\n\n reader.addEventListener('load', () => {\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: reader.result,\n format,\n } as Photo);\n } else if (options.resultType === 'base64') {\n const b64 = (reader.result as string).split(',')[1];\n resolve({\n base64String: b64,\n format,\n } as Photo);\n }\n\n cleanup();\n });\n\n reader.readAsDataURL(file);\n } else {\n resolve({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n cleanup();\n }\n });\n }\n\n input.accept = 'image/*';\n (input as any).capture = true;\n\n if (\n options.source === CameraSource.Photos ||\n options.source === CameraSource.Prompt\n ) {\n input.removeAttribute('capture');\n } else if (options.direction === CameraDirection.Front) {\n (input as any).capture = 'user';\n } else if (options.direction === CameraDirection.Rear) {\n (input as any).capture = 'environment';\n }\n\n input.click();\n }\n\n private multipleFileInputExperience(resolve: any) {\n let input = document.querySelector(\n '#_capacitor-camera-input-multiple',\n ) as HTMLInputElement;\n\n const cleanup = () => {\n input.parentNode?.removeChild(input);\n };\n\n if (!input) {\n input = document.createElement('input') as HTMLInputElement;\n input.id = '_capacitor-camera-input-multiple';\n input.type = 'file';\n input.hidden = true;\n input.multiple = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e: any) => {\n const photos = [];\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < input.files!.length; i++) {\n const file = input.files![i];\n let format = 'jpeg';\n\n if (file.type === 'image/png') {\n format = 'png';\n } else if (file.type === 'image/gif') {\n format = 'gif';\n }\n photos.push({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n }\n resolve({ photos });\n cleanup();\n });\n }\n\n input.accept = 'image/*';\n\n input.click();\n }\n\n private _getCameraPhoto(photo: Blob, options: ImageOptions) {\n return new Promise<Photo>((resolve, reject) => {\n const reader = new FileReader();\n const format = photo.type.split('/')[1];\n if (options.resultType === 'uri') {\n resolve({\n webPath: URL.createObjectURL(photo),\n format: format,\n saved: false,\n });\n } else {\n reader.readAsDataURL(photo);\n reader.onloadend = () => {\n const r = reader.result as string;\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: r,\n format: format,\n saved: false,\n });\n } else {\n resolve({\n base64String: r.split(',')[1],\n format: format,\n saved: false,\n });\n }\n };\n reader.onerror = e => {\n reject(e);\n };\n }\n });\n }\n\n async checkPermissions(): Promise<PermissionStatus> {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n\n try {\n // https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query\n // the specific permissions that are supported varies among browsers that implement the\n // permissions API, so we need a try/catch in case 'camera' is invalid\n const permission = await window.navigator.permissions.query({\n name: 'camera',\n });\n return {\n camera: permission.state,\n photos: 'granted',\n };\n } catch {\n throw this.unavailable(\n 'Camera permissions are not available in this browser',\n );\n }\n }\n\n async requestPermissions(): Promise<PermissionStatus> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async pickLimitedLibraryPhotos(): Promise<GalleryPhotos> {\n throw this.unavailable('Not implemented on web.');\n }\n\n async getLimitedLibraryPhotos(): Promise<GalleryPhotos> {\n throw this.unavailable('Not implemented on web.');\n }\n}\n\nconst Camera = new CameraWeb();\n\nexport { Camera };\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAU9D,MAAM,OAAO,SAAU,SAAQ,SAAS;IACtC,KAAK,CAAC,QAAQ,CAAC,OAAqB;QAClC,qDAAqD;QACrD,OAAO,IAAI,OAAO,CAAQ,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;YAClD,IAAI,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,MAAM,KAAK,YAAY,CAAC,MAAM,EAAE;gBACjE,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;aACpD;iBAAM,IAAI,OAAO,CAAC,MAAM,KAAK,YAAY,CAAC,MAAM,EAAE;gBACjD,IAAI,WAAW,GAAQ,QAAQ,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;gBAClE,IAAI,CAAC,WAAW,EAAE;oBAChB,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;oBACzD,QAAQ,CAAC,IAAI,CAA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;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE;YAC9D,MAAM,IAAI,CAAC,WAAW,CAAC,+CAA+C,CAAC,CAAC;SACzE;QAED,IAAI;YACF,qEAAqE;YACrE,uFAAuF;YACvF,sEAAsE;YACtE,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC;gBAC1D,IAAI,EAAE,QAAQ;aACf,CAAC,CAAC;YACH,OAAO;gBACL,MAAM,EAAE,UAAU,CAAC,KAAK;gBACxB,MAAM,EAAE,SAAS;aAClB,CAAC;SACH;QAAC,WAAM;YACN,MAAM,IAAI,CAAC,WAAW,CACpB,sDAAsD,CACvD,CAAC;SACH;IACH,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,wBAAwB;QAC5B,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,uBAAuB;QAC3B,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IACpD,CAAC;CACF;AAED,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["import { WebPlugin, CapacitorException } from '@capacitor/core';\n\nimport { CameraSource, CameraDirection } from './definitions';\nimport type {\n CameraPlugin,\n GalleryImageOptions,\n GalleryPhotos,\n ImageOptions,\n PermissionStatus,\n Photo,\n} from './definitions';\n\nexport class CameraWeb extends WebPlugin implements CameraPlugin {\n async getPhoto(options: ImageOptions): Promise<Photo> {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise<Photo>(async (resolve, reject) => {\n if (options.webUseInput || options.source === CameraSource.Photos) {\n this.fileInputExperience(options, resolve, reject);\n } else if (options.source === CameraSource.Prompt) {\n let actionSheet: any = document.querySelector('pwa-action-sheet');\n if (!actionSheet) {\n actionSheet = document.createElement('pwa-action-sheet');\n document.body.appendChild(actionSheet);\n }\n actionSheet.header = options.promptLabelHeader || 'Photo';\n actionSheet.cancelable = false;\n actionSheet.options = [\n { title: options.promptLabelPhoto || 'From Photos' },\n { title: options.promptLabelPicture || 'Take Picture' },\n ];\n actionSheet.addEventListener('onSelection', async (e: any) => {\n const selection = e.detail;\n if (selection === 0) {\n this.fileInputExperience(options, resolve, reject);\n } else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n } else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n\n async pickImages(_options: GalleryImageOptions): Promise<GalleryPhotos> {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise<GalleryPhotos>(async (resolve, reject) => {\n this.multipleFileInputExperience(resolve, reject);\n });\n }\n\n private async cameraExperience(\n options: ImageOptions,\n resolve: any,\n reject: any,\n ) {\n if (customElements.get('pwa-camera-modal')) {\n const cameraModal: any = document.createElement('pwa-camera-modal');\n cameraModal.facingMode =\n options.direction === CameraDirection.Front ? 'user' : 'environment';\n document.body.appendChild(cameraModal);\n try {\n await cameraModal.componentOnReady();\n cameraModal.addEventListener('onPhoto', async (e: any) => {\n const photo = e.detail;\n\n if (photo === null) {\n reject(new CapacitorException('User cancelled photos app'));\n } else if (photo instanceof Error) {\n reject(photo);\n } else {\n resolve(await this._getCameraPhoto(photo, options));\n }\n\n cameraModal.dismiss();\n document.body.removeChild(cameraModal);\n });\n\n cameraModal.present();\n } catch (e) {\n this.fileInputExperience(options, resolve, reject);\n }\n } else {\n console.error(\n `Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`,\n );\n this.fileInputExperience(options, resolve, reject);\n }\n }\n\n private fileInputExperience(\n options: ImageOptions,\n resolve: any,\n reject: any,\n ) {\n let input = document.querySelector(\n '#_capacitor-camera-input',\n ) as HTMLInputElement;\n\n const cleanup = () => {\n input.parentNode?.removeChild(input);\n };\n\n if (!input) {\n input = document.createElement('input') as HTMLInputElement;\n input.id = '_capacitor-camera-input';\n input.type = 'file';\n input.hidden = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e: any) => {\n const file = input.files![0];\n let format = 'jpeg';\n\n if (file.type === 'image/png') {\n format = 'png';\n } else if (file.type === 'image/gif') {\n format = 'gif';\n }\n\n if (\n options.resultType === 'dataUrl' ||\n options.resultType === 'base64'\n ) {\n const reader = new FileReader();\n\n reader.addEventListener('load', () => {\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: reader.result,\n format,\n } as Photo);\n } else if (options.resultType === 'base64') {\n const b64 = (reader.result as string).split(',')[1];\n resolve({\n base64String: b64,\n format,\n } as Photo);\n }\n\n cleanup();\n });\n\n reader.readAsDataURL(file);\n } else {\n resolve({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n cleanup();\n }\n });\n input.addEventListener('cancel', (_e: any) => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n });\n }\n\n input.accept = 'image/*';\n (input as any).capture = true;\n\n if (\n options.source === CameraSource.Photos ||\n options.source === CameraSource.Prompt\n ) {\n input.removeAttribute('capture');\n } else if (options.direction === CameraDirection.Front) {\n (input as any).capture = 'user';\n } else if (options.direction === CameraDirection.Rear) {\n (input as any).capture = 'environment';\n }\n\n input.click();\n }\n\n private multipleFileInputExperience(resolve: any, reject: any) {\n let input = document.querySelector(\n '#_capacitor-camera-input-multiple',\n ) as HTMLInputElement;\n\n const cleanup = () => {\n input.parentNode?.removeChild(input);\n };\n\n if (!input) {\n input = document.createElement('input') as HTMLInputElement;\n input.id = '_capacitor-camera-input-multiple';\n input.type = 'file';\n input.hidden = true;\n input.multiple = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e: any) => {\n const photos = [];\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < input.files!.length; i++) {\n const file = input.files![i];\n let format = 'jpeg';\n\n if (file.type === 'image/png') {\n format = 'png';\n } else if (file.type === 'image/gif') {\n format = 'gif';\n }\n photos.push({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n }\n resolve({ photos });\n cleanup();\n });\n input.addEventListener('cancel', (_e: any) => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n });\n }\n\n input.accept = 'image/*';\n\n input.click();\n }\n\n private _getCameraPhoto(photo: Blob, options: ImageOptions) {\n return new Promise<Photo>((resolve, reject) => {\n const reader = new FileReader();\n const format = photo.type.split('/')[1];\n if (options.resultType === 'uri') {\n resolve({\n webPath: URL.createObjectURL(photo),\n format: format,\n saved: false,\n });\n } else {\n reader.readAsDataURL(photo);\n reader.onloadend = () => {\n const r = reader.result as string;\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: r,\n format: format,\n saved: false,\n });\n } else {\n resolve({\n base64String: r.split(',')[1],\n format: format,\n saved: false,\n });\n }\n };\n reader.onerror = e => {\n reject(e);\n };\n }\n });\n }\n\n async checkPermissions(): Promise<PermissionStatus> {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n\n try {\n // https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query\n // the specific permissions that are supported varies among browsers that implement the\n // permissions API, so we need a try/catch in case 'camera' is invalid\n const permission = await window.navigator.permissions.query({\n name: 'camera',\n });\n return {\n camera: permission.state,\n photos: 'granted',\n };\n } catch {\n throw this.unavailable(\n 'Camera permissions are not available in this browser',\n );\n }\n }\n\n async requestPermissions(): Promise<PermissionStatus> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async pickLimitedLibraryPhotos(): Promise<GalleryPhotos> {\n throw this.unavailable('Not implemented on web.');\n }\n\n async getLimitedLibraryPhotos(): Promise<GalleryPhotos> {\n throw this.unavailable('Not implemented on web.');\n }\n}\n\nconst Camera = new CameraWeb();\n\nexport { Camera };\n"]}
@@ -40,7 +40,7 @@ class CameraWeb extends core.WebPlugin {
40
40
  // eslint-disable-next-line no-async-promise-executor
41
41
  return new Promise(async (resolve, reject) => {
42
42
  if (options.webUseInput || options.source === exports.CameraSource.Photos) {
43
- this.fileInputExperience(options, resolve);
43
+ this.fileInputExperience(options, resolve, reject);
44
44
  }
45
45
  else if (options.source === exports.CameraSource.Prompt) {
46
46
  let actionSheet = document.querySelector('pwa-action-sheet');
@@ -57,7 +57,7 @@ class CameraWeb extends core.WebPlugin {
57
57
  actionSheet.addEventListener('onSelection', async (e) => {
58
58
  const selection = e.detail;
59
59
  if (selection === 0) {
60
- this.fileInputExperience(options, resolve);
60
+ this.fileInputExperience(options, resolve, reject);
61
61
  }
62
62
  else {
63
63
  this.cameraExperience(options, resolve, reject);
@@ -71,8 +71,8 @@ class CameraWeb extends core.WebPlugin {
71
71
  }
72
72
  async pickImages(_options) {
73
73
  // eslint-disable-next-line no-async-promise-executor
74
- return new Promise(async (resolve) => {
75
- this.multipleFileInputExperience(resolve);
74
+ return new Promise(async (resolve, reject) => {
75
+ this.multipleFileInputExperience(resolve, reject);
76
76
  });
77
77
  }
78
78
  async cameraExperience(options, resolve, reject) {
@@ -100,15 +100,15 @@ class CameraWeb extends core.WebPlugin {
100
100
  cameraModal.present();
101
101
  }
102
102
  catch (e) {
103
- this.fileInputExperience(options, resolve);
103
+ this.fileInputExperience(options, resolve, reject);
104
104
  }
105
105
  }
106
106
  else {
107
107
  console.error(`Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`);
108
- this.fileInputExperience(options, resolve);
108
+ this.fileInputExperience(options, resolve, reject);
109
109
  }
110
110
  }
111
- fileInputExperience(options, resolve) {
111
+ fileInputExperience(options, resolve, reject) {
112
112
  let input = document.querySelector('#_capacitor-camera-input');
113
113
  const cleanup = () => {
114
114
  var _a;
@@ -158,6 +158,10 @@ class CameraWeb extends core.WebPlugin {
158
158
  cleanup();
159
159
  }
160
160
  });
161
+ input.addEventListener('cancel', (_e) => {
162
+ reject(new core.CapacitorException('User cancelled photos app'));
163
+ cleanup();
164
+ });
161
165
  }
162
166
  input.accept = 'image/*';
163
167
  input.capture = true;
@@ -173,7 +177,7 @@ class CameraWeb extends core.WebPlugin {
173
177
  }
174
178
  input.click();
175
179
  }
176
- multipleFileInputExperience(resolve) {
180
+ multipleFileInputExperience(resolve, reject) {
177
181
  let input = document.querySelector('#_capacitor-camera-input-multiple');
178
182
  const cleanup = () => {
179
183
  var _a;
@@ -206,6 +210,10 @@ class CameraWeb extends core.WebPlugin {
206
210
  resolve({ photos });
207
211
  cleanup();
208
212
  });
213
+ input.addEventListener('cancel', (_e) => {
214
+ reject(new core.CapacitorException('User cancelled photos app'));
215
+ cleanup();
216
+ });
209
217
  }
210
218
  input.accept = 'image/*';
211
219
  input.click();
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var CameraSource;\n(function (CameraSource) {\n /**\n * Prompts the user to select either the photo album or take a photo.\n */\n CameraSource[\"Prompt\"] = \"PROMPT\";\n /**\n * Take a new photo using the camera.\n */\n CameraSource[\"Camera\"] = \"CAMERA\";\n /**\n * Pick an existing photo from the gallery or photo album.\n */\n CameraSource[\"Photos\"] = \"PHOTOS\";\n})(CameraSource || (CameraSource = {}));\nexport var CameraDirection;\n(function (CameraDirection) {\n CameraDirection[\"Rear\"] = \"REAR\";\n CameraDirection[\"Front\"] = \"FRONT\";\n})(CameraDirection || (CameraDirection = {}));\nexport var CameraResultType;\n(function (CameraResultType) {\n CameraResultType[\"Uri\"] = \"uri\";\n CameraResultType[\"Base64\"] = \"base64\";\n CameraResultType[\"DataUrl\"] = \"dataUrl\";\n})(CameraResultType || (CameraResultType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Camera = registerPlugin('Camera', {\n web: () => import('./web').then(m => new m.CameraWeb()),\n});\nexport * from './definitions';\nexport { Camera };\n//# sourceMappingURL=index.js.map","import { WebPlugin, CapacitorException } from '@capacitor/core';\nimport { CameraSource, CameraDirection } from './definitions';\nexport class CameraWeb extends WebPlugin {\n async getPhoto(options) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n if (options.webUseInput || options.source === CameraSource.Photos) {\n this.fileInputExperience(options, resolve);\n }\n else if (options.source === CameraSource.Prompt) {\n let actionSheet = document.querySelector('pwa-action-sheet');\n if (!actionSheet) {\n actionSheet = document.createElement('pwa-action-sheet');\n document.body.appendChild(actionSheet);\n }\n actionSheet.header = options.promptLabelHeader || 'Photo';\n actionSheet.cancelable = false;\n actionSheet.options = [\n { title: options.promptLabelPhoto || 'From Photos' },\n { title: options.promptLabelPicture || 'Take Picture' },\n ];\n actionSheet.addEventListener('onSelection', async (e) => {\n const selection = e.detail;\n if (selection === 0) {\n this.fileInputExperience(options, resolve);\n }\n else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n async pickImages(_options) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve) => {\n this.multipleFileInputExperience(resolve);\n });\n }\n async cameraExperience(options, resolve, reject) {\n if (customElements.get('pwa-camera-modal')) {\n const cameraModal = document.createElement('pwa-camera-modal');\n cameraModal.facingMode =\n options.direction === CameraDirection.Front ? 'user' : 'environment';\n document.body.appendChild(cameraModal);\n try {\n await cameraModal.componentOnReady();\n cameraModal.addEventListener('onPhoto', async (e) => {\n const photo = e.detail;\n if (photo === null) {\n reject(new CapacitorException('User cancelled photos app'));\n }\n else if (photo instanceof Error) {\n reject(photo);\n }\n else {\n resolve(await this._getCameraPhoto(photo, options));\n }\n cameraModal.dismiss();\n document.body.removeChild(cameraModal);\n });\n cameraModal.present();\n }\n catch (e) {\n this.fileInputExperience(options, resolve);\n }\n }\n else {\n console.error(`Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`);\n this.fileInputExperience(options, resolve);\n }\n }\n fileInputExperience(options, resolve) {\n let input = document.querySelector('#_capacitor-camera-input');\n const cleanup = () => {\n var _a;\n (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n };\n if (!input) {\n input = document.createElement('input');\n input.id = '_capacitor-camera-input';\n input.type = 'file';\n input.hidden = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e) => {\n const file = input.files[0];\n let format = 'jpeg';\n if (file.type === 'image/png') {\n format = 'png';\n }\n else if (file.type === 'image/gif') {\n format = 'gif';\n }\n if (options.resultType === 'dataUrl' ||\n options.resultType === 'base64') {\n const reader = new FileReader();\n reader.addEventListener('load', () => {\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: reader.result,\n format,\n });\n }\n else if (options.resultType === 'base64') {\n const b64 = reader.result.split(',')[1];\n resolve({\n base64String: b64,\n format,\n });\n }\n cleanup();\n });\n reader.readAsDataURL(file);\n }\n else {\n resolve({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n cleanup();\n }\n });\n }\n input.accept = 'image/*';\n input.capture = true;\n if (options.source === CameraSource.Photos ||\n options.source === CameraSource.Prompt) {\n input.removeAttribute('capture');\n }\n else if (options.direction === CameraDirection.Front) {\n input.capture = 'user';\n }\n else if (options.direction === CameraDirection.Rear) {\n input.capture = 'environment';\n }\n input.click();\n }\n multipleFileInputExperience(resolve) {\n let input = document.querySelector('#_capacitor-camera-input-multiple');\n const cleanup = () => {\n var _a;\n (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n };\n if (!input) {\n input = document.createElement('input');\n input.id = '_capacitor-camera-input-multiple';\n input.type = 'file';\n input.hidden = true;\n input.multiple = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e) => {\n const photos = [];\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < input.files.length; i++) {\n const file = input.files[i];\n let format = 'jpeg';\n if (file.type === 'image/png') {\n format = 'png';\n }\n else if (file.type === 'image/gif') {\n format = 'gif';\n }\n photos.push({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n }\n resolve({ photos });\n cleanup();\n });\n }\n input.accept = 'image/*';\n input.click();\n }\n _getCameraPhoto(photo, options) {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n const format = photo.type.split('/')[1];\n if (options.resultType === 'uri') {\n resolve({\n webPath: URL.createObjectURL(photo),\n format: format,\n saved: false,\n });\n }\n else {\n reader.readAsDataURL(photo);\n reader.onloadend = () => {\n const r = reader.result;\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: r,\n format: format,\n saved: false,\n });\n }\n else {\n resolve({\n base64String: r.split(',')[1],\n format: format,\n saved: false,\n });\n }\n };\n reader.onerror = e => {\n reject(e);\n };\n }\n });\n }\n async checkPermissions() {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n try {\n // https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query\n // the specific permissions that are supported varies among browsers that implement the\n // permissions API, so we need a try/catch in case 'camera' is invalid\n const permission = await window.navigator.permissions.query({\n name: 'camera',\n });\n return {\n camera: permission.state,\n photos: 'granted',\n };\n }\n catch (_a) {\n throw this.unavailable('Camera permissions are not available in this browser');\n }\n }\n async requestPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n async pickLimitedLibraryPhotos() {\n throw this.unavailable('Not implemented on web.');\n }\n async getLimitedLibraryPhotos() {\n throw this.unavailable('Not implemented on web.');\n }\n}\nconst Camera = new CameraWeb();\nexport { Camera };\n//# sourceMappingURL=web.js.map"],"names":["CameraSource","CameraDirection","CameraResultType","Camera","registerPlugin","WebPlugin","CapacitorException"],"mappings":";;;;;;AAAWA,8BAAa;AACxB,CAAC,UAAU,YAAY,EAAE;AACzB;AACA;AACA;AACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;AACtC;AACA;AACA;AACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QA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C;AACX,KAAK;AACL,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE;AACxE,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,+CAA+C,CAAC,CAAC;AACpF,SAAS;AACT,QAAQ,IAAI;AACZ;AACA;AACA;AACA,YAAY,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC;AACxE,gBAAgB,IAAI,EAAE,QAAQ;AAC9B,aAAa,CAAC,CAAC;AACf,YAAY,OAAO;AACnB,gBAAgB,MAAM,EAAE,UAAU,CAAC,KAAK;AACxC,gBAAgB,MAAM,EAAE,SAAS;AACjC,aAAa,CAAC;AACd,SAAS;AACT,QAAQ,OAAO,EAAE,EAAE;AACnB,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,sDAAsD,CAAC,CAAC;AAC3F,SAAS;AACT,KAAK;AACL,IAAI,MAAM,kBAAkB,GAAG;AAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL,IAAI,MAAM,wBAAwB,GAAG;AACrC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;AAC1D,KAAK;AACL,IAAI,MAAM,uBAAuB,GAAG;AACpC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;AAC1D,KAAK;AACL,CAAC;AACD,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var CameraSource;\n(function (CameraSource) {\n /**\n * Prompts the user to select either the photo album or take a photo.\n */\n CameraSource[\"Prompt\"] = \"PROMPT\";\n /**\n * Take a new photo using the camera.\n */\n CameraSource[\"Camera\"] = \"CAMERA\";\n /**\n * Pick an existing photo from the gallery or photo album.\n */\n CameraSource[\"Photos\"] = \"PHOTOS\";\n})(CameraSource || (CameraSource = {}));\nexport var CameraDirection;\n(function (CameraDirection) {\n CameraDirection[\"Rear\"] = \"REAR\";\n CameraDirection[\"Front\"] = \"FRONT\";\n})(CameraDirection || (CameraDirection = {}));\nexport var CameraResultType;\n(function (CameraResultType) {\n CameraResultType[\"Uri\"] = \"uri\";\n CameraResultType[\"Base64\"] = \"base64\";\n CameraResultType[\"DataUrl\"] = \"dataUrl\";\n})(CameraResultType || (CameraResultType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Camera = registerPlugin('Camera', {\n web: () => import('./web').then(m => new m.CameraWeb()),\n});\nexport * from './definitions';\nexport { Camera };\n//# sourceMappingURL=index.js.map","import { WebPlugin, CapacitorException } from '@capacitor/core';\nimport { CameraSource, CameraDirection } from './definitions';\nexport class CameraWeb extends WebPlugin {\n async getPhoto(options) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n if (options.webUseInput || options.source === CameraSource.Photos) {\n this.fileInputExperience(options, resolve, reject);\n }\n else if (options.source === CameraSource.Prompt) {\n let actionSheet = document.querySelector('pwa-action-sheet');\n if (!actionSheet) {\n actionSheet = document.createElement('pwa-action-sheet');\n document.body.appendChild(actionSheet);\n }\n actionSheet.header = options.promptLabelHeader || 'Photo';\n actionSheet.cancelable = false;\n actionSheet.options = [\n { title: options.promptLabelPhoto || 'From Photos' },\n { title: options.promptLabelPicture || 'Take Picture' },\n ];\n actionSheet.addEventListener('onSelection', async (e) => {\n const selection = e.detail;\n if (selection === 0) {\n this.fileInputExperience(options, resolve, reject);\n }\n else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n async pickImages(_options) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n this.multipleFileInputExperience(resolve, reject);\n });\n }\n async cameraExperience(options, resolve, reject) {\n if (customElements.get('pwa-camera-modal')) {\n const cameraModal = document.createElement('pwa-camera-modal');\n cameraModal.facingMode =\n options.direction === CameraDirection.Front ? 'user' : 'environment';\n document.body.appendChild(cameraModal);\n try {\n await cameraModal.componentOnReady();\n cameraModal.addEventListener('onPhoto', async (e) => {\n const photo = e.detail;\n if (photo === null) {\n reject(new CapacitorException('User cancelled photos app'));\n }\n else if (photo instanceof Error) {\n reject(photo);\n }\n else {\n resolve(await this._getCameraPhoto(photo, options));\n }\n cameraModal.dismiss();\n document.body.removeChild(cameraModal);\n });\n cameraModal.present();\n }\n catch (e) {\n this.fileInputExperience(options, resolve, reject);\n }\n }\n else {\n console.error(`Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`);\n this.fileInputExperience(options, resolve, reject);\n }\n }\n fileInputExperience(options, resolve, reject) {\n let input = document.querySelector('#_capacitor-camera-input');\n const cleanup = () => {\n var _a;\n (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n };\n if (!input) {\n input = document.createElement('input');\n input.id = '_capacitor-camera-input';\n input.type = 'file';\n input.hidden = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e) => {\n const file = input.files[0];\n let format = 'jpeg';\n if (file.type === 'image/png') {\n format = 'png';\n }\n else if (file.type === 'image/gif') {\n format = 'gif';\n }\n if (options.resultType === 'dataUrl' ||\n options.resultType === 'base64') {\n const reader = new FileReader();\n reader.addEventListener('load', () => {\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: reader.result,\n format,\n });\n }\n else if (options.resultType === 'base64') {\n const b64 = reader.result.split(',')[1];\n resolve({\n base64String: b64,\n format,\n });\n }\n cleanup();\n });\n reader.readAsDataURL(file);\n }\n else {\n resolve({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n cleanup();\n }\n });\n input.addEventListener('cancel', (_e) => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n });\n }\n input.accept = 'image/*';\n input.capture = true;\n if (options.source === CameraSource.Photos ||\n options.source === CameraSource.Prompt) {\n input.removeAttribute('capture');\n }\n else if (options.direction === CameraDirection.Front) {\n input.capture = 'user';\n }\n else if (options.direction === CameraDirection.Rear) {\n input.capture = 'environment';\n }\n input.click();\n }\n multipleFileInputExperience(resolve, reject) {\n let input = document.querySelector('#_capacitor-camera-input-multiple');\n const cleanup = () => {\n var _a;\n (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n };\n if (!input) {\n input = document.createElement('input');\n input.id = '_capacitor-camera-input-multiple';\n input.type = 'file';\n input.hidden = true;\n input.multiple = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e) => {\n const photos = [];\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < input.files.length; i++) {\n const file = input.files[i];\n let format = 'jpeg';\n if (file.type === 'image/png') {\n format = 'png';\n }\n else if (file.type === 'image/gif') {\n format = 'gif';\n }\n photos.push({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n }\n resolve({ photos });\n cleanup();\n });\n input.addEventListener('cancel', (_e) => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n });\n }\n input.accept = 'image/*';\n input.click();\n }\n _getCameraPhoto(photo, options) {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n const format = photo.type.split('/')[1];\n if (options.resultType === 'uri') {\n resolve({\n webPath: URL.createObjectURL(photo),\n format: format,\n saved: false,\n });\n }\n else {\n reader.readAsDataURL(photo);\n reader.onloadend = () => {\n const r = reader.result;\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: r,\n format: format,\n saved: false,\n });\n }\n else {\n resolve({\n base64String: r.split(',')[1],\n format: format,\n saved: false,\n });\n }\n };\n reader.onerror = e => {\n reject(e);\n };\n }\n });\n }\n async checkPermissions() {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n try {\n // https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query\n // the specific permissions that are supported varies among browsers that implement the\n // permissions API, so we need a try/catch in case 'camera' is invalid\n const permission = await window.navigator.permissions.query({\n name: 'camera',\n });\n return {\n camera: permission.state,\n photos: 'granted',\n };\n }\n catch (_a) {\n throw this.unavailable('Camera permissions are not available in this browser');\n }\n }\n async requestPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n async pickLimitedLibraryPhotos() {\n throw this.unavailable('Not implemented on web.');\n }\n async getLimitedLibraryPhotos() {\n throw this.unavailable('Not implemented on web.');\n }\n}\nconst Camera = new CameraWeb();\nexport { Camera };\n//# sourceMappingURL=web.js.map"],"names":["CameraSource","CameraDirection","CameraResultType","Camera","registerPlugin","WebPlugin","CapacitorException"],"mappings":";;;;;;AAAWA,8BAAa;AACxB,CAAC,UAAU,YAAY,EAAE;AACzB;AACA;AACA;AACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;AACtC;AACA;AACA;AACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;AACtC;AACA;AACA;AACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;AACtC,CAAC,EAAEA,oBAAY,KAAKA,oBAAY,GAAG,EAAE,CAAC,CAAC,CAAC;AAC7BC,iCAAgB;AAC3B,CAAC,UAAU,eAAe,EAAE;AAC5B,IAAI,eAAe,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AACrC,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACvC,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC,CAAC;AACnCC,kCAAiB;AAC5B,CAAC,UAAU,gBAAgB,EAAE;AAC7B,IAAI,gBAAgB,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;AACpC,IAAI,gBAAgB,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;AAC1C,IAAI,gBAAgB,CAAC,SAAS,CA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AAW,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE;AACxE,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,+CAA+C,CAAC,CAAC;AACpF,SAAS;AACT,QAAQ,IAAI;AACZ;AACA;AACA;AACA,YAAY,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC;AACxE,gBAAgB,IAAI,EAAE,QAAQ;AAC9B,aAAa,CAAC,CAAC;AACf,YAAY,OAAO;AACnB,gBAAgB,MAAM,EAAE,UAAU,CAAC,KAAK;AACxC,gBAAgB,MAAM,EAAE,SAAS;AACjC,aAAa,CAAC;AACd,SAAS;AACT,QAAQ,OAAO,EAAE,EAAE;AACnB,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,sDAAsD,CAAC,CAAC;AAC3F,SAAS;AACT,KAAK;AACL,IAAI,MAAM,kBAAkB,GAAG;AAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL,IAAI,MAAM,wBAAwB,GAAG;AACrC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;AAC1D,KAAK;AACL,IAAI,MAAM,uBAAuB,GAAG;AACpC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;AAC1D,KAAK;AACL,CAAC;AACD,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE;;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -37,7 +37,7 @@ var capacitorCamera = (function (exports, core) {
37
37
  // eslint-disable-next-line no-async-promise-executor
38
38
  return new Promise(async (resolve, reject) => {
39
39
  if (options.webUseInput || options.source === exports.CameraSource.Photos) {
40
- this.fileInputExperience(options, resolve);
40
+ this.fileInputExperience(options, resolve, reject);
41
41
  }
42
42
  else if (options.source === exports.CameraSource.Prompt) {
43
43
  let actionSheet = document.querySelector('pwa-action-sheet');
@@ -54,7 +54,7 @@ var capacitorCamera = (function (exports, core) {
54
54
  actionSheet.addEventListener('onSelection', async (e) => {
55
55
  const selection = e.detail;
56
56
  if (selection === 0) {
57
- this.fileInputExperience(options, resolve);
57
+ this.fileInputExperience(options, resolve, reject);
58
58
  }
59
59
  else {
60
60
  this.cameraExperience(options, resolve, reject);
@@ -68,8 +68,8 @@ var capacitorCamera = (function (exports, core) {
68
68
  }
69
69
  async pickImages(_options) {
70
70
  // eslint-disable-next-line no-async-promise-executor
71
- return new Promise(async (resolve) => {
72
- this.multipleFileInputExperience(resolve);
71
+ return new Promise(async (resolve, reject) => {
72
+ this.multipleFileInputExperience(resolve, reject);
73
73
  });
74
74
  }
75
75
  async cameraExperience(options, resolve, reject) {
@@ -97,15 +97,15 @@ var capacitorCamera = (function (exports, core) {
97
97
  cameraModal.present();
98
98
  }
99
99
  catch (e) {
100
- this.fileInputExperience(options, resolve);
100
+ this.fileInputExperience(options, resolve, reject);
101
101
  }
102
102
  }
103
103
  else {
104
104
  console.error(`Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`);
105
- this.fileInputExperience(options, resolve);
105
+ this.fileInputExperience(options, resolve, reject);
106
106
  }
107
107
  }
108
- fileInputExperience(options, resolve) {
108
+ fileInputExperience(options, resolve, reject) {
109
109
  let input = document.querySelector('#_capacitor-camera-input');
110
110
  const cleanup = () => {
111
111
  var _a;
@@ -155,6 +155,10 @@ var capacitorCamera = (function (exports, core) {
155
155
  cleanup();
156
156
  }
157
157
  });
158
+ input.addEventListener('cancel', (_e) => {
159
+ reject(new core.CapacitorException('User cancelled photos app'));
160
+ cleanup();
161
+ });
158
162
  }
159
163
  input.accept = 'image/*';
160
164
  input.capture = true;
@@ -170,7 +174,7 @@ var capacitorCamera = (function (exports, core) {
170
174
  }
171
175
  input.click();
172
176
  }
173
- multipleFileInputExperience(resolve) {
177
+ multipleFileInputExperience(resolve, reject) {
174
178
  let input = document.querySelector('#_capacitor-camera-input-multiple');
175
179
  const cleanup = () => {
176
180
  var _a;
@@ -203,6 +207,10 @@ var capacitorCamera = (function (exports, core) {
203
207
  resolve({ photos });
204
208
  cleanup();
205
209
  });
210
+ input.addEventListener('cancel', (_e) => {
211
+ reject(new core.CapacitorException('User cancelled photos app'));
212
+ cleanup();
213
+ });
206
214
  }
207
215
  input.accept = 'image/*';
208
216
  input.click();
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var CameraSource;\n(function (CameraSource) {\n /**\n * Prompts the user to select either the photo album or take a photo.\n */\n CameraSource[\"Prompt\"] = \"PROMPT\";\n /**\n * Take a new photo using the camera.\n */\n CameraSource[\"Camera\"] = \"CAMERA\";\n /**\n * Pick an existing photo from the gallery or photo album.\n */\n CameraSource[\"Photos\"] = \"PHOTOS\";\n})(CameraSource || (CameraSource = {}));\nexport var CameraDirection;\n(function (CameraDirection) {\n CameraDirection[\"Rear\"] = \"REAR\";\n CameraDirection[\"Front\"] = \"FRONT\";\n})(CameraDirection || (CameraDirection = {}));\nexport var CameraResultType;\n(function (CameraResultType) {\n CameraResultType[\"Uri\"] = \"uri\";\n CameraResultType[\"Base64\"] = \"base64\";\n CameraResultType[\"DataUrl\"] = \"dataUrl\";\n})(CameraResultType || (CameraResultType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Camera = registerPlugin('Camera', {\n web: () => import('./web').then(m => new m.CameraWeb()),\n});\nexport * from './definitions';\nexport { Camera };\n//# sourceMappingURL=index.js.map","import { WebPlugin, CapacitorException } from '@capacitor/core';\nimport { CameraSource, CameraDirection } from './definitions';\nexport class CameraWeb extends WebPlugin {\n async getPhoto(options) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n if (options.webUseInput || options.source === CameraSource.Photos) {\n this.fileInputExperience(options, resolve);\n }\n else if (options.source === CameraSource.Prompt) {\n let actionSheet = document.querySelector('pwa-action-sheet');\n if (!actionSheet) {\n actionSheet = document.createElement('pwa-action-sheet');\n document.body.appendChild(actionSheet);\n }\n actionSheet.header = options.promptLabelHeader || 'Photo';\n actionSheet.cancelable = false;\n actionSheet.options = [\n { title: options.promptLabelPhoto || 'From Photos' },\n { title: options.promptLabelPicture || 'Take Picture' },\n ];\n actionSheet.addEventListener('onSelection', async (e) => {\n const selection = e.detail;\n if (selection === 0) {\n this.fileInputExperience(options, resolve);\n }\n else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n async pickImages(_options) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve) => {\n this.multipleFileInputExperience(resolve);\n });\n }\n async cameraExperience(options, resolve, reject) {\n if (customElements.get('pwa-camera-modal')) {\n const cameraModal = document.createElement('pwa-camera-modal');\n cameraModal.facingMode =\n options.direction === CameraDirection.Front ? 'user' : 'environment';\n document.body.appendChild(cameraModal);\n try {\n await cameraModal.componentOnReady();\n cameraModal.addEventListener('onPhoto', async (e) => {\n const photo = e.detail;\n if (photo === null) {\n reject(new CapacitorException('User cancelled photos app'));\n }\n else if (photo instanceof Error) {\n reject(photo);\n }\n else {\n resolve(await this._getCameraPhoto(photo, options));\n }\n cameraModal.dismiss();\n document.body.removeChild(cameraModal);\n });\n cameraModal.present();\n }\n catch (e) {\n this.fileInputExperience(options, resolve);\n }\n }\n else {\n console.error(`Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`);\n this.fileInputExperience(options, resolve);\n }\n }\n fileInputExperience(options, resolve) {\n let input = document.querySelector('#_capacitor-camera-input');\n const cleanup = () => {\n var _a;\n (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n };\n if (!input) {\n input = document.createElement('input');\n input.id = '_capacitor-camera-input';\n input.type = 'file';\n input.hidden = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e) => {\n const file = input.files[0];\n let format = 'jpeg';\n if (file.type === 'image/png') {\n format = 'png';\n }\n else if (file.type === 'image/gif') {\n format = 'gif';\n }\n if (options.resultType === 'dataUrl' ||\n options.resultType === 'base64') {\n const reader = new FileReader();\n reader.addEventListener('load', () => {\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: reader.result,\n format,\n });\n }\n else if (options.resultType === 'base64') {\n const b64 = reader.result.split(',')[1];\n resolve({\n base64String: b64,\n format,\n });\n }\n cleanup();\n });\n reader.readAsDataURL(file);\n }\n else {\n resolve({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n cleanup();\n }\n });\n }\n input.accept = 'image/*';\n input.capture = true;\n if (options.source === CameraSource.Photos ||\n options.source === CameraSource.Prompt) {\n input.removeAttribute('capture');\n }\n else if (options.direction === CameraDirection.Front) {\n input.capture = 'user';\n }\n else if (options.direction === CameraDirection.Rear) {\n input.capture = 'environment';\n }\n input.click();\n }\n multipleFileInputExperience(resolve) {\n let input = document.querySelector('#_capacitor-camera-input-multiple');\n const cleanup = () => {\n var _a;\n (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n };\n if (!input) {\n input = document.createElement('input');\n input.id = '_capacitor-camera-input-multiple';\n input.type = 'file';\n input.hidden = true;\n input.multiple = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e) => {\n const photos = [];\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < input.files.length; i++) {\n const file = input.files[i];\n let format = 'jpeg';\n if (file.type === 'image/png') {\n format = 'png';\n }\n else if (file.type === 'image/gif') {\n format = 'gif';\n }\n photos.push({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n }\n resolve({ photos });\n cleanup();\n });\n }\n input.accept = 'image/*';\n input.click();\n }\n _getCameraPhoto(photo, options) {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n const format = photo.type.split('/')[1];\n if (options.resultType === 'uri') {\n resolve({\n webPath: URL.createObjectURL(photo),\n format: format,\n saved: false,\n });\n }\n else {\n reader.readAsDataURL(photo);\n reader.onloadend = () => {\n const r = reader.result;\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: r,\n format: format,\n saved: false,\n });\n }\n else {\n resolve({\n base64String: r.split(',')[1],\n format: format,\n saved: false,\n });\n }\n };\n reader.onerror = e => {\n reject(e);\n };\n }\n });\n }\n async checkPermissions() {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n try {\n // https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query\n // the specific permissions that are supported varies among browsers that implement the\n // permissions API, so we need a try/catch in case 'camera' is invalid\n const permission = await window.navigator.permissions.query({\n name: 'camera',\n });\n return {\n camera: permission.state,\n photos: 'granted',\n };\n }\n catch (_a) {\n throw this.unavailable('Camera permissions are not available in this browser');\n }\n }\n async requestPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n async pickLimitedLibraryPhotos() {\n throw this.unavailable('Not implemented on web.');\n }\n async getLimitedLibraryPhotos() {\n throw this.unavailable('Not implemented on web.');\n }\n}\nconst Camera = new CameraWeb();\nexport { Camera };\n//# sourceMappingURL=web.js.map"],"names":["CameraSource","CameraDirection","CameraResultType","Camera","registerPlugin","WebPlugin","CapacitorException"],"mappings":";;;AAAWA,kCAAa;IACxB,CAAC,UAAU,YAAY,EAAE;IACzB;IACA;IACA;IACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;IACtC;IACA;IACA;IACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;IACtC;IACA;IACA;IACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;IACtC,CAAC,EAAEA,oBAAY,KAAKA,oBAAY,GAAG,EAAE,CAAC,CAAC,CAAC;AAC7BC,qCAAgB;IAC3B,CAAC,UAAU,eAAe,EAAE;IAC5B,IAAI,eAAe,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IACrC,IAAI,eAAe,CAAC,O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AAS,CAAC,WAAW,CAAC,KAAK,CAAC;IACxE,gBAAgB,IAAI,EAAE,QAAQ;IAC9B,aAAa,CAAC,CAAC;IACf,YAAY,OAAO;IACnB,gBAAgB,MAAM,EAAE,UAAU,CAAC,KAAK;IACxC,gBAAgB,MAAM,EAAE,SAAS;IACjC,aAAa,CAAC;IACd,SAAS;IACT,QAAQ,OAAO,EAAE,EAAE;IACnB,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,sDAAsD,CAAC,CAAC;IAC3F,SAAS;IACT,KAAK;IACL,IAAI,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL,IAAI,MAAM,wBAAwB,GAAG;IACrC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IAC1D,KAAK;IACL,IAAI,MAAM,uBAAuB,GAAG;IACpC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IAC1D,KAAK;IACL,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var CameraSource;\n(function (CameraSource) {\n /**\n * Prompts the user to select either the photo album or take a photo.\n */\n CameraSource[\"Prompt\"] = \"PROMPT\";\n /**\n * Take a new photo using the camera.\n */\n CameraSource[\"Camera\"] = \"CAMERA\";\n /**\n * Pick an existing photo from the gallery or photo album.\n */\n CameraSource[\"Photos\"] = \"PHOTOS\";\n})(CameraSource || (CameraSource = {}));\nexport var CameraDirection;\n(function (CameraDirection) {\n CameraDirection[\"Rear\"] = \"REAR\";\n CameraDirection[\"Front\"] = \"FRONT\";\n})(CameraDirection || (CameraDirection = {}));\nexport var CameraResultType;\n(function (CameraResultType) {\n CameraResultType[\"Uri\"] = \"uri\";\n CameraResultType[\"Base64\"] = \"base64\";\n CameraResultType[\"DataUrl\"] = \"dataUrl\";\n})(CameraResultType || (CameraResultType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Camera = registerPlugin('Camera', {\n web: () => import('./web').then(m => new m.CameraWeb()),\n});\nexport * from './definitions';\nexport { Camera };\n//# sourceMappingURL=index.js.map","import { WebPlugin, CapacitorException } from '@capacitor/core';\nimport { CameraSource, CameraDirection } from './definitions';\nexport class CameraWeb extends WebPlugin {\n async getPhoto(options) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n if (options.webUseInput || options.source === CameraSource.Photos) {\n this.fileInputExperience(options, resolve, reject);\n }\n else if (options.source === CameraSource.Prompt) {\n let actionSheet = document.querySelector('pwa-action-sheet');\n if (!actionSheet) {\n actionSheet = document.createElement('pwa-action-sheet');\n document.body.appendChild(actionSheet);\n }\n actionSheet.header = options.promptLabelHeader || 'Photo';\n actionSheet.cancelable = false;\n actionSheet.options = [\n { title: options.promptLabelPhoto || 'From Photos' },\n { title: options.promptLabelPicture || 'Take Picture' },\n ];\n actionSheet.addEventListener('onSelection', async (e) => {\n const selection = e.detail;\n if (selection === 0) {\n this.fileInputExperience(options, resolve, reject);\n }\n else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n else {\n this.cameraExperience(options, resolve, reject);\n }\n });\n }\n async pickImages(_options) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n this.multipleFileInputExperience(resolve, reject);\n });\n }\n async cameraExperience(options, resolve, reject) {\n if (customElements.get('pwa-camera-modal')) {\n const cameraModal = document.createElement('pwa-camera-modal');\n cameraModal.facingMode =\n options.direction === CameraDirection.Front ? 'user' : 'environment';\n document.body.appendChild(cameraModal);\n try {\n await cameraModal.componentOnReady();\n cameraModal.addEventListener('onPhoto', async (e) => {\n const photo = e.detail;\n if (photo === null) {\n reject(new CapacitorException('User cancelled photos app'));\n }\n else if (photo instanceof Error) {\n reject(photo);\n }\n else {\n resolve(await this._getCameraPhoto(photo, options));\n }\n cameraModal.dismiss();\n document.body.removeChild(cameraModal);\n });\n cameraModal.present();\n }\n catch (e) {\n this.fileInputExperience(options, resolve, reject);\n }\n }\n else {\n console.error(`Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`);\n this.fileInputExperience(options, resolve, reject);\n }\n }\n fileInputExperience(options, resolve, reject) {\n let input = document.querySelector('#_capacitor-camera-input');\n const cleanup = () => {\n var _a;\n (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n };\n if (!input) {\n input = document.createElement('input');\n input.id = '_capacitor-camera-input';\n input.type = 'file';\n input.hidden = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e) => {\n const file = input.files[0];\n let format = 'jpeg';\n if (file.type === 'image/png') {\n format = 'png';\n }\n else if (file.type === 'image/gif') {\n format = 'gif';\n }\n if (options.resultType === 'dataUrl' ||\n options.resultType === 'base64') {\n const reader = new FileReader();\n reader.addEventListener('load', () => {\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: reader.result,\n format,\n });\n }\n else if (options.resultType === 'base64') {\n const b64 = reader.result.split(',')[1];\n resolve({\n base64String: b64,\n format,\n });\n }\n cleanup();\n });\n reader.readAsDataURL(file);\n }\n else {\n resolve({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n cleanup();\n }\n });\n input.addEventListener('cancel', (_e) => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n });\n }\n input.accept = 'image/*';\n input.capture = true;\n if (options.source === CameraSource.Photos ||\n options.source === CameraSource.Prompt) {\n input.removeAttribute('capture');\n }\n else if (options.direction === CameraDirection.Front) {\n input.capture = 'user';\n }\n else if (options.direction === CameraDirection.Rear) {\n input.capture = 'environment';\n }\n input.click();\n }\n multipleFileInputExperience(resolve, reject) {\n let input = document.querySelector('#_capacitor-camera-input-multiple');\n const cleanup = () => {\n var _a;\n (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n };\n if (!input) {\n input = document.createElement('input');\n input.id = '_capacitor-camera-input-multiple';\n input.type = 'file';\n input.hidden = true;\n input.multiple = true;\n document.body.appendChild(input);\n input.addEventListener('change', (_e) => {\n const photos = [];\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < input.files.length; i++) {\n const file = input.files[i];\n let format = 'jpeg';\n if (file.type === 'image/png') {\n format = 'png';\n }\n else if (file.type === 'image/gif') {\n format = 'gif';\n }\n photos.push({\n webPath: URL.createObjectURL(file),\n format: format,\n });\n }\n resolve({ photos });\n cleanup();\n });\n input.addEventListener('cancel', (_e) => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n });\n }\n input.accept = 'image/*';\n input.click();\n }\n _getCameraPhoto(photo, options) {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n const format = photo.type.split('/')[1];\n if (options.resultType === 'uri') {\n resolve({\n webPath: URL.createObjectURL(photo),\n format: format,\n saved: false,\n });\n }\n else {\n reader.readAsDataURL(photo);\n reader.onloadend = () => {\n const r = reader.result;\n if (options.resultType === 'dataUrl') {\n resolve({\n dataUrl: r,\n format: format,\n saved: false,\n });\n }\n else {\n resolve({\n base64String: r.split(',')[1],\n format: format,\n saved: false,\n });\n }\n };\n reader.onerror = e => {\n reject(e);\n };\n }\n });\n }\n async checkPermissions() {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n try {\n // https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query\n // the specific permissions that are supported varies among browsers that implement the\n // permissions API, so we need a try/catch in case 'camera' is invalid\n const permission = await window.navigator.permissions.query({\n name: 'camera',\n });\n return {\n camera: permission.state,\n photos: 'granted',\n };\n }\n catch (_a) {\n throw this.unavailable('Camera permissions are not available in this browser');\n }\n }\n async requestPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n async pickLimitedLibraryPhotos() {\n throw this.unavailable('Not implemented on web.');\n }\n async getLimitedLibraryPhotos() {\n throw this.unavailable('Not implemented on web.');\n }\n}\nconst Camera = new CameraWeb();\nexport { Camera };\n//# sourceMappingURL=web.js.map"],"names":["CameraSource","CameraDirection","CameraResultType","Camera","registerPlugin","WebPlugin","CapacitorException"],"mappings":";;;AAAWA,kCAAa;IACxB,CAAC,UAAU,YAAY,EAAE;IACzB;IACA;IACA;IACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;IACtC;IACA;IACA;IACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;IACtC;IACA;IACA;IACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;IACtC,CAAC,EAAEA,oBAAY,KAAKA,oBAAY,GAAG,EAAE,CAAC,CAAC,CAAC;AAC7BC,qCAAgB;IAC3B,CAAC,UAAU,eAAe,EAAE;IAC5B,IAAI,eAAe,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IACrC,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACvC,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC,CAAC;AACnCC,sCAAiB;IAC5B,CAAC,UAAU,gBAAgB,EAAE;IAC7B,IAAI,gBAAgB,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IACpC,IAAI,gBAAgB,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;IAC1C,IAAI,gBAAgB,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IAC5C,CAAC,EAAEA,wBAAgB,KAAKA,wBAAgB,GAAG,EAAE,CAAC,CAAC;;ACxB1C,UAACC,QAAM,GAAGC,mBAAc,CAAC,QAAQ,EAAE;IACxC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;IAC3D,CAAC;;ICDM,MAAM,SAAS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AAC,CAAC;IACf,YAAY,OAAO;IACnB,gBAAgB,MAAM,EAAE,UAAU,CAAC,KAAK;IACxC,gBAAgB,MAAM,EAAE,SAAS;IACjC,aAAa,CAAC;IACd,SAAS;IACT,QAAQ,OAAO,EAAE,EAAE;IACnB,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,sDAAsD,CAAC,CAAC;IAC3F,SAAS;IACT,KAAK;IACL,IAAI,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL,IAAI,MAAM,wBAAwB,GAAG;IACrC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IAC1D,KAAK;IACL,IAAI,MAAM,uBAAuB,GAAG;IACpC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IAC1D,KAAK;IACL,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE;;;;;;;;;;;;;;;;;;"}
@@ -4,7 +4,17 @@ import Photos
4
4
  import PhotosUI
5
5
 
6
6
  @objc(CAPCameraPlugin)
7
- public class CameraPlugin: CAPPlugin {
7
+ public class CameraPlugin: CAPPlugin, CAPBridgedPlugin {
8
+ public let identifier = "CAPCameraPlugin"
9
+ public let jsName = "Camera"
10
+ public let pluginMethods: [CAPPluginMethod] = [
11
+ CAPPluginMethod(name: "getPhoto", returnType: CAPPluginReturnPromise),
12
+ CAPPluginMethod(name: "pickImages", returnType: CAPPluginReturnPromise),
13
+ CAPPluginMethod(name: "checkPermissions", returnType: CAPPluginReturnPromise),
14
+ CAPPluginMethod(name: "requestPermissions", returnType: CAPPluginReturnPromise),
15
+ CAPPluginMethod(name: "pickLimitedLibraryPhotos", returnType: CAPPluginReturnPromise),
16
+ CAPPluginMethod(name: "getLimitedLibraryPhotos", returnType: CAPPluginReturnPromise)
17
+ ]
8
18
  private var call: CAPPluginCall?
9
19
  private var settings = CameraSettings()
10
20
  private let defaultSource = CameraSource.prompt
@@ -0,0 +1,12 @@
1
+ import XCTest
2
+ @testable import CameraPlugin
3
+
4
+ final class CameraPluginTests: XCTestCase {
5
+ func testExample() throws {
6
+ // XCTest Documentation
7
+ // https://developer.apple.com/documentation/xctest
8
+
9
+ // Defining Test Cases and Test Methods
10
+ // https://developer.apple.com/documentation/xctest/defining_test_cases_and_test_methods
11
+ }
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/camera",
3
- "version": "6.0.0-alpha.2",
3
+ "version": "6.0.0-beta.1",
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",
@@ -10,7 +10,9 @@
10
10
  "android/src/main/",
11
11
  "android/build.gradle",
12
12
  "dist/",
13
- "ios/Plugin/",
13
+ "ios/Sources",
14
+ "ios/Tests",
15
+ "Package.swift",
14
16
  "CapacitorCamera.podspec"
15
17
  ],
16
18
  "author": "Ionic <hi@ionicframework.com>",
@@ -29,7 +31,7 @@
29
31
  ],
30
32
  "scripts": {
31
33
  "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
32
- "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..",
34
+ "verify:ios": "xcodebuild build -scheme CapacitorCamera -sdk iphonesimulator17.0 -destination 'OS=17.0,name=iPhone 15'",
33
35
  "verify:android": "cd android && ./gradlew clean build test && cd ..",
34
36
  "verify:web": "npm run build",
35
37
  "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
@@ -79,5 +81,5 @@
79
81
  "publishConfig": {
80
82
  "access": "public"
81
83
  },
82
- "gitHead": "af95940154b4286542e776f348c58faccbf16803"
84
+ "gitHead": "30b23b6d07dda00b8f9b7ae0002036e2792943b4"
83
85
  }
@@ -1,10 +0,0 @@
1
- #import <UIKit/UIKit.h>
2
-
3
- //! Project version number for Plugin.
4
- FOUNDATION_EXPORT double PluginVersionNumber;
5
-
6
- //! Project version string for Plugin.
7
- FOUNDATION_EXPORT const unsigned char PluginVersionString[];
8
-
9
- // In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
10
-
@@ -1,11 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
- #import <Capacitor/Capacitor.h>
3
-
4
- CAP_PLUGIN(CAPCameraPlugin, "Camera",
5
- CAP_PLUGIN_METHOD(getPhoto, CAPPluginReturnPromise);
6
- CAP_PLUGIN_METHOD(pickImages, CAPPluginReturnPromise);
7
- CAP_PLUGIN_METHOD(checkPermissions, CAPPluginReturnPromise);
8
- CAP_PLUGIN_METHOD(requestPermissions, CAPPluginReturnPromise);
9
- CAP_PLUGIN_METHOD(pickLimitedLibraryPhotos, CAPPluginReturnPromise);
10
- CAP_PLUGIN_METHOD(getLimitedLibraryPhotos, CAPPluginReturnPromise);
11
- )
@@ -1,24 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>CFBundleDevelopmentRegion</key>
6
- <string>$(DEVELOPMENT_LANGUAGE)</string>
7
- <key>CFBundleExecutable</key>
8
- <string>$(EXECUTABLE_NAME)</string>
9
- <key>CFBundleIdentifier</key>
10
- <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
- <key>CFBundleInfoDictionaryVersion</key>
12
- <string>6.0</string>
13
- <key>CFBundleName</key>
14
- <string>$(PRODUCT_NAME)</string>
15
- <key>CFBundlePackageType</key>
16
- <string>FMWK</string>
17
- <key>CFBundleShortVersionString</key>
18
- <string>1.0</string>
19
- <key>CFBundleVersion</key>
20
- <string>$(CURRENT_PROJECT_VERSION)</string>
21
- <key>NSPrincipalClass</key>
22
- <string></string>
23
- </dict>
24
- </plist>