mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
Error and conflits after pull solved
This commit is contained in:
@@ -12,7 +12,6 @@ import { BtnModalDismissPage } from 'src/app/shared/btn-modal-dismiss/btn-modal-
|
|||||||
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||||
import { MatMenuModule } from '@angular/material/menu';
|
import { MatMenuModule } from '@angular/material/menu';
|
||||||
import { LettersAvatarModule } from "ngx-letters-avatar";
|
import { LettersAvatarModule } from "ngx-letters-avatar";
|
||||||
import { PdfViewerModule } from 'ng2-pdf-viewer';
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -23,7 +22,6 @@ import { PdfViewerModule } from 'ng2-pdf-viewer';
|
|||||||
MessagesPageRoutingModule,
|
MessagesPageRoutingModule,
|
||||||
MatMenuModule,
|
MatMenuModule,
|
||||||
LettersAvatarModule,
|
LettersAvatarModule,
|
||||||
PdfViewerModule
|
|
||||||
],
|
],
|
||||||
declarations: [MessagesPage]
|
declarations: [MessagesPage]
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -416,19 +416,45 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log('PDF CLICK', msg)
|
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;
|
/* let fullUrl;
|
||||||
fullUrl = "https://gabinetedigitalchat.dyndns.info" + url;
|
fullUrl = "https://gabinetedigitalchat.dyndns.info" + url;
|
||||||
//fullUrl = "http://www.africau.edu/images/default/sample.pdf";
|
//fullUrl = "http://www.africau.edu/images/default/sample.pdf";
|
||||||
|
|
||||||
this.frameUrl = fullUrl; */
|
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)
|
let fileURL = URL.createObjectURL(file)
|
||||||
|
console.log('PDF CLICK', fileURL)
|
||||||
window.open(fileURL);
|
window.open(fileURL);
|
||||||
|
|
||||||
// this.chatService.getDocumentDetails(fullUrl);
|
// 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) {
|
async openViewDocumentModal(file: any) {
|
||||||
let task = {
|
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 === '') {
|
if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
|
||||||
this.downloadFileMsg(msg)
|
this.downloadFileMsg(msg)
|
||||||
|
|
||||||
|
|
||||||
|
} else if (msg.file.type === "application/pdf") {
|
||||||
|
this.viewDocument(msg, msg.attachments.image_url)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* if(msg.file.type === "application/pdf") {
|
/* if(msg.file.type === "application/pdf") {
|
||||||
|
|||||||
Reference in New Issue
Block a user