This commit is contained in:
tiago.kayaya
2021-07-23 14:43:51 +01:00
parent 9bcc06add2
commit b5e1ad4201
17 changed files with 194 additions and 203 deletions
@@ -37,11 +37,10 @@ export class GroupContactsPage implements OnInit {
private chatService: ChatService,
private authService: AuthService,
private navParams: NavParams,
)
)
{
this.authService.userData$.subscribe((res:any)=>{
this.loggedUser=res;
});
this.loggedUser = authService.ValidatedUserChat['data'];
this.textSearch="";
this.dm=null;
this.room=null;
@@ -95,7 +94,7 @@ export class GroupContactsPage implements OnInit {
loadUsers(){
this.options = {
this.options = {
headers: this.headers,
};
this.chatService.getAllUsers().subscribe((res:any)=>{
@@ -115,7 +114,7 @@ export class GroupContactsPage implements OnInit {
return 0;
});
console.log(this.users);
this.showLoader = false;
});
}
@@ -143,7 +142,7 @@ export class GroupContactsPage implements OnInit {
async close(){
this.modalController.dismiss();
if(this.isGroupCreated){
console.log('go to conversa');
console.log('go to conversa');
}
else{
this.modalController.dismiss();
@@ -167,12 +166,12 @@ export class GroupContactsPage implements OnInit {
}
clicked(){
console.log('clicked');
}
selectedContact(user:any){
/* this.groupName = this.room.name; */
user.isChecked = !user.isChecked;
}
addContacts(room:any){
@@ -185,11 +184,11 @@ export class GroupContactsPage implements OnInit {
let body ={
"roomId":room._id,
"userId":user._id,
}
this.chatService.addUserToGroup(body).subscribe(res=>{
console.log(res['success']);
});
});
});
}
@@ -202,9 +201,9 @@ export class GroupContactsPage implements OnInit {
console.log(res['group']);
this.addContacts(res['group']);
this.openGroupMessages(res['group']);
});
}
else{
this.addContacts(this.room);
@@ -212,12 +211,12 @@ export class GroupContactsPage implements OnInit {
/* this.openGroupMessages(this.room); */
/* this.chatService.getGroupInfo(this.room._id).subscribe(res=>{
console.log(res);
this.addContacts(res['group']);
this.openGroupMessages(res['group']);
}) */
}
}
}
async newGroup(){
@@ -237,7 +236,7 @@ export class GroupContactsPage implements OnInit {
component: GroupMessagesPage,
componentProps: {
room: room,
},
},
cssClass: 'group-messages',
backdropDismiss: false
});
@@ -10,7 +10,7 @@
<button class="btn-no-color" (click)="openOptions()">
<ion-icon src="assets/images/icons-menu.svg"></ion-icon>
</button>
</div>
</div>
</div>
<div (click)="addContacts()" class="header-bottom">
<div class="header-bottom-icon">
@@ -56,7 +56,7 @@
</div>
</ion-content>
<!--
<!--
<ion-footer>
<ion-toolbar>
<ion-row align-items-center class="row">
@@ -28,6 +28,7 @@ export class GroupMessagesPage implements OnInit {
contacts: string[] = [" Ana M.", "Andre F.", "Bruno G.", "Catarina T", "Tiago"];
roomId: string;
loggedUserChat:any;
constructor(
private menu: MenuController,
@@ -39,15 +40,14 @@ export class GroupMessagesPage implements OnInit {
private authService: AuthService,
private alertService: AlertService,
) {
this.loggedUserChat = authService.ValidatedUserChat['data'];
this.isGroupCreated = true;
this.roomId = this.navParams.get('roomId');
}
ngOnInit() {
this.authService.userData$.subscribe((res:any)=>{
this.loggedUser=res;
console.log(this.loggedUser);
});
console.log(this.roomId);
this.loggedUser=this.loggedUserChat;
this.getRoomInfo();
}
@@ -121,17 +121,17 @@ export class GroupMessagesPage implements OnInit {
sendMessage(){
let body = {
"message":
{
"rid": this.roomId, "msg": this.message
"message":
{
"rid": this.roomId, "msg": this.message
}
}
this.chatService.sendMessage(body).subscribe(res=> {
this.getRoomInfo();
},(error) => {
});
this.message = "";
}
@@ -154,7 +154,7 @@ export class GroupMessagesPage implements OnInit {
console.log('cancel');
}
console.log('OK2');
});
}
@@ -172,7 +172,7 @@ export class GroupMessagesPage implements OnInit {
}
async addContacts(){
console.log(this.members);
const modal = await this.modalController.create({
component: GroupContactsPage,
componentProps: {
@@ -180,7 +180,7 @@ export class GroupMessagesPage implements OnInit {
room: this.room,
members: this.members,
name: this.room.name,
},
},
cssClass: 'contacts',
backdropDismiss: false
});
@@ -211,7 +211,7 @@ export class GroupMessagesPage implements OnInit {
handler: () => {
console.log('Play clicked');
}
},
},
]
});
await actionSheet.present();