-
+
{
// // 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) {
diff --git a/src/app/services/functions/file.service.ts b/src/app/services/functions/file.service.ts
index 95f02e6b5..4dbdcd120 100644
--- a/src/app/services/functions/file.service.ts
+++ b/src/app/services/functions/file.service.ts
@@ -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,
}
}
}
diff --git a/src/app/shared/chat/group-messages/group-messages.page.html b/src/app/shared/chat/group-messages/group-messages.page.html
index 051d6a75d..5afddf0db 100644
--- a/src/app/shared/chat/group-messages/group-messages.page.html
+++ b/src/app/shared/chat/group-messages/group-messages.page.html
@@ -138,9 +138,6 @@
-
-
-
@@ -150,6 +147,9 @@
+
+
+
diff --git a/src/app/shared/chat/messages/messages.page.html b/src/app/shared/chat/messages/messages.page.html
index a26012f2e..c582ee122 100644
--- a/src/app/shared/chat/messages/messages.page.html
+++ b/src/app/shared/chat/messages/messages.page.html
@@ -111,9 +111,6 @@
-
-
-
@@ -123,6 +120,9 @@
+
+
+
diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts
index dddeaea49..3b20a5099 100644
--- a/src/app/shared/chat/messages/messages.page.ts
+++ b/src/app/shared/chat/messages/messages.page.ts
@@ -380,10 +380,12 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
takePicture(){
- this.fileService.addCameraPictureToChat(this.roomId);
+ const roomId = this.roomId
+ this.fileService.addCameraPictureToChat(roomId);
}
addImage(){
- this.fileService.addPictureToChat(this.roomId);
+ const roomId = this.roomId
+ this.fileService.addPictureToChat(roomId);
}
addFile(){
this.fileService.addDocumentToChat(this.roomId);
diff --git a/src/app/shared/event/attendee-modal/attendee-modal.page.html b/src/app/shared/event/attendee-modal/attendee-modal.page.html
index 239ba5a31..d259c2355 100644
--- a/src/app/shared/event/attendee-modal/attendee-modal.page.html
+++ b/src/app/shared/event/attendee-modal/attendee-modal.page.html
@@ -75,13 +75,11 @@