This commit is contained in:
Peter Maquiran
2022-09-23 11:23:24 +01:00
113 changed files with 691545 additions and 784 deletions
@@ -150,7 +150,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
})
//this.loadFiles();
}
setStatus(status: string) {
@@ -171,7 +170,10 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
ngAfterViewInit() {
this.scrollChangeCallback = () => this.onContentScrolled(event);
window.addEventListener('scroll', this.scrollChangeCallback, true);
this.roomCountDownDate = this.timeService.countDownDate(this.room.customFields.countDownDate, this.room._id);
if(this.room?.customFields?.countDownDate) {
this.roomCountDownDate = this.timeService.countDownDate(this.room.customFields.countDownDate, this.room._id);
}
}
handlePress(id?: string) {
@@ -326,7 +328,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.loadFiles();
}
async goToEvent(eventId: any) {
async goToEvent(event: any) {
let classs;
if (window.innerWidth < 701) {
classs = 'modal modal-desktop'
@@ -337,7 +339,8 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
const modal = await this.modalController.create({
component: ViewEventPage,
componentProps: {
eventId: eventId,
eventId: event.id,
CalendarId: event.calendarId
},
cssClass: classs,
});
@@ -1055,7 +1058,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
return blob;
}
openFile(pdfString, filename) {
openFile(pdfString, filename, type) {
const blob = this.b64toBlob(pdfString, 'application/pdf')
let pathFile = ''
const fileName = filename
@@ -1093,7 +1096,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
async openPreview(msg: MessageService) {
if(msg.file.type === "application/webtrix") {
if(msg?.file?.type === "application/webtrix") {
this.viewDocument(msg.file, msg.attachments.image_url)
} else {
if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
@@ -1106,8 +1109,8 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
console.log(msg)
if (msg.file.type == "application/img") {
if (msg?.file?.type == "application/img") {
const modal = await this.modalController.create({
component: ViewMediaPage,
cssClass: 'modal modal-desktop',
@@ -1121,10 +1124,25 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
modal.present();
} else {
this.downloadFileFromBrowser("file", str)
this.downloadFileFromBrowser(msg.attachments[0].name, str)
}
} else {
this.openFile(str, msg.attachments[0].name);
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);
}
}
}
}