bug on diplomas option solved

This commit is contained in:
Eudes Inácio
2023-03-15 15:03:55 +01:00
10 changed files with 52 additions and 23 deletions
+35 -8
View File
@@ -648,18 +648,20 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
const roomId = this.roomId
const image = await this.CameraService.takePicture();
await this.fileService.saveImage(image)
const lastphoto: any = await this.fileService.loadFiles();
const { capturedImage, capturedImageTitle } = await this.fileService.loadFileData(lastphoto);
const file = await Camera.getPhoto({
quality: 90,
// allowEditing: true,
resultType: CameraResultType.Base64,
source: CameraSource.Camera
});
const blob = this.dataURItoBlob('data:image/jpeg;base64,' + file.base64String)
console.log('data:image/jpeg;base64,' + file.base64String)
const base64 = await fetch(capturedImage);
const blob = await base64.blob();
const formData = new FormData();
formData.append("blobFile", blob);
console.log(capturedImage);
// console.log('capturedImage', capturedImage);
this.ChatSystemService.getDmRoom(roomId).send({
file: {
@@ -667,13 +669,38 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
"guid": ''
},
attachments: [{
"title": capturedImageTitle,
"title": "file.jpg",
"text": "description",
"title_link_download": false,
}],
temporaryData: formData
})
}
dataURItoBlob(dataURI) {
// convert base64 to raw binary data held in a string
// doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this
var byteString = atob(dataURI.split(',')[1]);
// separate out the mime component
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]
// write the bytes of the string to an ArrayBuffer
var ab = new ArrayBuffer(byteString.length);
// create a view into the buffer
var ia = new Uint8Array(ab);
// set the bytes of the buffer to the correct values
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
// write the ArrayBuffer to a blob, and you're done
var blob = new Blob([ab], {type: mimeString});
return blob;
}
async addImageMobile() {
@@ -293,7 +293,7 @@
</div>
</div>
<div class="aside-righ flex-grow-1">
<div *ngIf="loggeduser.Profile != 'PR'" class="aside-righ flex-grow-1">
<app-empty-container
[texto]="emptyTextDescription"
*ngIf="!showAttendees"
@@ -209,7 +209,7 @@
</div>
</div>
<div *ngIf="postData" class="aside-right flex-column height-100">
<div *ngIf="postData && loggeduser.Profile != 'PR'" class="aside-right flex-column height-100">
<app-empty-container
[texto]="emptyTextDescription"
*ngIf="!showAttendees"
@@ -151,6 +151,8 @@ export class PublicationsPage implements OnInit {
this.publicationsEventFolderList = folders.filter((e)=>e.ActionType == 'Evento')
this.publicationsTravelFolderList = folders.filter((e)=>e.ActionType != 'Evento')
// ActionModel.create(folders)
await this.storage.set('actionsEvents', this.publicationsEventFolderList);
await this.storage.set('actionsViagens', this.publicationsTravelFolderList);