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

This commit is contained in:
Peter Maquiran
2021-08-19 18:57:00 +01:00
11 changed files with 106 additions and 67 deletions
+8 -4
View File
@@ -3,7 +3,7 @@
</ion-header> </ion-header>
<ion-content class="height-100"> <ion-content class="height-100">
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh()"> <ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar> <ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<ion-refresher-content> <ion-refresher-content>
</ion-refresher-content> </ion-refresher-content>
@@ -23,7 +23,7 @@
<button class="btn-no-color" (click)="openNewGroupPage()"> <button class="btn-no-color" (click)="openNewGroupPage()">
<ion-icon slot="end" src="assets/images/icons-chat-new-group.svg" ></ion-icon> <ion-icon slot="end" src="assets/images/icons-chat-new-group.svg" ></ion-icon>
</button> </button>
<button *ngIf="hideRefreshBtn" class="btn-no-color" (click)="doRefresh()"> <button *ngIf="hideRefreshBtn" class="btn-no-color" (click)="refreshing()">
<ion-icon class="title-icon" name="reload-circle"></ion-icon> <ion-icon class="title-icon" name="reload-circle"></ion-icon>
</button> </button>
</div> </div>
@@ -53,9 +53,13 @@
class="item-content flex-grow-1"><!-- (click)="openMessages(dm)" --> class="item-content flex-grow-1"><!-- (click)="openMessages(dm)" -->
<div class="item-title-time"> <div class="item-title-time">
<div class="item-title" [class.item-title-active]="dm._id == idSelected"> <div class="item-title" [class.item-title-active]="dm._id == idSelected">
<ion-label *ngFor="let user of dm.usernames"> <ion-label *ngFor="let user of dm.uids">
<span *ngIf="user !=loggedUserChat.me.username"> <span *ngIf="user !=loggedUserChat.me.username">
{{user}} <div *ngFor="let t of dmUsers">
<div *ngIf="user == t._id">
{{t.name}}
</div>
</div>
</span> </span>
</ion-label> </ion-label>
</div> </div>
+27 -11
View File
@@ -52,7 +52,7 @@ export class ChatPage implements OnInit {
userChannels: any[]; userChannels: any[];
userDirectMessages: any[]; userDirectMessages: any[];
result:any; result:any;
dmUsers:any; dmUsers:any[] = [];
idSelected: string; idSelected: string;
desktopComponent: any = { desktopComponent: any = {
@@ -137,18 +137,19 @@ export class ChatPage implements OnInit {
/* Fim websocket functions */ /* Fim websocket functions */
this.hideRefreshButton(); this.hideRefreshButton();
this.getChatMembers();
} }
hideRefreshButton(){ hideRefreshButton(){
window.onresize = (event) => { window.onresize = (event) => {
if( window.innerWidth < 801) { if( window.innerWidth < 701) {
this.hideRefreshBtn = false; this.hideRefreshBtn = false;
} }
else{ else{
this.hideRefreshBtn = true; this.hideRefreshBtn = true;
} }
} }
if(window.innerWidth < 801){ if(window.innerWidth < 701){
console.log('YASS'); console.log('YASS');
this.hideRefreshBtn = false; this.hideRefreshBtn = false;
} }
@@ -244,7 +245,7 @@ hideRefreshButton(){
this.idSelected = rid; this.idSelected = rid;
console.log(rid); console.log(rid);
if( window.innerWidth < 801){ if( window.innerWidth < 701){
this.openGroupMessagesModal(rid); this.openGroupMessagesModal(rid);
} }
else{ else{
@@ -265,7 +266,7 @@ hideRefreshButton(){
} }
}); });
this.closeAllDesktopComponents(); this.closeAllDesktopComponents();
if(window.innerWidth < 801){ if(window.innerWidth < 701){
console.log('Mobile'); console.log('Mobile');
} }
else{ else{
@@ -310,9 +311,18 @@ hideRefreshButton(){
onSegmentChange(){ onSegmentChange(){
this.load(); this.load();
} }
doRefresh(){
doRefresh(event){
setTimeout(() => {
this.load();
event.target.complete();
}, 1000);
}
refreshing(){
this.load(); this.load();
} }
load(){ load(){
switch (this.segment) switch (this.segment)
{ {
@@ -346,11 +356,17 @@ hideRefreshButton(){
}); });
console.log(this.userDirectMessages); console.log(this.userDirectMessages);
this.showLoader = false; this.showLoader = false;
}); });
} }
getChatMembers(){
this.chatService.getMembers(this.userDirectMessages[0]._id).subscribe(res=> { async getChatMembers(){
this.dmUsers = res['members'].filter(data => data.username != this.loggedUserChat.me.username) //return await this.chatService.getMembers(roomId).toPromise();
this.chatService.getAllUsers().subscribe(res=> {
console.log(res);
this.dmUsers = res['users'].filter(data => data.username != this.loggedUserChat.me.username);
console.log(this.dmUsers);
}); });
} }
getGroups(){ getGroups(){
@@ -411,7 +427,7 @@ hideRefreshButton(){
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: MessagesPage, component: MessagesPage,
cssClass: 'modal modal-desktop', cssClass: 'modal modal-desktop messagesChatOpened',
componentProps: { componentProps: {
roomId: roomId, roomId: roomId,
}, },
@@ -426,7 +442,7 @@ hideRefreshButton(){
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: GroupMessagesPage, component: GroupMessagesPage,
cssClass: 'modal modal-desktop', cssClass: 'modal modal-desktop groupChatOpened',
componentProps: { componentProps: {
roomId: roomId, roomId: roomId,
}, },
@@ -16,7 +16,7 @@
</ion-toolbar> </ion-toolbar>
<ion-toolbar class="toolbar-search"> <ion-toolbar class="toolbar-search">
<div class="search"> <div class="search">
<ion-searchbar debounce="500" (ionChange)="onChange($event)" placeholder="Pesquisar por cantacto" ></ion-searchbar> <ion-searchbar debounce="500" (ionChange)="onChange($event)" placeholder="Pesquisar por contacto" ></ion-searchbar>
</div> </div>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
@@ -113,6 +113,7 @@ export class GroupMessagesPage implements OnInit, AfterViewChecked {
}); });
} }
} }
loadGroupMessages(room:any){ loadGroupMessages(room:any){
this.showLoader = true; this.showLoader = true;
//If group is private call getGroupMembers //If group is private call getGroupMembers
@@ -266,9 +267,12 @@ export class GroupMessagesPage implements OnInit, AfterViewChecked {
if(this.route.url != "/home/chat"){ if(this.route.url != "/home/chat"){
console.log("Timer message stop") console.log("Timer message stop")
} else { } else {
await new Promise(resolve => setTimeout(resolve, 1000)); //Check if modal is opened
await this.serverLongPull(); if(document.querySelector('.groupChatOpened')){
console.log('Timer message running') await new Promise(resolve => setTimeout(resolve, 1000));
await this.serverLongPull();
console.log('Timer message running')
}
} }
} else { } else {
@@ -15,7 +15,7 @@
</ion-toolbar> </ion-toolbar>
<ion-toolbar class="toolbar-search"> <ion-toolbar class="toolbar-search">
<div class="search"> <div class="search">
<ion-searchbar debounce="500" (ionChange)="onChange($event)" placeholder="Pesquisar por cantacto" ></ion-searchbar> <ion-searchbar debounce="500" (ionChange)="onChange($event)" placeholder="Pesquisar por contacto" ></ion-searchbar>
</div> </div>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
+6 -3
View File
@@ -187,9 +187,12 @@ export class MessagesPage implements OnInit, AfterViewChecked {
if(this.route.url != "/home/chat"){ if(this.route.url != "/home/chat"){
console.log("Timer message stop") console.log("Timer message stop")
} else { } else {
await new Promise(resolve => setTimeout(resolve, 1000)); //Check if modal is opened
await this.serverLongPull(); if(document.querySelector('.messagesChatOpened')){
console.log('Timer message running') await new Promise(resolve => setTimeout(resolve, 1000));
await this.serverLongPull();
console.log('Timer message running')
}
} }
} else { } else {
@@ -16,7 +16,7 @@
</ion-toolbar> </ion-toolbar>
<ion-toolbar class="toolbar-search"> <ion-toolbar class="toolbar-search">
<div class="search"> <div class="search">
<ion-searchbar (ionChange)="onChange($event)" placeholder="Pesquisar por cantacto" ></ion-searchbar> <ion-searchbar (ionChange)="onChange($event)" placeholder="Pesquisar por contacto" ></ion-searchbar>
</div> </div>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
+12
View File
@@ -128,6 +128,18 @@ export class ChatService {
} }
return this.http.get(environment.apiChatUrl+'im.members', opts); return this.http.get(environment.apiChatUrl+'im.members', opts);
} }
getMemberInfo(userId:string){
let params = new HttpParams();
params = params.set("userId", userId);
let opts = {
headers: this.headers,
params: params
}
return this.http.get(environment.apiChatUrl+'users.info', opts);
}
removeChatRoom(body:any){ removeChatRoom(body:any){
let opts = { let opts = {
headers: this.headers, headers: this.headers,
@@ -20,7 +20,7 @@
</ion-toolbar> </ion-toolbar>
<ion-toolbar class="toolbar-search"> <ion-toolbar class="toolbar-search">
<div class="search"> <div class="search">
<ion-searchbar debounce="500" (ionChange)="onChange($event)" placeholder="Pesquisar por cantacto" ></ion-searchbar> <ion-searchbar debounce="500" (ionChange)="onChange($event)" placeholder="Pesquisar por contacto" ></ion-searchbar>
</div> </div>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
@@ -13,7 +13,7 @@
</ion-toolbar> </ion-toolbar>
<ion-toolbar class="toolbar-search"> <ion-toolbar class="toolbar-search">
<div class="search"> <div class="search">
<ion-searchbar debounce="500" (ionChange)="onChange($event)" placeholder="Pesquisar por cantacto" ></ion-searchbar> <ion-searchbar debounce="500" (ionChange)="onChange($event)" placeholder="Pesquisar por contacto" ></ion-searchbar>
</div> </div>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
@@ -16,7 +16,7 @@
</ion-toolbar> </ion-toolbar>
<ion-toolbar class="toolbar-search"> <ion-toolbar class="toolbar-search">
<div class="search"> <div class="search">
<ion-searchbar (ionChange)="onChange($event)" placeholder="Pesquisar por cantacto" ></ion-searchbar> <ion-searchbar (ionChange)="onChange($event)" placeholder="Pesquisar por contacto" ></ion-searchbar>
</div> </div>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>