create room on reive from socket

This commit is contained in:
Peter Maquiran
2024-09-13 14:03:51 +01:00
parent 4b6364fac1
commit f446517773
9 changed files with 31 additions and 84 deletions
+16 -9
View File
@@ -24,6 +24,7 @@ import { BoldLocalRepository } from 'src/app/module/chat/data/repository/bold/bo
import { BoldTable } from 'src/app/infra/database/dexie/instance/chat/schema/bold';
import { RoomViewModel } from './store/model/room';
import { MessageLocalDataSourceService } from 'src/app/module/chat/data/repository/message/message-local-data-source.service'
import { ToastService } from 'src/app/services/toast.service';
@Component({
selector: 'app-chat',
templateUrl: './chat.page.html',
@@ -81,7 +82,8 @@ export class ChatPage implements OnInit {
private ChatServiceService: ChatServiceService,
private roomLocalDataSourceService: RoomLocalRepository,
private boldLocalRepository: BoldLocalRepository,
private MessageLocalDataSourceService: MessageLocalDataSourceService
private MessageLocalDataSourceService: MessageLocalDataSourceService,
private toastService: ToastService,
) {
window.onresize = (event) => {
@@ -343,14 +345,19 @@ export class ChatPage implements OnInit {
this.roomId = roomId;
this.RoomSelected = this.rooms.filter(e => e.id == roomId)[0]
if (window.innerWidth < 701) {
this.openMessagesModal(roomId);
}
else {
this.idSelected = roomId;
this.closeAllDesktopComponents();
this.showEmptyComponent = false;
this.showMessages = true;
if(this.RoomSelected?.id) {
if (window.innerWidth < 701) {
this.openMessagesModal(roomId);
}
else {
this.idSelected = roomId;
this.closeAllDesktopComponents();
this.showEmptyComponent = false;
this.showMessages = true;
}
} else {
console.log('conversa não existe');
// this.toastService._badRequest("Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico.")
}
}
@@ -67,15 +67,6 @@
</div>
<div *ngFor="let attachment of message.attachments; let i = index">
<div *ngIf="attachment.source == MessageAttachmentFileSource.Webtrix">
<ion-icon src="assets/icon/webtrix.svg" class="file-icon font-25"></ion-icon>
<!-- <ion-label>{{ attachment.fileName}}</ion-label> -->
<!-- <ion-icon *ngIf="ThemeService.currentTheme == 'default' && attachment.type != 'webtrix' && !( msg.downloadLoader == true || msg.uploadingFile == true ) " class="icon-download" src="assets/icon/theme/default/icons-download.svg" slot="end"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && attachment.type != 'webtrix' && !( msg.downloadLoader == true || msg.uploadingFile == true ) " class="icon-download" src="assets/icon/theme/gov/icons-download.svg" slot="end"></ion-icon>
<ion-icon *ngIf="( msg.downloadLoader == true || msg.uploadingFile == true )" class="icon-download" src="assets/gif/theme/{{ThemeService.currentTheme}}/Blocks-loader.svg" slot="end"></ion-icon> -->
</div>
<div *ngIf="attachment.fileType == MessageAttachmentFileType.Image">
<img
@@ -109,7 +100,8 @@
<audio [src]="attachment.safeFile|safehtml" preload="metadata" class="flex-grow-1" controls controlsList="nodownload noplaybackrate"></audio>
</div>
<div *ngIf="attachment.fileType == MessageAttachmentFileType.Doc" class="d-flex" (click)="openPreview(message)">
<div *ngIf="attachment.fileType == MessageAttachmentFileType.Doc" class="d-flex" (click)="openPreview(message)">
<ion-icon *ngIf="attachment.source == MessageAttachmentFileSource.Webtrix" src="assets/icon/webtrix.svg" class="file-icon font-25"></ion-icon>
<fa-icon *ngIf="attachment.mimeType == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
<fa-icon *ngIf="attachment.mimeType == 'application/word'" icon="file-word" class="word-icon">
</fa-icon>
@@ -773,13 +773,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
viewDocument(file: any, url?: string) {
if (file.type == "application/webtrix") {
this.openViewDocumentModal(file);
}
else {
let fullUrl = "https://www.tabularium.pt" + url;
this.fileService.viewDocumentByUrl(fullUrl);
}
this.openViewDocumentModal(file);
}