mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Bug not fix
This commit is contained in:
@@ -80,7 +80,7 @@
|
||||
</div>
|
||||
<div *ngIf="msg.file.type != 'application/img'">
|
||||
<div class="file add-attachment-bg-color" *ngIf="msg.file.type != 'application/audio'">
|
||||
<div (click)="docIndex(i); viewDocument(msg, file.title_link)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
|
||||
<div (click)="docIndex(i); openPreview(msg)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
|
||||
<span *ngIf="msg.file.type">
|
||||
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
|
||||
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon"></fa-icon>
|
||||
|
||||
@@ -44,7 +44,7 @@ import { Plugins, Capacitor } from '@capacitor/core';
|
||||
import { MultipleDocumentsPicker } from '@awesome-cordova-plugins/multiple-document-picker/ngx';
|
||||
import { DomSanitizer} from '@angular/platform-browser';
|
||||
import { StringDecoder } from 'string_decoder';
|
||||
//import { File } from 'node_modules_/@ionic-native/file/ngx';
|
||||
import { File } from '@ionic-native/file/ngx';
|
||||
|
||||
|
||||
const IMAGE_DIR = 'stored-images';
|
||||
@@ -133,7 +133,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
private fileToBase64Service: FileToBase64Service,
|
||||
private multipleDocumentsPicker: MultipleDocumentsPicker,
|
||||
private sant: DomSanitizer,
|
||||
//private file: File
|
||||
private file: File,
|
||||
//private fileOpener: FileOpener,
|
||||
private sanitiser: DomSanitizer,
|
||||
) {
|
||||
this.loggedUser = authService.ValidatedUserChat['data'];
|
||||
@@ -740,17 +741,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
return zoneOriginalInstance || fileReader;
|
||||
}
|
||||
|
||||
fileToBase64 = (blob,filename) => {
|
||||
return new Promise(resolve => {
|
||||
var file = new File([blob], filename);
|
||||
var reader = this.getFileReader(); // Read file content on file loaded event
|
||||
reader.onloadend = (evt) => {
|
||||
console.log(evt.target.result)
|
||||
resolve(evt.target.result); }; // Convert data to base64
|
||||
reader.readAsDataURL(file);
|
||||
} )
|
||||
};
|
||||
|
||||
async addFileToChat(types: typeof FileType[]) {
|
||||
|
||||
/* this.multipleDocumentsPicker.pick(2)
|
||||
@@ -1032,12 +1022,11 @@ fileToBase64 = (blob,filename) => {
|
||||
} else if (event.type === HttpEventType.Response) {
|
||||
if (msg.file.type == "application/img") {
|
||||
this.downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
|
||||
} else {
|
||||
} else if (msg.file.type == "application/pdf") {
|
||||
//console.log('TRY THIS LIBRARY ',fromByteArray(event.body));
|
||||
this.downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '');
|
||||
this.downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '');
|
||||
//this.downloadFile = event.body
|
||||
console.log(event.body)
|
||||
console.log(this._arrayBufferToBase64(event.body))
|
||||
console.log(this.downloadFile)
|
||||
}
|
||||
|
||||
msg.attachments[0] = {
|
||||
@@ -1070,10 +1059,13 @@ fileToBase64 = (blob,filename) => {
|
||||
console.log(msg);
|
||||
|
||||
if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
|
||||
this.downloadFile(msg)
|
||||
this.downloadFileMsg(msg)
|
||||
//this.testDownlod(msg)
|
||||
|
||||
} else {
|
||||
var str = msg.attachments[0].image_url;
|
||||
str = str.substring(1, ((str.length) - 1));
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewMediaPage,
|
||||
cssClass: 'modal modal-desktop',
|
||||
|
||||
Reference in New Issue
Block a user