mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix open pdf and member list
This commit is contained in:
@@ -44,6 +44,8 @@ import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
|
||||
import { FileSystemMobileService } from 'src/app/infra/file-system/mobile/file-system-mobile.service';
|
||||
import { RoomViewModel } from '../../store/model/room';
|
||||
import { RoomStore } from '../../store/roomStore'
|
||||
import { GroupContactsPage, IGroupContactsPageOutPutSchema } from '../group-messages/group-contacts/group-contacts.page';
|
||||
import { EditGroupPage } from '../edit-group/edit-group.page';
|
||||
|
||||
const IMAGE_DIR = 'stored-images';
|
||||
|
||||
@@ -101,7 +103,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
selectedMessage: any = null;
|
||||
emojis: string[] = ['😊', '😂', '❤️', '👍', '😢']; // Add more emojis as needed
|
||||
textField = ''
|
||||
roomType!: RoomType
|
||||
|
||||
MessageAttachmentFileType = MessageAttachmentFileType
|
||||
MessageAttachmentFileSource = MessageAttachmentSource
|
||||
@@ -140,6 +141,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.RoomStore.start(this.room)
|
||||
}
|
||||
|
||||
|
||||
@HostListener('document:click', ['$event'])
|
||||
handleClickOutside(event: Event) {
|
||||
if (!this.handleClickActive) return;
|
||||
@@ -360,6 +362,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.RoomStore.stop()
|
||||
window.removeEventListener('scroll', this.scrollChangeCallback, true);
|
||||
this.handleClickActive = false; // Disable the listener before component destruction
|
||||
}
|
||||
@@ -512,29 +515,73 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
roomId: this.room.id,
|
||||
members: [],
|
||||
isAdmin: this.RoomStore.isAdmin,
|
||||
roomType: this.roomType
|
||||
roomType: this.RoomStore.room.roomType
|
||||
},
|
||||
cssClass: 'messages-options',
|
||||
event: ev,
|
||||
translucent: true,
|
||||
});
|
||||
return await popover.present();
|
||||
await popover.present();
|
||||
popover.onDidDismiss().then(res => {
|
||||
|
||||
if (res.data == 'leave') {
|
||||
this.modalController.dismiss()
|
||||
}
|
||||
else if (res.data == 'delete') {
|
||||
this.modalController.dismiss()
|
||||
}
|
||||
else if (res.data == 'cancel') {
|
||||
this.modalController.dismiss()
|
||||
}
|
||||
else if (res.data == 'edit') {
|
||||
|
||||
//this.closeAllDesktopComponents.emit();
|
||||
this.editGroup()
|
||||
} else if (res.data == 'addUser') {
|
||||
|
||||
this.addContacts();
|
||||
}
|
||||
else {}
|
||||
});
|
||||
}
|
||||
|
||||
async addContacts() {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ContactsPage,
|
||||
componentProps: {},
|
||||
component: GroupContactsPage,
|
||||
componentProps: {
|
||||
roomId: this.RoomStore.room.id,
|
||||
},
|
||||
cssClass: 'contacts',
|
||||
backdropDismiss: false
|
||||
});
|
||||
|
||||
|
||||
modal.onDidDismiss<IGroupContactsPageOutPutSchema>().then(result => {
|
||||
|
||||
modal.onDidDismiss();
|
||||
// this.modalController.dismiss({roomId})
|
||||
|
||||
});
|
||||
await modal.present();
|
||||
}
|
||||
|
||||
async editGroup() {
|
||||
const modal = await this.modalController.create({
|
||||
component: EditGroupPage,
|
||||
cssClass: 'modal modal-desktop',
|
||||
componentProps: {
|
||||
roomId: this.RoomStore.room.id,
|
||||
},
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then((res) => {
|
||||
|
||||
this.RoomStore.updateRoomDetails()
|
||||
// this.getRoomInfo();
|
||||
//this.modalController.dismiss(res.data);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async onImageError() {}
|
||||
async onImageLoad(message: MessageViewModal, index:number) {
|
||||
@@ -717,7 +764,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
const fileName = file.value.name
|
||||
|
||||
const validation = await allowedDocExtension(fileName)
|
||||
const validation = await allowedDocExtension(file.value.type)
|
||||
|
||||
if (validation.isOk()) {
|
||||
|
||||
@@ -730,12 +777,14 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
fileName: file.value.name,
|
||||
source: MessageAttachmentSource.Device,
|
||||
fileType: MessageAttachmentFileType.Doc,
|
||||
mimeType: file.value.type
|
||||
mimeType: file.value.type,
|
||||
description: file.value.name
|
||||
}])
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
console.log({fileName})
|
||||
this.toastService._badRequest("Ficheiro inválido")
|
||||
}
|
||||
}
|
||||
@@ -904,7 +953,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
});
|
||||
modal.present();
|
||||
} else {
|
||||
this.openFile(msg.attachments[0].safeFile, msg.attachments[0].description, msg.attachments[0].mimeType);
|
||||
this.openFile(msg.attachments[0].safeFile, msg.attachments[0].fileName || msg.attachments[0].description, msg.attachments[0].mimeType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user