merge with develop

This commit is contained in:
Eudes Inácio
2022-07-08 09:17:02 +01:00
11 changed files with 293 additions and 257 deletions
+47 -36
View File
@@ -97,9 +97,12 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
isPlaying = false;
audioProgress = 0;
audioDuration = 0;
audioTimer: any;
@ViewChild('range', { static: false }) range: IonRange;
userName = "";
audioTimer:any;
@ViewChild('range', {static: false}) range: IonRange;
room: any = new Array();
roomName: any;
isAdmin = false;
roomCountDownDate: string;
constructor(
public popoverController: PopoverController,
@@ -129,6 +132,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
ngOnChanges(changes: SimpleChanges): void {
this.wsChatMethodsService.getAllRooms();
this.wsChatMethodsService.getDmRoom(this.roomId).loadHistory({})
this.wsChatMethodsService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked
@@ -164,12 +168,10 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
async ngOnInit() {
ngOnInit() {
this.wsChatMethodsService.getAllRooms();
alert(this.wsChatMethodsService.getDmRoom(this.roomId).name)
this.chatService.refreshtoken();
this.scrollToBottom();
this.getChatMembers();
this.deleteRecording();
@@ -1027,35 +1029,14 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
this.downloadFileMsg(msg)
//this.testDownlod(msg)
/* } else if (msg.file.type === "application/pdf") {
const win = window.open("", "_blank");
let html = '';
html += '<html>';
html += '<body style="margin:0!important">';
html += '<iframe width="100%" height="100%" src="' + str + '" type="application/pdf" />';
html += '</body>';
html += '</html>';
setTimeout(() => {
win.document.write(html);
}, 0); */
//this.viewDocument(msg, msg.attachments.image_url)
} else {
var str = msg.attachments[0].image_url;
str = str.substring(1, ((str.length) - 1));
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
console.log(msg)
if (msg.file.type == "application/img") {
const modal = await this.modalController.create({
component: ViewMediaPage,
@@ -1069,19 +1050,28 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
});
modal.present();
} else {
this.downloadFileFromBrowser("file", str)
this.downloadFileFromBrowser(msg.attachments[0].name, str)
}
} else {
this.openFile(str, msg.attachments[0].name, msg.file.type);
if (msg.file.type == "application/img") {
const modal = await this.modalController.create({
component: ViewMediaPage,
cssClass: 'modal modal-desktop',
componentProps: {
image: msg.attachments[0].image_url,
type: msg.file.type,
username: msg.u.name,
_updatedAt: msg._updatedAt
}
});
modal.present();
} else {
this.openFile(str, msg.attachments[0].name, msg.file.type);
}
}
}
}
}
@@ -1138,6 +1128,27 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}, 1000)
}
async getRoomInfo() {
this.wsChatMethodsService.getGroupRoom(this.roomId).loadHistory({});
let room = await this.chatService.getRoomInfo(this.roomId).toPromise();
// console.log('ROOM',room)
this.room = room['room'];
if (this.room.name) {
this.roomName = this.room.name.split('-').join(' ');
}
if(SessionStore.user.ChatData.data.userId == this.room.u._id){
this.isAdmin = true
} else {
this.isAdmin = false
}
if (this.room.customFields.countDownDate) {
this.roomCountDownDate = this.room.customFields.countDownDate;
}
}
}