mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
add show total users in rocket chat server
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Socket } from 'ngx-socket-io';
|
||||
import { ToastController } from '@ionic/angular';
|
||||
import { WebsocketService } from 'src/app/services/websocket.service';
|
||||
import { fromEvent } from 'rxjs';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { ChatService } from 'src/app/services/chat.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-chat',
|
||||
@@ -10,43 +8,32 @@ import { fromEvent } from 'rxjs';
|
||||
styleUrls: ['./chat.page.scss'],
|
||||
})
|
||||
export class ChatPage implements OnInit {
|
||||
loggedUser: any;
|
||||
/* Set segment variable */
|
||||
segment:string;
|
||||
groupList: any[];
|
||||
result:any;
|
||||
|
||||
message = '';
|
||||
messages = [];
|
||||
currentUser = '';
|
||||
|
||||
constructor(private websocket:WebsocketService, private socket: Socket) { }
|
||||
constructor(
|
||||
private chatService: ChatService,
|
||||
private authService: AuthService) { }
|
||||
|
||||
ngOnInit() {
|
||||
console.log("ON");
|
||||
this.socket.connect();
|
||||
|
||||
/* Set current user */
|
||||
let name = `User-${new Date().getTime()}`;
|
||||
this.currentUser=name;
|
||||
|
||||
this.socket.emit('set-name', name);
|
||||
|
||||
/* Reat from event calling "fromEvent" */
|
||||
this.socket.fromEvent('users-changed').subscribe(data =>{
|
||||
console.log('gOT data:', data);
|
||||
this.segment = "Contactos";
|
||||
this.authService.userData$.subscribe((res:any)=>{
|
||||
this.loggedUser=res;
|
||||
});
|
||||
|
||||
/* Add message to the array of messages */
|
||||
this.socket.fromEvent('message').subscribe(message =>{
|
||||
console.log('New:', message);
|
||||
this.messages.push(message);
|
||||
/* this.getGroups(); */
|
||||
}
|
||||
onSegmentChange(){
|
||||
this.RefreshEvents();
|
||||
}
|
||||
RefreshEvents(){}
|
||||
/* getGroups(){
|
||||
this.result = this.chatService.getPrivateGroups().subscribe((res:any)=>{
|
||||
this.groupList = res.users;
|
||||
console.log(this.groupList);
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
sendMessage(){
|
||||
this.socket.emit('send-message', {text: this.message});
|
||||
this.message="";
|
||||
}
|
||||
|
||||
ionViewWillLeave(){
|
||||
this.socket.disconnect();
|
||||
}
|
||||
|
||||
} */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user