git pull made

This commit is contained in:
Eudes Inácio
2021-09-07 12:18:12 +01:00
148 changed files with 1885 additions and 2257 deletions
+5 -3
View File
@@ -42,7 +42,7 @@
<div class="width-100" [ngSwitch]="segment">
<ion-list *ngSwitchCase="'Contactos'">
<ion-item-sliding>
<div class="item width-100 d-flex ion-no-padding ion-no-margin"
<div class="item item-hover width-100 d-flex ion-no-padding ion-no-margin"
*ngFor="let dm of userDirectMessages"
[class.item-active]="dm._id ==idSelected">
<div class="item-icon">
@@ -76,7 +76,7 @@
<ion-item-sliding>
<div *ngFor="let group of allGroups"
[class.item-active]="group._id ==idSelected"
class="item d-flex">
class="item item-hover d-flex">
<div class="item-icon">
<ion-icon class="icon" slot="start" src="assets/images/icons-chat-group-chat-40.svg"></ion-icon>
</div>
@@ -86,7 +86,7 @@
<div class="item-title" [class.item-title-active]="group._id ==idSelected">
<ion-label>{{group.name.split('-').join(' ')}}</ion-label>
</div>
<div class="item-date" [class.item-date-active]="group._id ==idSelected" *ngIf="group.lastMessage">{{group.lastMessage._updatedAt | date: 'HH:mm'}}</div>
<div class="item-date" [class.item-date-active]="group._id ==idSelected" *ngIf="group.lastMessage">{{showDateDuration(group._updatedAt)}}</div>
</div>
<div class="item-description" [class.item-description-active]="group._id ==idSelected" *ngIf="group.lastMessage">
<ion-label>{{group.lastMessage.u.name}}: {{group.lastMessage.msg}}</ion-label>
@@ -113,6 +113,7 @@
(showEmptyContainer)="showEmptyContainer()"
(showEmptyContainer)="showEmptyContainer()"
(openNewEventPage)="openNewEventPage($event)"
(getDirectMessages)="getDirectMessages($event)"
[style.display]="showMessages ? 'flex' : 'none'"
[roomId]="roomId"
[showMessages]="showMessages" #messagecontainer>
@@ -156,6 +157,7 @@
(openGroupContacts)="openGroupContactsPage($event)"
(openEditGroupPage)="openEditGroupPage($event)"
(openNewEventPage)="openNewEventPage($event)"
(getGroups)="getGroups($event)"
[style.display]="showGroupMessages ? 'flex' : 'none'"
class=" height-100 flex-column"
[roomId]="roomId" #messagecontainer>
+1
View File
@@ -122,6 +122,7 @@ ion-content{
color: #fff;
}
}
.item-active{
color: #fff !important;
background-color: #42b9fe !important;
+15 -5
View File
@@ -120,6 +120,11 @@ export class ChatPage implements OnInit {
){
this.loggedUserChat = authService.ValidatedUserChat['data'];
this.headers = new HttpHeaders();
window.onresize = (event) => {
if( window.innerWidth > 701){
this.modalController.dismiss();
}
};
}
@@ -374,11 +379,11 @@ hideRefreshButton(){
});
}
async getDirectMessages(){
async getDirectMessages(event?){
this.chatService.getAllDirectMessages().subscribe(async (res:any)=>{
if(res.ims != 200){
if(res != 200){
console.log(res.ims);
this.userDirectMessages = res.ims.sort((a,b)=>{
var dateA = new Date(a._updatedAt).getTime();
@@ -391,12 +396,17 @@ hideRefreshButton(){
console.log("Timer message stop")
}
else {
console.log('TIMER');
//Check if modal is opened
if(this.segment == "Contactos" && this.showMessages != true){
await new Promise(resolve => setTimeout(resolve, 5000));
await new Promise(resolve => setTimeout(resolve, 2000));
await this.getDirectMessages();
console.log('Timer contactos list running')
}
else{
console.log('No timer!');
}
}
}
else{
@@ -452,7 +462,7 @@ hideRefreshButton(){
});
}
async getGroups(){
async getGroups(event?){
this.result = this.chatService.getAllPrivateGroups().subscribe(async (res:any)=>{
if(res.groups != 200){
@@ -474,7 +484,7 @@ hideRefreshButton(){
else {
//Check if modal is opened
if(this.segment == "Grupos" && this.showGroupMessages != true){
await new Promise(resolve => setTimeout(resolve, 5000));
await new Promise(resolve => setTimeout(resolve, 2000));
await this.getGroups();
console.log('Timer groups list running')
}
@@ -1,4 +1,4 @@
import { Component, ElementRef, OnInit, ViewChild, AfterViewChecked, AfterViewInit, OnDestroy } from '@angular/core';
import { Component, ElementRef, OnInit, ViewChild, AfterViewChecked, AfterViewInit, OnDestroy, } from '@angular/core';
import { ActionSheetController, MenuController, ModalController, NavParams, PopoverController } from '@ionic/angular';
import { AlertService } from 'src/app/services/alert.service';
import { AuthService } from 'src/app/services/auth.service';
@@ -10,6 +10,7 @@ import { NewGroupPage } from '../new-group/new-group.page';
import { GroupContactsPage } from './group-contacts/group-contacts.page';
import {Router} from '@angular/router'
import { EditGroupPage } from '../edit-group/edit-group.page';
import { TimeService } from 'src/app/services/functions/time.service';
@Component({
selector: 'app-group-messages',
@@ -49,11 +50,17 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
private navParams: NavParams,
private authService: AuthService,
private alertService: AlertService,
private route: Router
private route: Router,
private timeService: TimeService,
) {
this.loggedUserChat = authService.ValidatedUserChat['data'];
this.isGroupCreated = true;
this.roomId = this.navParams.get('roomId');
window.onresize = (event) => {
if( window.innerWidth > 701){
this.modalController.dismiss();
}
};
}
ngOnInit() {
@@ -173,7 +180,8 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
showDateDuration(start:any){
let end;
return this.timeService.showDateDuration(start);
/* let end;
end = new Date();
start = new Date(start);
let customizedDate;
@@ -199,7 +207,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
else{
let date = start.getDate() + "/" + (start.getMonth()+1) + "/" + start.getFullYear();
return date;
}
} */
}
addZero(i) {
+16 -1
View File
@@ -1,6 +1,7 @@
import { AfterViewChecked, AfterViewInit, Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router'
import { ModalController, NavParams, PopoverController } from '@ionic/angular';
import { map } from 'rxjs/operators';
import { ContactsPage } from 'src/app/pages/chat/messages/contacts/contacts.page';
import { AlertService } from 'src/app/services/alert.service';
import { AuthService } from 'src/app/services/auth.service';
@@ -59,6 +60,12 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}); */
this.loggedUser = authService.ValidatedUserChat['data'];
this.roomId = this.navParams.get('roomId');
window.onresize = (event) => {
if( window.innerWidth > 701){
this.modalController.dismiss();
}
};
}
ngOnInit() {
@@ -151,7 +158,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
loadMessages() {
this.showLoader = true;
const roomId = this.roomId
this.chatService.getRoomMessages(this.roomId).subscribe(res => {
/* console.log(res); */
this.messages = res['messages'].reverse();
@@ -254,9 +261,17 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
async serverLongPull() {
const roomId = this.roomId
/* this.chatService.getRoomMessages(roomId).subscribe(res=>{
console.log(res);
}) */
this.chatService.getRoomMessages(roomId).subscribe(async res => {
console.log("Chat message",res)
if (res == 502) {
// Connection timeout
// happens when the synchro was pending for too long