Merge branch 'develop' into bugfix/chat-create-event

This commit is contained in:
Peter Maquiran
2022-08-03 14:30:13 +01:00
39 changed files with 337 additions and 244 deletions
+3 -1
View File
@@ -37,6 +37,7 @@
</ion-segment-button>
</ion-segment>
</ion-toolbar>
<div class=" aside overflow-y-auto d-flex flex-wrap flex-grow-1">
<div class="width-100" [ngSwitch]="segment">
<ion-list *ngSwitchCase="'Contactos'">
@@ -133,12 +134,13 @@
<div *ngIf="group.lastMessage" class="item-description d-flex align-items-center" [class.item-description-active]="group.id ==idSelected">
<div class="item-message" *ngIf="group.otherUserType == false">{{group.lastMessage.u.name}}: {{group.lastMessage.msg}} </div>
<div *ngIf="group.otherUserType == true">{{group.userThatIsTyping}} está escrever ...</div>
<div class="item-files add-ellipsis" *ngIf="group.lastMessage.file">
<fa-icon *ngIf="group.lastMessage.file.type != 'application/meeting' && group.lastMessage.file.type != 'application/audio'" icon="file-alt" class="file-icon" [class.set-active-item-font-to-white]="group.id == idSelected"></fa-icon>
<fa-icon *ngIf="group.lastMessage.file.type == 'application/audio'" icon="file-audio" class="file-icon" [class.set-active-item-font-to-white]="group.id == idSelected"></fa-icon>
<span *ngIf="group.lastMessage.file.type == 'application/audio'" class="item-files-title"> audio </span>
<fa-icon *ngIf="group.lastMessage.file.type == 'application/meeting'" icon="calendar-alt" class="file-icon" [class.set-active-item-font-to-white]="group.id == idSelected"></fa-icon>
<span *ngIf="group.lastMessage.file.type != 'application/audio'" class="item-files-title"> {{ group.lastMessage.attachments[0].title }}</span>
<span *ngIf="group.lastMessage.file.type != 'application/audio' && group.lastMessage.attachments" class="item-files-title"> {{ group.lastMessage.attachments[0].title }}</span>
</div>
<div class="item-files" *ngIf="group.attachments">
<div *ngIf="group.value.lastMessage.attachments[0].image_url">
+8 -4
View File
@@ -125,6 +125,8 @@ export class ChatPage implements OnInit {
this.showLoader = true;
this.segment = 'Contactos'
}
ngOnInit() {
@@ -320,7 +322,6 @@ export class ChatPage implements OnInit {
async setIntervenient(data) {
this.taskParticipants = removeDuplicate(data)
}
async setIntervenientCC(data) {
@@ -339,12 +340,11 @@ export class ChatPage implements OnInit {
}
onSegmentChange() {
//this.load();
this.wsChatMethodsService.getAllRooms();
}
doRefresh(event) {
setTimeout(() => {
//this.load();
event.target.complete();
}, 1000);
}
@@ -357,7 +357,6 @@ export class ChatPage implements OnInit {
});
}
getDirectMessagesDB() {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storageservice.get("rooms").then((rooms) =>{
@@ -560,6 +559,11 @@ export class ChatPage implements OnInit {
}
roomDataFileType(roomData) {
return roomData?.lastMessage?.file?.type || null
}
async transformGroups(data) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
let groupsArray = [];
@@ -150,7 +150,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
})
//this.loadFiles();
}
setStatus(status: string) {
@@ -104,7 +104,6 @@ export class ContactsPage implements OnInit {
this.room = res['room'];
await this.WsChatMethodsService.getAllRooms();
this.getDirectMessage(this.room._id);
});
@@ -139,26 +138,10 @@ export class ContactsPage implements OnInit {
}
async openMessages(username:string){
/* this.close(); */
let dm:any;
//Create new room
this.createRoom(username);
//Get direct messages (dm)
/* this.getDirectMessage(this.room._id); */
this.createRoom(username);
/* const modal = await this.modalController.create({
component: MessagesPage,
cssClass: 'group-messages',
backdropDismiss: false,
componentProps: {
dm: dm,
},
});
await modal.present();
modal.onDidDismiss(); */
}
}
+9 -2
View File
@@ -40,6 +40,7 @@ import { HttpErrorResponse } from '@angular/common/http';
import { File } from '@awesome-cordova-plugins/file/ngx';
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
import { Filesystem, Directory } from '@capacitor/filesystem';
const IMAGE_DIR = 'stored-images';
@@ -125,7 +126,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
private sqlservice: SqliteService,
public wsChatMethodsService: WsChatMethodsService,
private AttachmentsService: AttachmentsService,
private CameraService: CameraService,
private processesService: ProcessesService,
private storage: Storage,
@@ -149,7 +149,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
this.wsChatMethodsService.getDmRoom(this.roomId).loadHistory({})
this.wsChatMethodsService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked
this.wsChatMethodsService.openRoom(this.roomId)
@@ -162,6 +161,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
ngOnInit() {
this.createDirectoryImage()
this.wsChatMethodsService.getAllRooms();
this.chatService.refreshtoken();
this.wsChatMethodsService.getUserOfRoom(this.roomId).then((value) => {
@@ -1075,6 +1075,13 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
// });
// }
async createDirectoryImage() {
await Filesystem.mkdir({
path: IMAGE_DIR,
directory: Directory.Data,
recursive: true
});
}
}