Merge branch 'developer' of bitbucket.org:equilibriumito/gabinete-digital into developer

This commit is contained in:
Peter Maquiran
2021-08-20 19:14:52 +01:00
+49 -16
View File
@@ -115,7 +115,7 @@ export class ChatPage implements OnInit {
private authService: AuthService,
private storage:Storage,
private resolver: ComponentFactoryResolver,
private router: Router,
private route: Router,
){
this.loggedUserChat = authService.ValidatedUserChat['data'];
this.headers = new HttpHeaders();
@@ -355,20 +355,34 @@ hideRefreshButton(){
});
}
getDirectMessages(){
this.showLoader = true;
async getDirectMessages(){
this.chatService.getAllDirectMessages().subscribe((res:any)=>{
console.log(res.ims);
this.chatService.getAllDirectMessages().subscribe(async (res:any)=>{
this.userDirectMessages = res.ims.sort((a,b)=>{
var dateA = new Date(a._updatedAt).getTime();
var dateB = new Date(b._updatedAt).getTime();
return dateB - dateA;
});
console.log(this.userDirectMessages);
this.showLoader = false;
if(res.ims != 200){
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();
return dateB - dateA;
});
console.log(this.userDirectMessages);
if(this.route.url != "/home/chat"){
console.log("Timer message stop")
}
else {
//Check if modal is opened
if(this.segment == "Contactos"){
await new Promise(resolve => setTimeout(resolve, 5000));
await this.getDirectMessages();
console.log('Timer contactos list running')
}
}
}
else{
await this.getDirectMessages();
}
});
}
@@ -418,9 +432,12 @@ hideRefreshButton(){
console.log(this.dmUsers);
});
}
getGroups(){
this.showLoader = true;
this.result = this.chatService.getAllPrivateGroups().subscribe((res:any)=>{
async getGroups(){
this.result = this.chatService.getAllPrivateGroups().subscribe(async (res:any)=>{
if(res.groups != 200){
this.privateGroups = res.groups;
/* this.result = this.chatService.getAllUserChannels().subscribe((res:any)=>{
this.publicGroups = res.channels; */
@@ -431,8 +448,24 @@ hideRefreshButton(){
return dateB - dateA;
});
console.log(this.allGroups);
this.showLoader = false;
/* }); */
if(this.route.url != "/home/chat"){
console.log("Timer message stop")
}
else {
//Check if modal is opened
if(this.segment == "Grupos"){
await new Promise(resolve => setTimeout(resolve, 5000));
await this.getGroups();
console.log('Timer groups list running')
}
}
}
else{
await this.getGroups();
}
});
}