This commit is contained in:
tiago.kayaya
2021-07-23 14:43:51 +01:00
parent 9bcc06add2
commit b5e1ad4201
17 changed files with 194 additions and 203 deletions
+22 -21
View File
@@ -1,6 +1,6 @@
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import {
Component,
import {
Component,
OnInit,
ViewChild,
ViewContainerRef,
@@ -36,7 +36,7 @@ export class ChatPage implements OnInit {
options:any;
X_User_Id:any;
X_Auth_Token:any;
loggedUser: any;
/* Set segment variable */
segment:string;
@@ -76,7 +76,7 @@ export class ChatPage implements OnInit {
/*
Websockets variables
*/
subject: any;
@@ -100,7 +100,7 @@ export class ChatPage implements OnInit {
private authService: AuthService,
private storage:Storage,
private resolver: ComponentFactoryResolver,
){
){
this.loggedUserChat = authService.ValidatedUserChat['data'];
this.headers = new HttpHeaders();
this.loadMessage();
@@ -108,7 +108,7 @@ export class ChatPage implements OnInit {
ngOnInit() {
console.log(this.loggedUserChat);
this.segment = "Contactos";
this.authService.userData$.subscribe((res:any)=>{
@@ -116,12 +116,12 @@ export class ChatPage implements OnInit {
console.log(this.loggedUser);
this.load();
});
/* websocket functions */
//this.sendMsg();
/* Fim websocket functions */
this.hideRefreshButton();
this.hideRefreshButton();
}
hideRefreshButton(){
@@ -193,7 +193,7 @@ sendMsg() {
openContactsPage() {
console.log('OK');
this.closeAllDesktopComponents();
if( window.innerWidth <= 1024){
this.selectContact();
}
@@ -222,16 +222,17 @@ sendMsg() {
}
}
openGroupMessagesPage(data) {
console.log('HERE');
openGroupMessagesPage(rid) {
console.log(rid);
if( window.innerWidth <= 1024){
this.openGroupMessagesModal(data);
this.openGroupMessagesModal(rid);
}
else{
this.closeAllDesktopComponents();
this.showEmptyComponent = false;
this.roomId = data;
this.roomId = rid;
console.log(this.roomId);
this.showGroupMessages=true;
}
}
@@ -261,13 +262,13 @@ sendMsg() {
console.log(res);
});
}
getDirectMessages(){
this.showLoader = true;
this.chatService.getAllDirectMessages().subscribe((res:any)=>{
console.log(res.ims);
this.userDirectMessages = res.ims.sort((a,b)=>{
var dateA = new Date(a._updatedAt).getTime();
var dateB = new Date(b._updatedAt).getTime();
@@ -288,7 +289,7 @@ sendMsg() {
this.privateGroups = res.groups;
this.result = this.chatService.getAllUserChannels().subscribe((res:any)=>{
this.publicGroups = res.channels;
let all = this.privateGroups.concat(this.publicGroups);
let all = this.privateGroups.concat(this.publicGroups);
this.allGroups = all.sort((a,b)=>{
var dateA = new Date(a._updatedAt).getTime();
var dateB = new Date(b._updatedAt).getTime();
@@ -297,7 +298,7 @@ sendMsg() {
console.log(this.allGroups);
this.showLoader = false;
});
});
});
}
async selectContact(){
@@ -337,7 +338,7 @@ sendMsg() {
this.closeAllDesktopComponents();
console.log(roomId);
const modal = await this.modalController.create({
component: MessagesPage,
cssClass: 'modal modal-desktop',
@@ -352,7 +353,7 @@ sendMsg() {
async openGroupMessagesModal(roomId:any){
console.log(roomId);
const modal = await this.modalController.create({
component: GroupMessagesPage,
cssClass: 'modal modal-desktop',