git pull made

This commit is contained in:
Eudes Inácio
2021-10-09 16:59:10 +01:00
20 changed files with 244 additions and 81 deletions
+5 -3
View File
@@ -17,21 +17,23 @@ export class FileLoaderService {
createInput({accept, type = 'file'}:createInput): HTMLInputElement {
let input = document.createElement('input');
input.type = type || 'file';
input.accept = accept.join(', ')
// input.onchange = () => {
// // you can use this method to get file and perform respective operations
// let files = Array.from(input.files);
// console.log(files);
// };
input.click();
return input
}
getFirstFile(input: HTMLInputElement) {
+96 -10
View File
@@ -86,38 +86,114 @@ export class FileService {
}
addCameraPictureToChat(roomId){
let data = this.takePicture();
if(data.name != null){
const options: CameraOptions = {
quality: 50,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
targetWidth: 720,
targetHeight: 720,
}
this.camera.getPicture(options).then((imageData) => {
this.capturedImage = 'data:image/png;base64,'+imageData;
this.capturedImageTitle = new Date().getTime() + '.jpeg';
let body = {
"message":
{
"rid": roomId,
"msg": "",
"attachments": [{
"title": data.name,
"title": this.capturedImageTitle,
"title_link_download": false,
"image_url": data.image,
"image_url": this.capturedImage,
}]
}
}
const loader = this.toastService.loading();
this.chatService.sendMessage(body).subscribe(res=> {
console.log(res);
loader.remove();
},(error) => {
loader.remove();
this.toastService.badRequest("Não foi possível adicionar a fotografia!");
});
}
else{
}, (err) => {
this.toastService.badRequest("Não foi possível adicionar a fotografia!");
}
});
}
addPictureToChat(roomId:string) {
addPictureToChatMobile(roomId) {
alert('Here')
const options: CameraOptions = {
quality: 90,
sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
targetWidth: 720,
targetHeight: 720,
correctOrientation: true
}
this.camera.getPicture(options).then((imageData) => {
let base64Image = 'data:image/jpeg;base64,' + imageData;
this.capturedImage = imageData;
this.capturedImageTitle = new Date().getTime() + '.jpeg';
//const loader = this.toastService.loading();
let body = {
"message":
{
"rid": roomId,
"msg": "",
"attachments": [{
//"title": this.capturedImageTitle ,
//"text": "description",
"title_link_download": false,
"image_url": this.capturedImage,
}]
}
}
console.log(this.capturedImage)
this.chatService.sendMessage(body).subscribe(res=> {
//loader.remove();
//console.log(res);
},(error) => {
//loader.remove();
});
}, (err) => {
//console.log(err);
});
}
addPictureToChat(roomId) {
const input = this.fileLoaderService.createInput({
accept: ['image/apng', 'image/jpeg', 'image/png']
})
setInterval(()=>{
console.log(input.value)
}, 550)
input.onchange = async () => {
alert('Onchange AQUI')
const file = this.fileLoaderService.getFirstFile(input)
console.log(file);
@@ -141,6 +217,8 @@ export class FileService {
}
}
console.log(this.capturedImage)
this.chatService.sendMessage(body).subscribe(res=> {
loader.remove();
//console.log(res);
@@ -189,6 +267,8 @@ export class FileService {
modal.onDidDismiss().then(async res=>{
const data = res.data;
alert('HERE')
if(data.selected){
const loader = this.toastService.loading();
@@ -197,6 +277,10 @@ export class FileService {
console.log(res.data.selected.Id);
console.log(res.data.selected.ApplicationType);
console.log('AQUIIIII');
alert('HERE 2')
let url = await this.processesService.GetDocumentUrl(res.data.selected.Id, res.data.selected.ApplicationType).toPromise();
let url_no_options: string = url.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
console.log(url_no_options);
@@ -218,7 +302,9 @@ export class FileService {
}],
"file":{
"name": res.data.selected.Assunto,
"type": "application/webtrix"
"type": "application/webtrix",
"ApplicationId": res.data.selected.ApplicationType,
"DocId": res.data.selected.Id,
}
}
}