mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
save
This commit is contained in:
@@ -134,12 +134,9 @@ export class GroupContactsPage implements OnInit {
|
||||
|
||||
updateGroup(){
|
||||
this.showLoader = true;
|
||||
this.chatService.getRoomInfo(this.roomId).subscribe(room=>{
|
||||
this.room = room['room'];
|
||||
this.addContacts(this.room);
|
||||
this.showLoader = false;
|
||||
this.openGroupMessage.emit(this.room._id);
|
||||
});
|
||||
this.addContacts(this.roomId);
|
||||
this.openGroupMessage.emit(this.roomId);
|
||||
this.showLoader = false;
|
||||
}
|
||||
openGroupMessagesPage(){
|
||||
this.showLoader = true;
|
||||
@@ -259,15 +256,15 @@ export class GroupContactsPage implements OnInit {
|
||||
user.isChecked = !user.isChecked;
|
||||
}
|
||||
|
||||
addContacts(room:any){
|
||||
console.log(room);
|
||||
addContacts(roomId:any){
|
||||
console.log(roomId);
|
||||
this.selectedUserList = this.users.filter(function(contact) {
|
||||
return contact.isChecked == true;
|
||||
});
|
||||
console.log( this.selectedUserList);
|
||||
this.selectedUserList.forEach(user=>{
|
||||
let body ={
|
||||
"roomId":room._id,
|
||||
"roomId":roomId,
|
||||
"userId":user._id,
|
||||
}
|
||||
this.chatService.addUserToGroup(body).subscribe(res=>{
|
||||
|
||||
@@ -80,9 +80,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
downloadFile: any;
|
||||
|
||||
constructor(
|
||||
private menu: MenuController,
|
||||
public wsChatMethodsService: WsChatMethodsService,
|
||||
private modalController: ModalController,
|
||||
private actionSheetController: ActionSheetController,
|
||||
public popoverController: PopoverController,
|
||||
private chatService: ChatService,
|
||||
private authService: AuthService,
|
||||
@@ -97,8 +96,9 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
public ThemeService: ThemeService,
|
||||
private changeDetectorRef: ChangeDetectorRef,
|
||||
private storage: Storage,
|
||||
public wsChatMethodsService: WsChatMethodsService
|
||||
|
||||
) {
|
||||
console.log('OnCONSTRUCTOR');
|
||||
this.loggedUserChat = authService.ValidatedUserChat['data'];
|
||||
this.isGroupCreated = true;
|
||||
this.roomCountDownDate = "";
|
||||
@@ -106,6 +106,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
|
||||
}
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
console.log('OnCHANGES');
|
||||
|
||||
this.getRoomInfo();
|
||||
//this.scrollToBottom();
|
||||
this.wsChatMethodsService.getGroupRoom(this.roomId).loadHistory();
|
||||
@@ -120,11 +122,13 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.log(this.roomId);
|
||||
this.loggedUser = this.loggedUserChat;
|
||||
//console.log(this.wsChatMethodsService.getRoom(this.roomId).massages);
|
||||
|
||||
this.loggedUser=this.loggedUserChat;
|
||||
this.getRoomInfo();
|
||||
setTimeout(() => {
|
||||
this.getRoomInfo();
|
||||
}, 1000);
|
||||
this.setStatus('online');
|
||||
this.getChatMembers();
|
||||
//this.getMessageDB();
|
||||
@@ -254,6 +258,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
}
|
||||
|
||||
async getRoomInfo() {
|
||||
this.wsChatMethodsService.getGroupRoom(this.roomId).loadHistory();
|
||||
let room = await this.chatService.getRoomInfo(this.roomId).toPromise();
|
||||
this.room = room['room'];
|
||||
if (this.room.name) {
|
||||
@@ -288,29 +293,12 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
}
|
||||
|
||||
loadGroupMessages(roomId) {
|
||||
//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;
|
||||
});
|
||||
/* } */
|
||||
//Otherwise call getChannelMembers for públic groups
|
||||
/* else{
|
||||
this.chatService.getPublicGroupMessages(this.roomId).subscribe(res=>{
|
||||
console.log(res);
|
||||
this.messages = res['messages'].reverse();
|
||||
});
|
||||
} */
|
||||
}
|
||||
|
||||
sendMessage() {
|
||||
|
||||
Reference in New Issue
Block a user