mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
save
This commit is contained in:
@@ -21,12 +21,13 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
message:any;
|
||||
leaveStatus:any;
|
||||
messages:any;
|
||||
|
||||
|
||||
|
||||
room:any;
|
||||
roomName:any;
|
||||
members:any;
|
||||
|
||||
loggedUserChat:any;
|
||||
@Input() roomId:string;
|
||||
@Output() closeAllDesktopComponents:EventEmitter<any> = new EventEmitter<any>();
|
||||
@Output() showEmptyContainer:EventEmitter<any> = new EventEmitter<any>();
|
||||
@@ -43,6 +44,7 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
private animationController: AnimationController,
|
||||
private alertService: AlertService,
|
||||
) {
|
||||
this.loggedUserChat = authService.ValidatedUserChat['data'];
|
||||
this.isGroupCreated = true;
|
||||
}
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
@@ -50,10 +52,7 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.authService.userData$.subscribe((res:any)=>{
|
||||
this.loggedUser=res;
|
||||
console.log(this.loggedUser);
|
||||
});
|
||||
this.loggedUser=this.loggedUserChat;
|
||||
this.getRoomInfo();
|
||||
console.log(this.roomId);
|
||||
}
|
||||
@@ -77,7 +76,7 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
get watch(){
|
||||
this.getRoomInfo();
|
||||
console.log('here watching');
|
||||
|
||||
|
||||
return this.roomId;
|
||||
}
|
||||
getRoomInfo(){
|
||||
@@ -112,18 +111,18 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
}
|
||||
loadGroupMessages(room:any){
|
||||
console.log('here'+room.t);
|
||||
|
||||
|
||||
this.showLoader = true;
|
||||
//If group is private call getGroupMembers
|
||||
if(room.t === 'p'){
|
||||
console.log('private');
|
||||
|
||||
|
||||
this.chatService.getPrivateGroupMessages(this.roomId).subscribe(res=>{
|
||||
console.log(res);
|
||||
let msgOnly = res['messages'].filter(data => data.t != 'au');
|
||||
this.messages = msgOnly.reverse();
|
||||
console.log(res);
|
||||
|
||||
|
||||
this.showLoader = false;
|
||||
});
|
||||
}
|
||||
@@ -138,14 +137,14 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
sendMessage(){
|
||||
|
||||
let body = {
|
||||
"message":
|
||||
{
|
||||
"rid": this.roomId, "msg": this.message
|
||||
"message":
|
||||
{
|
||||
"rid": this.roomId, "msg": this.message
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.chatService.sendMessage(body).subscribe(res=> {
|
||||
/* this.loadGroupMessages(); */
|
||||
/* this.loadGroupMessages(); */
|
||||
this.getRoomInfo();
|
||||
});
|
||||
this.message = "";
|
||||
@@ -174,7 +173,7 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
const leaveAnimation = (baseEl: any) => {
|
||||
return enterAnimation(baseEl).direction('reverse');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* const popover = await this.popoverController.create({
|
||||
component: MessagesOptionsPage,
|
||||
@@ -217,11 +216,11 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
else{
|
||||
this.roomName = res.data.name.split('-').join(' ');
|
||||
console.log(this.roomName);
|
||||
|
||||
|
||||
this.getRoomInfo();
|
||||
//this.modalController.dismiss();
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -252,9 +251,9 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
console.log(res);
|
||||
if(res.data){
|
||||
this.getRoomInfo();
|
||||
//this.modalController.dismiss();
|
||||
//this.modalController.dismiss();
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
async openChatOptions(ev: any) {
|
||||
@@ -271,7 +270,7 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
}
|
||||
async addContacts(){
|
||||
console.log(this.members);
|
||||
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: GroupContactsPage,
|
||||
componentProps: {
|
||||
@@ -279,7 +278,7 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
room: this.room,
|
||||
members: this.members,
|
||||
name: this.room.name,
|
||||
},
|
||||
},
|
||||
cssClass: 'contacts',
|
||||
backdropDismiss: false
|
||||
});
|
||||
@@ -310,7 +309,7 @@ export class GroupMessagesPage implements OnInit, OnChanges {
|
||||
handler: () => {
|
||||
console.log('Play clicked');
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
});
|
||||
await actionSheet.present();
|
||||
|
||||
Reference in New Issue
Block a user