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-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-refresher-content>
</ion-refresher-content>
@@ -23,7 +23,7 @@
<button class="btn-no-color" (click)="openNewGroupPage()">
<ion-icon slot="end" src="assets/images/icons-chat-new-group.svg" ></ion-icon>
</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>
</button>
</div>
@@ -53,9 +53,13 @@
class="item-content flex-grow-1"><!-- (click)="openMessages(dm)" -->
<div class="item-title-time">
<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">
{{user}}
<div *ngFor="let t of dmUsers">
<div *ngIf="user == t._id">
{{t.name}}
</div>
</div>
</span>
</ion-label>
</div>
+27 -11
View File
@@ -52,7 +52,7 @@ export class ChatPage implements OnInit {
userChannels: any[];
userDirectMessages: any[];
result:any;
dmUsers:any;
dmUsers:any[] = [];
idSelected: string;
desktopComponent: any = {
@@ -137,18 +137,19 @@ export class ChatPage implements OnInit {
/* Fim websocket functions */
this.hideRefreshButton();
this.getChatMembers();
}
hideRefreshButton(){
window.onresize = (event) => {
if( window.innerWidth < 801) {
if( window.innerWidth < 701) {
this.hideRefreshBtn = false;
}
else{
this.hideRefreshBtn = true;
}
}
if(window.innerWidth < 801){
if(window.innerWidth < 701){
console.log('YASS');
this.hideRefreshBtn = false;
}
@@ -244,7 +245,7 @@ hideRefreshButton(){
this.idSelected = rid;
console.log(rid);
if( window.innerWidth < 801){
if( window.innerWidth < 701){
this.openGroupMessagesModal(rid);
}
else{
@@ -265,7 +266,7 @@ hideRefreshButton(){
}
});
this.closeAllDesktopComponents();
if(window.innerWidth < 801){
if(window.innerWidth < 701){
console.log('Mobile');
}
else{
@@ -310,9 +311,18 @@ hideRefreshButton(){
onSegmentChange(){
this.load();
}
doRefresh(){
doRefresh(event){
setTimeout(() => {
this.load();
event.target.complete();
}, 1000);
}
refreshing(){
this.load();
}
load(){
switch (this.segment)
{
@@ -346,11 +356,17 @@ hideRefreshButton(){
});
console.log(this.userDirectMessages);
this.showLoader = false;
});
}
getChatMembers(){
this.chatService.getMembers(this.userDirectMessages[0]._id).subscribe(res=> {
this.dmUsers = res['members'].filter(data => data.username != this.loggedUserChat.me.username)
async getChatMembers(){
//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(){
@@ -411,7 +427,7 @@ hideRefreshButton(){
const modal = await this.modalController.create({
component: MessagesPage,
cssClass: 'modal modal-desktop',
cssClass: 'modal modal-desktop messagesChatOpened',
componentProps: {
roomId: roomId,
},
@@ -426,7 +442,7 @@ hideRefreshButton(){
const modal = await this.modalController.create({
component: GroupMessagesPage,
cssClass: 'modal modal-desktop',
cssClass: 'modal modal-desktop groupChatOpened',
componentProps: {
roomId: roomId,
},
@@ -16,7 +16,7 @@
</ion-toolbar>
<ion-toolbar class="toolbar-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>
</ion-toolbar>
</ion-header>
@@ -27,9 +27,9 @@
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher>
<div class="main-content">
<div *ngIf="members">
@@ -49,7 +49,7 @@
</div>
<ion-virtual-scroll [items]="users | filter:textSearch: 'name'" approxItemHeight="70px" [headerFn]="separateLetter">
<div class="item-divider" *virtualHeader="let header">
<ion-label>{{header}}</ion-label>
</div>
@@ -59,8 +59,8 @@
<p>{{user.name}}</p>
<ion-icon class="{{user.status}}" name="ellipse"></ion-icon>
</div>
</ion-virtual-scroll>
</div>
</div>
</ion-content>
@@ -113,6 +113,7 @@ export class GroupMessagesPage implements OnInit, AfterViewChecked {
});
}
}
loadGroupMessages(room:any){
this.showLoader = true;
//If group is private call getGroupMembers
@@ -266,9 +267,12 @@ export class GroupMessagesPage implements OnInit, AfterViewChecked {
if(this.route.url != "/home/chat"){
console.log("Timer message stop")
} else {
await new Promise(resolve => setTimeout(resolve, 1000));
await this.serverLongPull();
console.log('Timer message running')
//Check if modal is opened
if(document.querySelector('.groupChatOpened')){
await new Promise(resolve => setTimeout(resolve, 1000));
await this.serverLongPull();
console.log('Timer message running')
}
}
} else {
@@ -15,7 +15,7 @@
</ion-toolbar>
<ion-toolbar class="toolbar-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>
</ion-toolbar>
</ion-header>
@@ -27,9 +27,9 @@
</ion-refresher-content>
</ion-refresher>
<div class="main-content">
<ion-virtual-scroll [items]="users | filter:textSearch: 'name'" approxItemHeight="70px" [headerFn]="separateLetter">
<div class="item-divider" *virtualHeader="let header">
<ion-label>{{header}}</ion-label>
</div>
@@ -39,10 +39,10 @@
<span class="icon">
<ion-icon class="{{user.status}}" slot="end" name="ellipse"></ion-icon>
</span>
</div>
</ion-virtual-scroll>
</div>
</div>
</ion-content>
+6 -3
View File
@@ -187,9 +187,12 @@ export class MessagesPage implements OnInit, AfterViewChecked {
if(this.route.url != "/home/chat"){
console.log("Timer message stop")
} else {
await new Promise(resolve => setTimeout(resolve, 1000));
await this.serverLongPull();
console.log('Timer message running')
//Check if modal is opened
if(document.querySelector('.messagesChatOpened')){
await new Promise(resolve => setTimeout(resolve, 1000));
await this.serverLongPull();
console.log('Timer message running')
}
}
} else {
@@ -16,7 +16,7 @@
</ion-toolbar>
<ion-toolbar class="toolbar-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>
</ion-toolbar>
</ion-header>
@@ -28,7 +28,7 @@
</ion-refresher-content>
</ion-refresher>
<div class="main-content">
<!-- <ion-list>
<ion-item *ngFor="let user of searchedItem">
{{user.name}}
@@ -36,7 +36,7 @@
</ion-list> -->
<ion-virtual-scroll [items]="users" approxItemHeight="70px" [headerFn]="separateLetter">
<div class="item-divider" *virtualHeader="let header">
<ion-label>{{header}}</ion-label>
</div>
@@ -46,10 +46,10 @@
<p>{{user.first}} {{user.last}}</p>
<ion-icon name="ellipse"></ion-icon>
</div>
</ion-virtual-scroll>
</div>
</div>
</ion-content>
+17 -5
View File
@@ -128,6 +128,18 @@ export class ChatService {
}
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){
let opts = {
headers: this.headers,
@@ -247,9 +259,9 @@ export class ChatService {
console.log('Subcrive')
let params = new HttpParams();
params = params.set("roomId", roomId);
let opts = {
headers: this.headers,
params: params
let opts = {
headers: this.headers,
params: params
}
this.http.get(environment.apiChatUrl+'im.messages', opts).subscribe(async res => {
@@ -275,8 +287,8 @@ export class ChatService {
}
})
}
}
@@ -20,7 +20,7 @@
</ion-toolbar>
<ion-toolbar class="toolbar-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>
</ion-toolbar>
</ion-header>
@@ -31,7 +31,7 @@
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher>
<div class="main-content width-100">
<div class="members" *ngIf="members">
<ion-label class="members-label">Contactos selecção:</ion-label>
@@ -48,7 +48,7 @@
</div>
<ion-virtual-scroll [items]="users | filter:textSearch: 'name'" approxItemHeight="70px" [headerFn]="separateLetter">
<div class="item-divider" *virtualHeader="let header">
<ion-label>{{header}}</ion-label>
</div>
@@ -58,8 +58,8 @@
<ion-label>{{user.name}}</ion-label>
<div class="icon"><ion-icon class="{{user.status}}" name="ellipse"></ion-icon></div>
</div>
</ion-virtual-scroll>
</div>
</div>
</ion-content>
@@ -13,13 +13,13 @@
</ion-toolbar>
<ion-toolbar class="toolbar-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>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<ion-refresher-content>
@@ -27,9 +27,9 @@
</ion-refresher>
<div class="main-content">
<ion-virtual-scroll [items]="users| filter:textSearch: 'name'" approxItemHeight="70px" [headerFn]="separateLetter">
<div class="item-divider" *virtualHeader="let header">
<ion-label>{{header}}</ion-label>
</div>
@@ -39,10 +39,10 @@
<span class="icon">
<ion-icon class="{{user.status}}" slot="end" name="ellipse"></ion-icon>
</span>
</div>
</ion-virtual-scroll>
</div>
</div>
</ion-content>
@@ -16,7 +16,7 @@
</ion-toolbar>
<ion-toolbar class="toolbar-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>
</ion-toolbar>
</ion-header>
@@ -28,7 +28,7 @@
</ion-refresher-content>
</ion-refresher>
<div class="main-content">
<!-- <ion-list>
<ion-item *ngFor="let user of searchedItem">
{{user.name}}
@@ -36,7 +36,7 @@
</ion-list> -->
<ion-virtual-scroll [items]="users" approxItemHeight="70px" [headerFn]="separateLetter">
<div class="item-divider" *virtualHeader="let header">
<ion-label>{{header}}</ion-label>
</div>
@@ -46,10 +46,10 @@
<p>{{user.first}} {{user.last}}</p>
<ion-icon name="ellipse"></ion-icon>
</div>
</ion-virtual-scroll>
</div>
</div>
</ion-content>