@capacitor/camera 8.1.0-test.250320251731 → 8.1.0
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/CapacitorCamera.podspec +3 -2
- package/Package.swift +4 -2
- package/README.md +419 -67
- package/android/build.gradle +4 -4
- package/android/src/main/AndroidManifest.xml +6 -0
- package/android/src/main/java/com/capacitorjs/plugins/camera/CameraPlugin.kt +3 -2
- package/android/src/main/java/com/capacitorjs/plugins/camera/IonCameraFlow.kt +111 -70
- package/android/src/main/java/com/capacitorjs/plugins/camera/IonCameraSettings.kt +1 -2
- package/android/src/main/java/com/capacitorjs/plugins/camera/IonEditableMode.kt +16 -0
- package/android/src/main/java/com/capacitorjs/plugins/camera/IonGallerySettings.kt +1 -2
- package/dist/docs.json +18 -50
- package/dist/esm/definitions.d.ts +22 -37
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +13 -2
- package/dist/esm/web.js +280 -39
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +279 -38
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +279 -38
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CameraPlugin/CameraPlugin.swift +193 -9
- package/package.json +10 -5
- package/android/libs/IONCameraLib-debug.aar +0 -0
- package/android/src/main/java/com/capacitorjs/plugins/camera/IonVideoSettings.kt +0 -7
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/web.js","esm/index.js"],"sourcesContent":["/**\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 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 = {}));\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 var CameraResultType;\n(function (CameraResultType) {\n CameraResultType[\"Uri\"] = \"uri\";\n CameraResultType[\"Base64\"] = \"base64\";\n CameraResultType[\"DataUrl\"] = \"dataUrl\";\n})(CameraResultType || (CameraResultType = {}));\nexport var MediaType;\n(function (MediaType) {\n MediaType[MediaType[\"Photo\"] = 0] = \"Photo\";\n MediaType[MediaType[\"Video\"] = 1] = \"Video\";\n})(MediaType || (MediaType = {}));\nexport var MediaTypeSelection;\n(function (MediaTypeSelection) {\n MediaTypeSelection[MediaTypeSelection[\"Photo\"] = 0] = \"Photo\";\n MediaTypeSelection[MediaTypeSelection[\"Video\"] = 1] = \"Video\";\n MediaTypeSelection[MediaTypeSelection[\"All\"] = 2] = \"All\";\n})(MediaTypeSelection || (MediaTypeSelection = {}));\nexport var EncodingType;\n(function (EncodingType) {\n EncodingType[EncodingType[\"JPEG\"] = 0] = \"JPEG\";\n EncodingType[EncodingType[\"PNG\"] = 1] = \"PNG\";\n})(EncodingType || (EncodingType = {}));\n//# sourceMappingURL=definitions.js.map","import { WebPlugin, CapacitorException } from '@capacitor/core';\nimport { CameraSource, CameraDirection } from './definitions';\nexport class CameraWeb extends WebPlugin {\n async takePhoto(_options) {\n throw this.unimplemented('takePhoto is not implemented on Web.');\n }\n async recordVideo(_options) {\n throw this.unimplemented('recordVideo is not implemented on Web.');\n }\n async playVideo(_options) {\n throw this.unimplemented('playVideo is not implemented on Web.');\n }\n async chooseFromGallery(_options) {\n throw this.unimplemented('chooseFromGallery is not implemented on web.');\n }\n async editPhoto(_options) {\n throw this.unimplemented('editPhoto is not implemented on Web.');\n }\n async editURIPhoto(_options) {\n throw this.unimplemented('editURIPhoto is not implemented on Web.');\n }\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 = 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' || 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 || 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","import { registerPlugin } from '@capacitor/core';\nimport { CameraWeb } from './web';\nconst Camera = registerPlugin('Camera', {\n web: () => new CameraWeb(),\n});\nexport * from './definitions';\nexport { Camera };\n//# sourceMappingURL=index.js.map"],"names":["CameraSource","CameraDirection","CameraResultType","MediaType","MediaTypeSelection","EncodingType","WebPlugin","CapacitorException","registerPlugin"],"mappings":";;;IAAA;IACA;IACA;IACA;AACWA;IACX,CAAC,UAAU,YAAY,EAAE;IACzB;IACA;IACA;IACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ;IACrC;IACA;IACA;IACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ;IACrC;IACA;IACA;IACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ;IACrC,CAAC,EAAEA,oBAAY,KAAKA,oBAAY,GAAG,EAAE,CAAC,CAAC;AAC5BC;IACX,CAAC,UAAU,eAAe,EAAE;IAC5B,IAAI,eAAe,CAAC,MAAM,CAAC,GAAG,MAAM;IACpC,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO;IACtC,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC;IAC7C;IACA;IACA;IACA;AACWC;IACX,CAAC,UAAU,gBAAgB,EAAE;IAC7B,IAAI,gBAAgB,CAAC,KAAK,CAAC,GAAG,KAAK;IACnC,IAAI,gBAAgB,CAAC,QAAQ,CAAC,GAAG,QAAQ;IACzC,IAAI,gBAAgB,CAAC,SAAS,CAAC,GAAG,SAAS;IAC3C,CAAC,EAAEA,wBAAgB,KAAKA,wBAAgB,GAAG,EAAE,CAAC,CAAC;AACpCC;IACX,CAAC,UAAU,SAAS,EAAE;IACtB,IAAI,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO;IAC/C,IAAI,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO;IAC/C,CAAC,EAAEA,iBAAS,KAAKA,iBAAS,GAAG,EAAE,CAAC,CAAC;AACtBC;IACX,CAAC,UAAU,kBAAkB,EAAE;IAC/B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GAAG;IACpC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC;IACzD,IAAI;IACJ;IACe,IAAI,SAAS;;ACxQvB,UAAC,MAAM,GAAGC,mBAAc,CAAC,QAAQ,EAAE;IACxC,IAAI,GAAG,EAAE,MAAM,IAAI,SAAS,EAAE;IAC9B,CAAC;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/web.js","esm/index.js"],"sourcesContent":["/**\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 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 = {}));\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 var CameraResultType;\n(function (CameraResultType) {\n CameraResultType[\"Uri\"] = \"uri\";\n CameraResultType[\"Base64\"] = \"base64\";\n CameraResultType[\"DataUrl\"] = \"dataUrl\";\n})(CameraResultType || (CameraResultType = {}));\nexport var MediaType;\n(function (MediaType) {\n MediaType[MediaType[\"Photo\"] = 0] = \"Photo\";\n MediaType[MediaType[\"Video\"] = 1] = \"Video\";\n})(MediaType || (MediaType = {}));\nexport var MediaTypeSelection;\n(function (MediaTypeSelection) {\n MediaTypeSelection[MediaTypeSelection[\"Photo\"] = 0] = \"Photo\";\n MediaTypeSelection[MediaTypeSelection[\"Video\"] = 1] = \"Video\";\n MediaTypeSelection[MediaTypeSelection[\"All\"] = 2] = \"All\";\n})(MediaTypeSelection || (MediaTypeSelection = {}));\nexport var EncodingType;\n(function (EncodingType) {\n EncodingType[EncodingType[\"JPEG\"] = 0] = \"JPEG\";\n EncodingType[EncodingType[\"PNG\"] = 1] = \"PNG\";\n})(EncodingType || (EncodingType = {}));\n//# sourceMappingURL=definitions.js.map","import { WebPlugin, CapacitorException } from '@capacitor/core';\nimport { CameraSource, CameraDirection, MediaType, MediaTypeSelection } from './definitions';\nexport class CameraWeb extends WebPlugin {\n async takePhoto(options) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n if (options.webUseInput) {\n this.takePhotoCameraInputExperience(options, resolve, reject);\n }\n else {\n this.takePhotoCameraExperience(options, resolve, reject);\n }\n });\n }\n async recordVideo(_options) {\n throw this.unimplemented('recordVideo is not implemented on Web.');\n }\n async playVideo(_options) {\n throw this.unimplemented('playVideo is not implemented on Web.');\n }\n async chooseFromGallery(options) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n this.galleryInputExperience(options, resolve, reject);\n });\n }\n async editPhoto(_options) {\n throw this.unimplemented('editPhoto is not implemented on Web.');\n }\n async editURIPhoto(_options) {\n throw this.unimplemented('editURIPhoto is not implemented on Web.');\n }\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 await this._setupPWACameraModal(options.direction, (photo) => this._getCameraPhoto(photo, options), () => this.fileInputExperience(options, resolve, reject), resolve, reject);\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' || 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 || 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 = this._getFileFormat(photo);\n if (options.resultType === 'uri') {\n resolve({\n webPath: URL.createObjectURL(photo),\n 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,\n saved: false,\n });\n }\n else {\n resolve({\n base64String: r.split(',')[1],\n format,\n saved: false,\n });\n }\n };\n reader.onerror = (e) => {\n reject(e);\n };\n }\n });\n }\n async takePhotoCameraExperience(options, resolve, reject) {\n await this._setupPWACameraModal(options.cameraDirection, (photo) => { var _a; return this._buildPhotoMediaResult(photo, (_a = options.includeMetadata) !== null && _a !== void 0 ? _a : false); }, () => this.takePhotoCameraInputExperience(options, resolve, reject), resolve, reject);\n }\n takePhotoCameraInputExperience(options, resolve, reject) {\n const input = this._createFileInput('_capacitor-camera-input-takephoto');\n const cleanup = () => {\n var _a;\n (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n };\n input.onchange = async (_e) => {\n var _a;\n if (!this._validateFileInput(input, reject, cleanup)) {\n return;\n }\n const file = input.files[0];\n resolve(await this._buildPhotoMediaResult(file, (_a = options.includeMetadata) !== null && _a !== void 0 ? _a : false));\n cleanup();\n };\n input.oncancel = () => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n };\n input.accept = 'image/*';\n if (options.cameraDirection === CameraDirection.Front) {\n input.capture = 'user';\n }\n else {\n // CameraDirection.Rear\n input.capture = 'environment';\n }\n input.click();\n }\n galleryInputExperience(options, resolve, reject) {\n var _a, _b;\n const input = this._createFileInput('_capacitor-camera-input-gallery');\n input.multiple = (_a = options.allowMultipleSelection) !== null && _a !== void 0 ? _a : false;\n const cleanup = () => {\n var _a;\n (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n };\n input.onchange = async (_e) => {\n var _a;\n if (!this._validateFileInput(input, reject, cleanup)) {\n return;\n }\n const results = [];\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 if (file.type.startsWith('image/')) {\n results.push(await this._buildPhotoMediaResult(file, (_a = options.includeMetadata) !== null && _a !== void 0 ? _a : false));\n }\n else if (file.type.startsWith('video/')) {\n const format = this._getFileFormat(file);\n let thumbnail;\n let resolution;\n let duration;\n try {\n const videoInfo = await this._getVideoMetadata(file);\n thumbnail = videoInfo.thumbnail;\n if (options.includeMetadata) {\n resolution = videoInfo.resolution;\n duration = videoInfo.duration;\n }\n }\n catch (e) {\n console.warn('Failed to get video metadata:', e);\n }\n const result = {\n type: MediaType.Video,\n thumbnail,\n webPath: URL.createObjectURL(file),\n saved: false,\n };\n if (options.includeMetadata) {\n result.metadata = {\n format,\n resolution,\n size: file.size,\n creationDate: new Date(file.lastModified).toISOString(),\n duration,\n };\n }\n results.push(result);\n }\n }\n resolve({ results });\n cleanup();\n };\n input.oncancel = () => {\n reject(new CapacitorException('User cancelled photos app'));\n cleanup();\n };\n // Set accept attribute based on mediaType\n const mediaType = (_b = options.mediaType) !== null && _b !== void 0 ? _b : MediaTypeSelection.Photo;\n if (mediaType === MediaTypeSelection.Photo) {\n input.accept = 'image/*';\n }\n else if (mediaType === MediaTypeSelection.Video) {\n input.accept = 'video/*';\n }\n else {\n // MediaTypeSelection.All\n input.accept = 'image/*,video/*';\n }\n input.click();\n }\n _getFileFormat(file) {\n if (file.type === 'image/png') {\n return 'png';\n }\n else if (file.type === 'image/gif') {\n return 'gif';\n }\n else if (file.type.startsWith('video/')) {\n return file.type.split('/')[1];\n }\n else if (file.type.startsWith('image/')) {\n return 'jpeg';\n }\n return file.type.split('/')[1] || 'jpeg';\n }\n async _buildPhotoMediaResult(file, includeMetadata) {\n const format = this._getFileFormat(file);\n const thumbnail = await this._getBase64FromFile(file);\n const result = {\n type: MediaType.Photo,\n thumbnail,\n webPath: URL.createObjectURL(file),\n saved: false,\n };\n if (includeMetadata) {\n const resolution = await this._getImageResolution(file);\n result.metadata = {\n format,\n resolution,\n size: file.size,\n creationDate: 'lastModified' in file ? new Date(file.lastModified).toISOString() : new Date().toISOString(),\n };\n }\n return result;\n }\n _validateFileInput(input, reject, cleanup) {\n if (!input.files || input.files.length === 0) {\n const message = input.multiple ? 'No files selected' : 'No file selected';\n reject(new CapacitorException(message));\n cleanup();\n return false;\n }\n return true;\n }\n async _setupPWACameraModal(cameraDirection, onPhotoCallback, fallbackCallback, resolve, reject) {\n if (customElements.get('pwa-camera-modal')) {\n const cameraModal = document.createElement('pwa-camera-modal');\n cameraModal.facingMode = cameraDirection === 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 onPhotoCallback(photo));\n }\n cameraModal.dismiss();\n document.body.removeChild(cameraModal);\n });\n cameraModal.present();\n }\n catch (e) {\n fallbackCallback();\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 fallbackCallback();\n }\n }\n _createFileInput(id) {\n let input = document.querySelector(`#${id}`);\n if (!input) {\n input = document.createElement('input');\n input.id = id;\n input.type = 'file';\n input.hidden = true;\n document.body.appendChild(input);\n }\n return input;\n }\n async _getImageResolution(image) {\n try {\n const bitmap = await createImageBitmap(image);\n const resolution = `${bitmap.width}x${bitmap.height}`;\n bitmap.close();\n return resolution;\n }\n catch (e) {\n console.warn('Failed to get image resolution:', e);\n return undefined;\n }\n }\n _getBase64FromFile(file) {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onloadend = () => {\n const dataUrl = reader.result;\n const base64 = dataUrl.split(',')[1];\n resolve(base64);\n };\n reader.onerror = (e) => {\n reject(e);\n };\n reader.readAsDataURL(file);\n });\n }\n _getVideoMetadata(videoFile) {\n return new Promise((resolve) => {\n const video = document.createElement('video');\n video.preload = 'metadata';\n video.muted = true;\n video.onloadedmetadata = () => {\n // Seek to 1 second or 10% of duration to capture thumbnail\n const seekTime = Math.min(1, video.duration * 0.1);\n video.currentTime = seekTime;\n };\n video.onseeked = () => {\n const result = {\n resolution: `${video.videoWidth}x${video.videoHeight}`,\n duration: video.duration,\n };\n try {\n const canvas = document.createElement('canvas');\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n const ctx = canvas.getContext('2d');\n if (ctx) {\n ctx.drawImage(video, 0, 0, canvas.width, canvas.height);\n result.thumbnail = canvas.toDataURL('image/jpeg', 0.8).split(',')[1];\n }\n }\n catch (e) {\n console.warn('Failed to generate video thumbnail:', e);\n }\n URL.revokeObjectURL(video.src);\n resolve(result);\n };\n video.onerror = () => {\n // Clean up and return defaults\n URL.revokeObjectURL(video.src);\n resolve({});\n };\n video.src = URL.createObjectURL(videoFile);\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","import { registerPlugin } from '@capacitor/core';\nimport { CameraWeb } from './web';\nconst Camera = registerPlugin('Camera', {\n web: () => new CameraWeb(),\n});\nexport * from './definitions';\nexport { Camera };\n//# sourceMappingURL=index.js.map"],"names":["CameraSource","CameraDirection","CameraResultType","MediaType","MediaTypeSelection","EncodingType","WebPlugin","CapacitorException","registerPlugin"],"mappings":";;;IAAA;IACA;IACA;IACA;AACWA;IACX,CAAC,UAAU,YAAY,EAAE;IACzB;IACA;IACA;IACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ;IACrC;IACA;IACA;IACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ;IACrC;IACA;IACA;IACA,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ;IACrC,CAAC,EAAEA,oBAAY,KAAKA,oBAAY,GAAG,EAAE,CAAC,CAAC;AAC5BC;IACX,CAAC,UAAU,eAAe,EAAE;IAC5B,IAAI,eAAe,CAAC,MAAM,CAAC,GAAG,MAAM;IACpC,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO;IACtC,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC;IAC7C;IACA;IACA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,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,wBAAwB,GAAG;IACrC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC;IACzD,IAAI;IACJ,IAAI,MAAM,uBAAuB,GAAG;IACpC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC;IACzD,IAAI;IACJ;IACe,IAAI,SAAS;;ACzfvB,UAAC,MAAM,GAAGC,mBAAc,CAAC,QAAQ,EAAE;IACxC,IAAI,GAAG,EAAE,MAAM,IAAI,SAAS,EAAE;IAC9B,CAAC;;;;;;;;;;"}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import Foundation
|
|
2
|
+
import IONCameraLib
|
|
2
3
|
import Capacitor
|
|
3
4
|
import Photos
|
|
4
5
|
import PhotosUI
|
|
6
|
+
import ImageIO
|
|
5
7
|
|
|
6
8
|
@objc(CAPCameraPlugin)
|
|
7
9
|
public class CameraPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
8
10
|
public let identifier = "CAPCameraPlugin"
|
|
9
11
|
public let jsName = "Camera"
|
|
10
12
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
13
|
+
CAPPluginMethod(name: "takePhoto", returnType: CAPPluginReturnPromise),
|
|
14
|
+
CAPPluginMethod(name: "chooseFromGallery", returnType: CAPPluginReturnPromise),
|
|
15
|
+
CAPPluginMethod(name: "editURIPhoto", returnType: CAPPluginReturnPromise),
|
|
16
|
+
CAPPluginMethod(name: "editPhoto", returnType: CAPPluginReturnPromise),
|
|
17
|
+
CAPPluginMethod(name: "recordVideo", returnType: CAPPluginReturnPromise),
|
|
18
|
+
CAPPluginMethod(name: "playVideo", returnType: CAPPluginReturnPromise),
|
|
11
19
|
CAPPluginMethod(name: "getPhoto", returnType: CAPPluginReturnPromise),
|
|
12
20
|
CAPPluginMethod(name: "pickImages", returnType: CAPPluginReturnPromise),
|
|
13
21
|
CAPPluginMethod(name: "checkPermissions", returnType: CAPPluginReturnPromise),
|
|
@@ -21,7 +29,104 @@ public class CameraPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
21
29
|
private let defaultDirection = CameraDirection.rear
|
|
22
30
|
private var multiple = false
|
|
23
31
|
|
|
32
|
+
private lazy var cameraManager = IONCAMRFactory.createCameraManagerWrapper(withDelegate: self, and: self.bridge?.viewController ?? UIViewController())
|
|
33
|
+
private lazy var galleryManager = IONCAMRFactory.createGalleryManagerWrapper(withDelegate: self, and: self.bridge?.viewController ?? UIViewController())
|
|
34
|
+
private lazy var editManager = IONCAMRFactory.createEditManagerWrapper(withDelegate: self, and: self.bridge?.viewController ?? UIViewController())
|
|
35
|
+
private lazy var videoManager = IONCAMRFactory.createVideoManagerWrapper(withDelegate: self, and: self.bridge?.viewController ?? UIViewController())
|
|
36
|
+
|
|
24
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
|
+
}
|
|
55
|
+
|
|
56
|
+
private func decodeParameters<T: Decodable>(from call: CAPPluginCall) -> T? {
|
|
57
|
+
guard let dict = call.options as? [String: Any],
|
|
58
|
+
let data = try? JSONSerialization.data(withJSONObject: dict)
|
|
59
|
+
else { return nil }
|
|
60
|
+
return try? JSONDecoder().decode(T.self, from: data)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private func sendError(_ error: IONCAMRError) {
|
|
64
|
+
DispatchQueue.main.async {
|
|
65
|
+
self.call?.reject(error.localizedDescription, "OS-PLUG-CAMR-" + String(format: "%04d", error.errorCode))
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private func handleCall<T: Decodable>(_ call: CAPPluginCall, error: IONCAMRError, action: @escaping (T) -> Void) {
|
|
70
|
+
self.call = call
|
|
71
|
+
guard let options: T = decodeParameters(from: call) else {
|
|
72
|
+
sendError(error)
|
|
73
|
+
return
|
|
74
|
+
}
|
|
75
|
+
DispatchQueue.main.async {
|
|
76
|
+
action(options)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@objc func takePhoto(_ call: CAPPluginCall) {
|
|
81
|
+
handleCall(call, error: .takePictureArguments) { (options: IONCAMRTakePhotoOptions) in
|
|
82
|
+
self.cameraManager.takePhoto(with: options)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@objc func chooseFromGallery(_ call: CAPPluginCall) {
|
|
87
|
+
handleCall(call, error: .chooseMultimediaIssue) { (options: IONCAMRGalleryOptions) in
|
|
88
|
+
self.galleryManager.chooseFromGallery(with: options)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@objc func editURIPhoto(_ call: CAPPluginCall) {
|
|
93
|
+
handleCall(call, error: .editPictureIssue) { (options: IONCAMRPhotoEditOptions) in
|
|
94
|
+
self.editManager.editPhoto(with: options)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@objc func editPhoto(_ call: CAPPluginCall) {
|
|
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)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@objc func recordVideo(_ call: CAPPluginCall) {
|
|
111
|
+
handleCall(call, error: .captureVideoIssue) { (options: IONCAMRRecordVideoOptions) in
|
|
112
|
+
self.cameraManager.recordVideo(with: options)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@objc func playVideo(_ call: CAPPluginCall) {
|
|
117
|
+
handleCall(call, error: .playVideoIssue) { (options: IONCAMRPlayVideoOptions) in
|
|
118
|
+
Task {
|
|
119
|
+
do {
|
|
120
|
+
try await self.videoManager.playVideo(options.url)
|
|
121
|
+
call.resolve()
|
|
122
|
+
} catch let error as IONCAMRError {
|
|
123
|
+
self.callback(error: error)
|
|
124
|
+
} catch {
|
|
125
|
+
self.callback(error: .playVideoIssue)
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
25
130
|
|
|
26
131
|
@objc override public func checkPermissions(_ call: CAPPluginCall) {
|
|
27
132
|
var result: [String: Any] = [:]
|
|
@@ -126,6 +231,7 @@ public class CameraPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
126
231
|
}
|
|
127
232
|
}
|
|
128
233
|
|
|
234
|
+
@available(*, deprecated, message: "Use takePhoto or chooseFromGallery instead")
|
|
129
235
|
@objc func getPhoto(_ call: CAPPluginCall) {
|
|
130
236
|
self.multiple = false
|
|
131
237
|
self.call = call
|
|
@@ -150,15 +256,6 @@ public class CameraPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
150
256
|
}
|
|
151
257
|
}
|
|
152
258
|
|
|
153
|
-
@objc func pickImages(_ call: CAPPluginCall) {
|
|
154
|
-
self.multiple = true
|
|
155
|
-
self.call = call
|
|
156
|
-
self.settings = cameraSettings(from: call)
|
|
157
|
-
DispatchQueue.main.async {
|
|
158
|
-
self.showPhotos()
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
259
|
private func checkUsageDescriptions() -> String? {
|
|
163
260
|
if let dict = Bundle.main.infoDictionary {
|
|
164
261
|
for key in CameraPropertyListKeys.allCases where dict[key.rawValue] == nil {
|
|
@@ -168,6 +265,16 @@ public class CameraPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
168
265
|
return nil
|
|
169
266
|
}
|
|
170
267
|
|
|
268
|
+
@available(*, deprecated, message: "Use chooseFromGallery instead")
|
|
269
|
+
@objc func pickImages(_ call: CAPPluginCall) {
|
|
270
|
+
self.multiple = true
|
|
271
|
+
self.call = call
|
|
272
|
+
self.settings = cameraSettings(from: call)
|
|
273
|
+
DispatchQueue.main.async {
|
|
274
|
+
self.showPhotos()
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
171
278
|
private func cameraSettings(from call: CAPPluginCall) -> CameraSettings {
|
|
172
279
|
var settings = CameraSettings()
|
|
173
280
|
settings.jpegQuality = min(abs(CGFloat(call.getFloat("quality") ?? 100.0)) / 100.0, 1.0)
|
|
@@ -551,3 +658,80 @@ private extension CameraPlugin {
|
|
|
551
658
|
return result
|
|
552
659
|
}
|
|
553
660
|
}
|
|
661
|
+
|
|
662
|
+
extension CameraPlugin: IONCAMRCallbackDelegate {
|
|
663
|
+
|
|
664
|
+
public func callback(error: IONCAMRError) {
|
|
665
|
+
sendError(error)
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
public func callback(result: IONCAMRMediaResult) {
|
|
669
|
+
resolve(result)
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
public func callback(result: [IONCAMRMediaResult]) {
|
|
673
|
+
resolve(["results": result])
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
private func resolve<T: Encodable>(_ value: T) {
|
|
677
|
+
do {
|
|
678
|
+
let encoder = JSONEncoder()
|
|
679
|
+
encoder.dateEncodingStrategy = .iso8601
|
|
680
|
+
let data = try encoder.encode(value)
|
|
681
|
+
var json = try JSONSerialization.jsonObject(with: data)
|
|
682
|
+
|
|
683
|
+
if var dict = json as? [String: Any] {
|
|
684
|
+
if dict["uri"] != nil {
|
|
685
|
+
dict = resolveMediaResult(dict)
|
|
686
|
+
} else if let results = dict["results"] as? [[String: Any]] {
|
|
687
|
+
dict["results"] = results.map(resolveMediaResult)
|
|
688
|
+
}
|
|
689
|
+
json = dict
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
DispatchQueue.main.async {
|
|
693
|
+
self.call?.resolve(json as? [String: Any] ?? [:])
|
|
694
|
+
}
|
|
695
|
+
} catch {
|
|
696
|
+
sendError(.invalidEncodeResultMedia)
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
private func resolveMediaResult(_ item: [String: Any]) -> [String: Any] {
|
|
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
|
+
}
|
|
707
|
+
var result = item
|
|
708
|
+
result["webPath"] = resolveWebPath(from: uri)
|
|
709
|
+
if var metadata = result["metadata"] as? [String: Any] {
|
|
710
|
+
metadata["exif"] = resolveExif(from: uri)
|
|
711
|
+
result["metadata"] = metadata
|
|
712
|
+
}
|
|
713
|
+
return result
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
private func resolveWebPath(from uri: String) -> String? {
|
|
717
|
+
guard !uri.isEmpty,
|
|
718
|
+
let fileURL = URL(string: uri),
|
|
719
|
+
let webURL = bridge?.portablePath(fromLocalURL: fileURL) else {
|
|
720
|
+
return nil
|
|
721
|
+
}
|
|
722
|
+
return webURL.absoluteString
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
private func resolveExif(from uri: String) -> [String: Any]? {
|
|
726
|
+
guard !uri.isEmpty,
|
|
727
|
+
let fileURL = URL(string: uri),
|
|
728
|
+
let imageSource = CGImageSourceCreateWithURL(fileURL as CFURL, nil),
|
|
729
|
+
let properties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, nil) as? [String: Any] else {
|
|
730
|
+
return nil
|
|
731
|
+
}
|
|
732
|
+
var exif = properties[kCGImagePropertyExifDictionary as String] as? [String: Any] ?? [:]
|
|
733
|
+
exif["Orientation"] = properties[kCGImagePropertyOrientation as String]
|
|
734
|
+
exif["GPS"] = properties[kCGImagePropertyGPSDictionary as String]
|
|
735
|
+
return exif.isEmpty ? nil : exif
|
|
736
|
+
}
|
|
737
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/camera",
|
|
3
|
-
"version": "8.1.0
|
|
3
|
+
"version": "8.1.0",
|
|
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",
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"android/src/main/",
|
|
11
11
|
"android/build.gradle",
|
|
12
|
-
"android/libs/",
|
|
13
12
|
"dist/",
|
|
14
13
|
"ios/Sources",
|
|
15
14
|
"ios/Tests",
|
|
@@ -20,10 +19,10 @@
|
|
|
20
19
|
"license": "MIT",
|
|
21
20
|
"repository": {
|
|
22
21
|
"type": "git",
|
|
23
|
-
"url": "git+https://github.com/ionic-team/capacitor-
|
|
22
|
+
"url": "git+https://github.com/ionic-team/capacitor-camera.git"
|
|
24
23
|
},
|
|
25
24
|
"bugs": {
|
|
26
|
-
"url": "https://github.com/ionic-team/capacitor-
|
|
25
|
+
"url": "https://github.com/ionic-team/capacitor-camera/issues"
|
|
27
26
|
},
|
|
28
27
|
"keywords": [
|
|
29
28
|
"capacitor",
|
|
@@ -62,7 +61,13 @@
|
|
|
62
61
|
"rimraf": "^6.1.0",
|
|
63
62
|
"rollup": "^4.53.2",
|
|
64
63
|
"swiftlint": "^2.0.0",
|
|
65
|
-
"typescript": "^5.9.3"
|
|
64
|
+
"typescript": "^5.9.3",
|
|
65
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
66
|
+
"@semantic-release/exec": "^7.1.0",
|
|
67
|
+
"@semantic-release/git": "^10.0.1",
|
|
68
|
+
"@semantic-release/github": "^12.0.2",
|
|
69
|
+
"@semantic-release/npm": "^13.1.2",
|
|
70
|
+
"semantic-release": "^25.0.2"
|
|
66
71
|
},
|
|
67
72
|
"peerDependencies": {
|
|
68
73
|
"@capacitor/core": ">=8.0.0"
|
|
Binary file
|