add contacts

This commit is contained in:
Peter Maquiran
2024-06-10 16:34:43 +01:00
parent 193e7474e9
commit bf1457417d
23 changed files with 348 additions and 481 deletions
@@ -1,10 +1,9 @@
import { Component, EventEmitter, Input, OnInit, Output,ViewContainerRef } from '@angular/core';
import { ModalController, PickerController, PopoverController } from '@ionic/angular';
import { PickerController, PopoverController } from '@ionic/angular';
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
import { DataService } from 'src/app/services/data.service';
import { GroupDurationPage } from 'src/app/shared/popover/group-duration/group-duration.page';
import { SessionStore } from 'src/app/store/session.service';
import { GroupContactsPage } from '../group-messages/group-contacts/group-contacts.page';
import { ToastService } from 'src/app/services/toast.service';
import { ThemeService } from 'src/app/services/theme.service';
import { RouteService } from 'src/app/services/route.service';
@@ -45,10 +44,8 @@ export class NewGroupPage implements OnInit{
constructor(
private pickerController: PickerController,
private popoverController: PopoverController,
private modalController: ModalController,
private dataService:DataService,
public ChatSystemService: ChatSystemService,
private toastService: ToastService,
public ThemeService: ThemeService,
private RouteService: RouteService,
private viewContainerRef: ViewContainerRef,
@@ -117,59 +114,8 @@ export class NewGroupPage implements OnInit{
async createGroup() {
this.createGroup1()
// let name = this.groupName.split(' ').join('-');
// //Take out all special characters in string
// name = name.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
// let customFields = {}
// let res:any;
// const loader = this.toastService.loading();
// if(this.expirationDate) {
// let customFields = {
// "countDownDate":this.expirationDate
// }
// res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
// }
// else {
// res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
// }
// loader.remove();
// // FsId
// // DocId
// if(res?.result?.rid) {
// this.addGroupMessage.emit(res.result.rid);
// this.ChatSystemService.getAllRooms(() => {
// if(!this.ChatSystemService.getGroupRoom(res.result.rid)) {
// this.createGroupWithAttachmentsCath(res)
// } else {
// setTimeout(()=> {
// this.createGroupWithAttachments(res)
// }, 500)
// }
// }, res.result.rid);
// } else {
// this.toastService._badRequest('Existe um grupo com este nome!');
// }
}
async createGroup1() {
const result = await this.roomRepositoryService.create({
roomName: this.groupName,
@@ -178,20 +124,14 @@ export class NewGroupPage implements OnInit{
expirationDate: null
})
console.log(result)
if(result.isOk()) {
// this.addGroupMessage.emit(result);
} else if(result.error instanceof HttpErrorResponse) {
}
}
createGroupWithAttachmentsCath(res: any) {
if(!this.ChatSystemService.getGroupRoom(res.result.rid)) {
setTimeout(() => {
@@ -243,27 +183,6 @@ export class NewGroupPage implements OnInit{
}, 150);
}
async addContacts() {
this.close();
let name = this.groupName.split(' ').join('-');
const modal = await this.modalController.create({
component: GroupContactsPage,
componentProps: {
isCreated:this.isGroupCreated,
name: name,
duration:'',
},
cssClass: 'contacts',
backdropDismiss: false
});
modal.onDidDismiss();
await modal.present();
}
async setDuration(ev: any) {
const popover = await this.popoverController.create({