mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
merge
This commit is contained in:
@@ -889,7 +889,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
fileBase64 = await this._getBase64(file)
|
||||
|
||||
formData = new FormData();
|
||||
formData.append('blobFile', blob);
|
||||
formData.append('blobFile', file);
|
||||
}
|
||||
|
||||
this.ChatSystemService.getGroupRoom(roomId).send({
|
||||
@@ -1023,11 +1023,12 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
}
|
||||
|
||||
downloadFileFromBrowser(fileName: string, data: any): void {
|
||||
const linkSource = data;
|
||||
const downloadLink = document.createElement("a");
|
||||
downloadLink.href = linkSource;
|
||||
downloadLink.download = fileName;
|
||||
downloadLink.click();
|
||||
const link = document.createElement("a")
|
||||
link.href = `data:${data.type}';base64,${data.image_url}`;
|
||||
link.download = fileName
|
||||
link.click()
|
||||
|
||||
link.remove()
|
||||
}
|
||||
|
||||
b64toBlob(b64Data, contentType) {
|
||||
@@ -1109,10 +1110,10 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
});
|
||||
modal.present();
|
||||
} else {
|
||||
this.downloadFileFromBrowser("file", str)
|
||||
this.downloadFileFromBrowser(msg.attachments[0].title, msg.attachments[0])
|
||||
}
|
||||
} else {
|
||||
this.openFile(str, msg.attachments[0].title, msg.file.type);
|
||||
this.openFile(msg.attachments.image_url, msg.attachments[0].title, msg.file.type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
|
||||
import { ChatMessageDebuggingPage } from 'src/app/shared/popover/chat-message-debugging/chat-message-debugging.page';
|
||||
import { PermissionService } from 'src/app/services/permission.service';
|
||||
import { FileValidatorService } from "src/app/services/file/file-validator.service"
|
||||
import { ChangeDetectorRef } from '@angular/core';
|
||||
|
||||
|
||||
const IMAGE_DIR = 'stored-images';
|
||||
@@ -702,7 +703,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
source: CameraSource.Camera
|
||||
});
|
||||
|
||||
console.log('FILE CHAT',file)
|
||||
console.log('FILE CHAT', file)
|
||||
|
||||
const imageBase64 = 'data:image/jpeg;base64,' + file.base64String
|
||||
const blob = this.dataURItoBlob(imageBase64)
|
||||
@@ -851,7 +852,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
file.type == 'application/xls' || file.type == 'application/xlsx' || file.type == 'application/ppt' ||
|
||||
file.type == 'application/pptx' || file.type == 'application/txt') {
|
||||
|
||||
console.log('FILE', file)
|
||||
console.log('FILE rigth?', file)
|
||||
|
||||
const fileName = file.name
|
||||
|
||||
@@ -876,12 +877,13 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
/* console.log('add file', fileBase64) */
|
||||
|
||||
} else {
|
||||
console.log('encode data', encodedData)
|
||||
blob = this.fileService.base64toBlob(encodedData, file.type)
|
||||
|
||||
fileBase64 = await this._getBase64(file)
|
||||
|
||||
formData = new FormData();
|
||||
formData.append('blobFile', blob);
|
||||
formData.append('blobFile', file);
|
||||
}
|
||||
|
||||
|
||||
@@ -1082,11 +1084,13 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
}
|
||||
|
||||
downloadFileFromBrowser(fileName: string, data: any): void {
|
||||
const linkSource = data;
|
||||
const downloadLink = document.createElement("a");
|
||||
downloadLink.href = linkSource;
|
||||
downloadLink.download = fileName;
|
||||
downloadLink.click();
|
||||
|
||||
const link = document.createElement("a")
|
||||
link.href = `data:${data.type}';base64,${data.image_url}`;
|
||||
link.download = fileName
|
||||
link.click()
|
||||
|
||||
link.remove()
|
||||
}
|
||||
|
||||
viewDocument(file: any, url?: string) {
|
||||
@@ -1154,12 +1158,12 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
});
|
||||
modal.present();
|
||||
} else {
|
||||
this.downloadFileFromBrowser("file", str)
|
||||
this.downloadFileFromBrowser(msg.attachments[0].title, msg.attachments[0],)
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
this.openFile(str, msg.attachments[0].title, msg.file.type);
|
||||
this.openFile(msg.attachments[0].image_url, msg.attachments[0].title, msg.file.type);
|
||||
// this.downloadFileFromBrowser("file", str)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user