mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
1 line
43 KiB
JSON
1 line
43 KiB
JSON
|
|
{"ast":null,"code":"import _asyncToGenerator from \"C:/Users/eudes.inacio/GabineteDigital/gabinete-digital-fo/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { __decorate } from \"tslib\";\nimport __NG_CLI_RESOURCE__0 from \"./new-publication.page.html?ngResource\";\nimport __NG_CLI_RESOURCE__1 from \"./new-publication.page.scss?ngResource\";\nimport { Component } from '@angular/core';\nimport { ModalController, NavParams, Platform, LoadingController } from '@ionic/angular';\nimport { PublicationsService } from 'src/app/services/publications.service';\nimport { Publication } from 'src/app/models/publication';\nimport { Image } from 'src/app/models/image';\nimport { PhotoService } from 'src/app/services/photo.service';\n//Capacitor\nimport { ToastService } from 'src/app/services/toast.service';\nimport { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';\nimport { formatDate } from 'src/plugin/momentG.js';\nimport { ThemeService } from 'src/app/services/theme.service';\nimport { Camera, CameraResultType, CameraSource } from '@capacitor/camera';\nimport { Filesystem, Directory } from '@capacitor/filesystem';\nimport { NgxImageCompressService } from \"ngx-image-compress\";\nimport { HttpErrorHandle } from 'src/app/services/http-error-handle.service';\nconst IMAGE_DIR = 'stored-images';\nlet NewPublicationPage = class NewPublicationPage {\n constructor(modalController, photoService, navParams, publications, toastService, ThemeService, platform, loadingCtrl, imageCompress, httpErrorHandle) {\n this.modalController = modalController;\n this.photoService = photoService;\n this.navParams = navParams;\n this.publications = publications;\n this.toastService = toastService;\n this.ThemeService = ThemeService;\n this.platform = platform;\n this.loadingCtrl = loadingCtrl;\n this.imageCompress = imageCompress;\n this.httpErrorHandle = httpErrorHandle;\n this.images = [];\n this.disabled = false;\n this.showSpinners = true;\n this.showSeconds = false;\n this.touchUi = false;\n this.enableMeridian = false;\n this.minDate = new Date().toISOString().slice(0, 10);\n this.endMinDate = new Date(new Date().getTime() + 15 * 60000);\n this.stepHour = 1;\n this.stepMinute = 15;\n this.stepSecond = 5;\n this.color = 'primary';\n this.validateFrom = false;\n this.pub = new Publication();\n this.image = new Image();\n this.Defaultimage = '';\n this.capturedImage = '';\n this.photos = [];\n this.convertBlobToBase64 = blob => new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onerror = reject;\n reader.onload = () => {\n resolve(reader.result);\n };\n reader.readAsDataURL(blob);\n }).catch(error => {\n console.error(error);\n });\n this.publicationType = this.navParams.get('publicationType');\n this.folderId = this.navParams.get('folderId');\n this.publicationTitle = 'Nova Publicação';\n this.convertBlobToBase64Worker = new Worker(new URL('./convertBlobToBase64.worker.js', import.meta.url));\n }\n ngOnInit() {\n this.setTitle();\n Filesystem.mkdir({\n path: IMAGE_DIR,\n directory: Directory.Data,\n recursive: true\n });\n // this.takePicture();\n }\n\n takePicture() {\n var _this = this;\n return _asyncToGenerator(function* () {\n const capturedImage = yield Camera.getPhoto({\n quality: 50,\n // allowEditing: true,\n resultType: CameraResultType.Uri,\n source: CameraSource.Camera\n });\n const response = yield fetch(capturedImage.webPath);\n const blob = yield response.blob();\n _this.convertBlobToBase64Worker.postMessage(blob);\n _this.convertBlobToBase64Worker.onmessage = /*#__PURE__*/function () {\n var _ref = _asyncToGenerator(function* (oEvent) {\n _this.capturedImage = oEvent.data;\n });\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }();\n })();\n }\n image
|