Error and conflits after pull solved

This commit is contained in:
Eudes Inácio
2022-03-27 22:07:13 +01:00
parent 8b31822229
commit f8215163fa
2 changed files with 30 additions and 3 deletions
+30 -1
View File
@@ -416,19 +416,45 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
else {
console.log('PDF CLICK', msg)
var str = msg.attachments[0].image_url;
str = str.substring(1,((str.length)-1));
const encodedData = btoa(str);
/* let fullUrl;
fullUrl = "https://gabinetedigitalchat.dyndns.info" + url;
//fullUrl = "http://www.africau.edu/images/default/sample.pdf";
this.frameUrl = fullUrl; */
let file = new Blob([msg.attachments[0].image_url], { type: 'application/pdf' });
let file = this.base64toBlob(encodedData, 'application/pdf')
let fileURL = URL.createObjectURL(file)
console.log('PDF CLICK', fileURL)
window.open(fileURL);
// this.chatService.getDocumentDetails(fullUrl);
}
}
base64toBlob(base64Data, contentType) {
contentType = contentType || '';
var sliceSize = 1024;
var byteCharacters = atob(base64Data);
var bytesLength = byteCharacters.length;
var slicesCount = Math.ceil(bytesLength / sliceSize);
var byteArrays = new Array(slicesCount);
for (var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {
var begin = sliceIndex * sliceSize;
var end = Math.min(begin + sliceSize, bytesLength);
var bytes = new Array(end - begin);
for (var offset = begin, i = 0; offset < end; ++i, ++offset) {
bytes[i] = byteCharacters[offset].charCodeAt(0);
}
byteArrays[sliceIndex] = new Uint8Array(bytes);
}
return new Blob(byteArrays, { type: contentType });
}
async openViewDocumentModal(file: any) {
let task = {
@@ -944,7 +970,10 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
this.downloadFileMsg(msg)
} else if (msg.file.type === "application/pdf") {
this.viewDocument(msg, msg.attachments.image_url)
} else {
/* if(msg.file.type === "application/pdf") {