fix merge

This commit is contained in:
Peter Maquiran
2022-01-28 16:26:21 +01:00
23 changed files with 596 additions and 423 deletions
@@ -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,11 +106,13 @@ 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();
this.wsChatMethodsService.getGroupRoom(this.roomId).getMsgFromDB();
console.log('MESSAGES'+this.wsChatMethodsService.getGroupRoom(this.roomId).massages);
console.log('MESSAGES'+ this.wsChatMethodsService.getGroupRoom(this.roomId).messages);
this.wsChatMethodsService.getGroupRoom(this.roomId).scrollDown = this.scrollToBottomClicked
setTimeout(()=>{
@@ -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();
@@ -259,6 +263,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) {
@@ -293,42 +298,20 @@ 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() {
this.wsChatMethodsService.getGroupRoom(this.roomId).send()
}
deleteMessage(msgId: string) {
let body = {
"roomId": this.roomId,
"msgId": msgId,
"asUser": false,
}
this.alertService.confirmDeleteMessage(body);
deleteMessage(msgId: string, room:any) {
this.alertService.confirmDeleteMessage(msgId, room);
}
async openGroupMessagesOptions() {