-
-
-
-
-
-
-
{{file.title}}
+
+
+
+
+
+
+
+
+
+
+ {{msg.u.name}}
+ {{msg.duration}}
+
+
+
+
+
+ NOT UPLOADED
+
+
+

+
+
+
+
+
+
+
+
+
+
+
+ {{file.title}}
+
+
+
+
+ {{file.title}}
+
+
+
+
+
+
+
+ {{file.description}}
+ •
+ {{msg.displayType}}
+
-
-
-
- {{file.title}}
-
-
-
-
-
-
-
- {{file.description}}
- •
- {{msg.displayType}}
-
+ {{last ? scrollToBottom() : ''}}
- {{last ? scrollToBottom() : ''}}
-
-
- {{msg.u.name}} criou esta reunião
-
- De {{showDateDuration(msg.file.start_date)}} a {{showDateDuration(msg.file.end_date)}}
- {{msg.file.venue}}
-
-
-
- Apagou a mensagem
+
+ {{msg.u.name}} criou esta reunião
+
+ De {{showDateDuration(msg.file.start_date)}} a {{showDateDuration(msg.file.end_date)}}
+ {{msg.file.venue}}
+
diff --git a/src/app/shared/chat/group-messages/group-messages.page.ts b/src/app/shared/chat/group-messages/group-messages.page.ts
index d55190f61..829ce53d3 100644
--- a/src/app/shared/chat/group-messages/group-messages.page.ts
+++ b/src/app/shared/chat/group-messages/group-messages.page.ts
@@ -274,20 +274,23 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
}
async loadFiles() {
+ try {
+ this.storage.get('fileName').then((fileName) => {
+ this.lastAudioRecorded = fileName;
+ })
+
+ this.storage.get('recordData').then((recordData) => {
+ console.log(recordData);
+ if(recordData?.value?.recordDataBase64.includes('data:audio')){
+ this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData?.value?.recordDataBase64);
+ }
+ else{
+ this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`);
+ }
+ });
+ } catch (error) {}
- this.storage.get('fileName').then((fileName) => {
- this.lastAudioRecorded = fileName;
- })
- this.storage.get('recordData').then((recordData) => {
- console.log(recordData);
- if(recordData.value.recordDataBase64.includes('data:audio')){
- this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData.value.recordDataBase64);
- }
- else{
- this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData.value.recordDataBase64}`);
- }
- });
}
startRecording() {
@@ -439,19 +442,19 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
}
async sendAudio(fileName) {
-
const roomId = this.roomId
let audioFile;
this.storage.get('recordData').then((recordData) => {
console.log(recordData);
audioFile = recordData;
- if(recordData.value.recordDataBase64.includes('data:audio')){
- this.audioRecorded = recordData.value.recordDataBase64;
+ if(recordData?.value?.recordDataBase64.includes('data:audio')){
+ this.audioRecorded = recordData?.value?.recordDataBase64;
}
else{
- this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData.value.recordDataBase64}`;
+ this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`;
}
+
//Converting base64 to blob
const encodedData = btoa(this.audioRecorded);
const blob = this.base64toBlob(encodedData, recordData.value.mimeType)
@@ -994,37 +997,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
downloadFileMsg(msg: MessageService) {
- console.log('FILE TYPE', msg.file.type)
- this.downloadFile = "";
- this.AttachmentsService.downloadFile(msg.file.guid).subscribe(async (event) => {
- console.log('FILE TYPE 22', msg.file.guid)
- var name = msg.file.guid;
-
- if (event.type === HttpEventType.DownloadProgress) {
- //this.downloadProgess = Math.round((100 * event.loaded) / event.total);
- console.log('FILE TYPE 33', msg.file.type)
- } 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 if (msg.file.type === 'application/pdf') {
-
- this.downloadFile = event.body;
- } else if (msg.file.type == 'application/audio') {
- this.downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '');
- }
- msg.attachments[0] = {
- image_url: this.downloadFile,
- name: msg.attachments[0].name,
- title: msg.attachments[0].title,
- title_link: this.downloadFile,
- title_link_download: msg.attachments[0].title_link_download,
- ts: msg.attachments[0].ts
- }
- // save the changes to the storage
- msg.save()
- }
- });
-
+ msg.downloadFileMsg()
}
async openPreview(msg) {
diff --git a/src/app/shared/chat/messages/messages.page.html b/src/app/shared/chat/messages/messages.page.html
index 632b3caf4..7ec469275 100644
--- a/src/app/shared/chat/messages/messages.page.html
+++ b/src/app/shared/chat/messages/messages.page.html
@@ -35,7 +35,7 @@
+ *ngFor="let msg of wsChatMethodsService.getDmRoom(roomId).messages; index as i; let last = last">
@@ -50,7 +50,7 @@
-
{{msg.msg}}
+
{{msg.msg}}
Apagou a mensagem
@@ -84,7 +84,6 @@
-
= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg">
@@ -141,24 +140,26 @@
- {{msg.u.name}} criou esta reunião
-
-
- Apagou a mensagem
-
+
diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts
index 34fcd92ec..3e3b4afd3 100644
--- a/src/app/shared/chat/messages/messages.page.ts
+++ b/src/app/shared/chat/messages/messages.page.ts
@@ -25,7 +25,6 @@ import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.serv
import { WsChatService } from 'src/app/services/chat/ws-chat.service'
import { MessageService } from 'src/app/services/chat/message.service';
import { AttachmentsService } from 'src/app/services/attachments.service';
-
import { CameraService } from 'src/app/services/camera.service';
import { FileType } from 'src/app/models/fileType';
import { SearchPage } from 'src/app/pages/search/search.page';
@@ -250,24 +249,26 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
async loadFiles() {
+ try {
+ this.storage.get('fileName').then((fileName) => {
+ this.lastAudioRecorded = fileName;
+ })
+
+ this.storage.get('recordData').then((recordData) => {
+ console.log(recordData);
+ if(recordData?.value?.recordDataBase64.includes('data:audio')){
+ this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData?.value?.recordDataBase64);
+ }
+ else{
+ this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`);
+ }
+ });
+ } catch (error) {}
- this.storage.get('fileName').then((fileName) => {
- this.lastAudioRecorded = fileName;
- })
-
- this.storage.get('recordData').then((recordData) => {
- console.log(recordData);
- if(recordData.value.recordDataBase64.includes('data:audio')){
- this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData.value.recordDataBase64);
- }
- else{
- this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData.value.recordDataBase64}`);
- }
- });
+
}
startRecording() {
- console.log('Recording');
if (this.recording) {
return;
@@ -376,17 +377,16 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
async sendAudio(fileName) {
-
const roomId = this.roomId
let audioFile;
this.storage.get('recordData').then((recordData) => {
console.log(recordData);
audioFile = recordData;
- if(recordData.value.recordDataBase64.includes('data:audio')){
- this.audioRecorded = recordData.value.recordDataBase64;
+ if(recordData?.value?.recordDataBase64.includes('data:audio')){
+ this.audioRecorded = recordData?.value?.recordDataBase64;
}
else{
- this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData.value.recordDataBase64}`;
+ this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`;
}
//Converting base64 to blob
@@ -416,7 +416,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
deleteMessage(msgId: string, msg:MessageService) {
- msg.delateStatusFalse()
this.wsChatMethodsService.getDmRoom(this.roomId).sendDeleteRequest(msgId)
}
@@ -900,37 +899,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
downloadFileMsg(msg: MessageService) {
- console.log('FILE TYPE', msg.file.type)
- this.downloadFile = "";
- this.AttachmentsService.downloadFile(msg.file.guid).subscribe(async (event) => {
- console.log('FILE TYPE 22', msg.file.guid)
- var name = msg.file.guid;
-
- if (event.type === HttpEventType.DownloadProgress) {
- //this.downloadProgess = Math.round((100 * event.loaded) / event.total);
- console.log('FILE TYPE 33', msg.file.type)
- } 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 if (msg.file.type === 'application/pdf') {
-
- this.downloadFile = event.body;
- } else if (msg.file.type == 'application/audio') {
- this.downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '');
- }
- msg.attachments[0] = {
- image_url: this.downloadFile,
- name: msg.attachments[0].name,
- title: msg.attachments[0].title,
- title_link: this.downloadFile,
- title_link_download: msg.attachments[0].title_link_download,
- ts: msg.attachments[0].ts
- }
- // save the changes to the storage
- msg.save()
- }
- });
-
+ msg.downloadFileMsg()
}
_arrayBufferToBase64( buffer ) {
diff --git a/src/app/shared/popover/chat-options-popover/chat-options-popover.page.html b/src/app/shared/popover/chat-options-popover/chat-options-popover.page.html
index 9fcc86096..88a4ba92e 100644
--- a/src/app/shared/popover/chat-options-popover/chat-options-popover.page.html
+++ b/src/app/shared/popover/chat-options-popover/chat-options-popover.page.html
@@ -7,7 +7,7 @@