This commit is contained in:
Tiago Kayaya
2020-11-03 11:52:21 +01:00
parent 21eb3d3cf1
commit 6f753b6a75
3 changed files with 43 additions and 17 deletions
+30 -6
View File
@@ -1,6 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { AuthService } from 'src/app/services/auth.service';
import { ChatService } from 'src/app/services/chat.service';
import { ConversationPage } from './conversation/conversation.page';
@Component({
selector: 'app-chat',
@@ -12,10 +14,12 @@ export class ChatPage implements OnInit {
/* Set segment variable */
segment:string;
groupList: any[];
userConnectedList: any[];
result:any;
constructor(
private chatService: ChatService,
private modalController: ModalController,
private authService: AuthService) { }
ngOnInit() {
@@ -23,17 +27,37 @@ export class ChatPage implements OnInit {
this.authService.userData$.subscribe((res:any)=>{
this.loggedUser=res;
});
/* this.getGroups(); */
this.getGroups();
this.getConnectedUsers();
}
onSegmentChange(){
this.RefreshEvents();
}
RefreshEvents(){}
/* getGroups(){
this.result = this.chatService.getPrivateGroups().subscribe((res:any)=>{
this.groupList = res.users;
console.log(this.groupList);
getGroups(){
this.result = this.chatService.getAllPrivateGroups().subscribe((res:any)=>{
this.groupList = res.groups;
/* console.log(this.groupList); */
});
}
getConnectedUsers(){
this.result = this.chatService.getAllConnectedUsers().subscribe((res:any)=>{
this.userConnectedList = res.users;
console.log(this.userConnectedList);
});
}
async starConversation(selectedUser) {
const modal = await this.modalController.create({
component: ConversationPage,
cssClass: 'conversation',
backdropDismiss: false,
componentProps: {
user: selectedUser,
}
});
} */
await modal.present();
modal.onDidDismiss();
}
}