Files
doneit-web/.angular/cache/14.2.12/babel-webpack/0922f261869726a086ca3206f89c832e.json
T

1 line
29 KiB
JSON
Raw Normal View History

2023-06-30 09:54:21 +01:00
{"ast":null,"code":"import _asyncToGenerator from \"C:/Users/eudes.inacio/GabineteDigital/gabinete-digital-fo/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { WebPlugin, CapacitorException } from '@capacitor/core';\nimport { CameraSource, CameraDirection } from './definitions';\nexport class CameraWeb extends WebPlugin {\n getPhoto(options) {\n var _this = this;\n return _asyncToGenerator(function* () {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise( /*#__PURE__*/function () {\n var _ref = _asyncToGenerator(function* (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 = 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 }, {\n title: options.promptLabelPicture || 'Take Picture'\n }];\n actionSheet.addEventListener('onSelection', /*#__PURE__*/function () {\n var _ref2 = _asyncToGenerator(function* (e) {\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 return function (_x3) {\n return _ref2.apply(this, arguments);\n };\n }());\n } else {\n _this.cameraExperience(options, resolve, reject);\n }\n });\n return function (_x, _x2) {\n return _ref.apply(this, arguments);\n };\n }());\n })();\n }\n pickImages(_options) {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise( /*#__PURE__*/function () {\n var _ref3 = _asyncToGenerator(function* (resolve) {\n _this2.multipleFileInputExperience(resolve);\n });\n return function (_x4) {\n return _ref3.apply(this, arguments);\n };\n }());\n })();\n }\n cameraExperience(options, resolve, reject) {\n var _this3 = this;\n return _asyncToGenerator(function* () {\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 yield cameraModal.componentOnReady();\n cameraModal.addEventListener('onPhoto', /*#__PURE__*/function () {\n var _ref4 = _asyncToGenerator(function* (e) {\n const photo = e.detail;\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(yield _this3._getCameraPhoto(photo, options));\n }\n cameraModal.dismiss();\n document.body.removeChild(cameraModal);\n });\n return function (_x5) {\n return _ref4.apply(this, arguments);\n };\n }());\n cameraModal.present();\n } catch (e) {\n _this3.fileInputExperience(options, resolve);\n }\n } else {\n console.error(`Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elem