mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
Merge branch 'chatSessonExpire' of https://bitbucket.org/equilibriumito/gabinete-digital into developer
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { ModalController, PickerController } from '@ionic/angular';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
@@ -33,6 +34,7 @@ export class EditGroupPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.chatService.refreshtoken();
|
||||
this.getRoomInfo();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { ModalController, NavParams } from '@ionic/angular';
|
||||
import * as _ from 'lodash';
|
||||
@@ -57,6 +57,7 @@ export class GroupContactsPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.chatService.refreshtoken();
|
||||
//this.getRoomInfo();
|
||||
this.loadUsers();
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import { AlertController } from '@ionic/angular';
|
||||
import { File } from '@awesome-cordova-plugins/file/ngx';
|
||||
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
|
||||
|
||||
/*
|
||||
@@ -74,6 +75,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
scrollToBottomBtn = false;
|
||||
roomCountDownDate: string;
|
||||
roomCountDownTime: string;
|
||||
isAdmin = false;
|
||||
|
||||
@Input() roomId: string;
|
||||
@Output() closeAllDesktopComponents: EventEmitter<any> = new EventEmitter<any>();
|
||||
@@ -159,10 +161,11 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.chatService.refreshtoken();
|
||||
console.log(this.roomId)
|
||||
this.loggedUser = this.loggedUserChat;
|
||||
//setTimeout(() => {
|
||||
this.getRoomInfo();
|
||||
this.getRoomInfo()
|
||||
//}, 1000);
|
||||
this.getChatMembers();
|
||||
//this.getMessageDB();
|
||||
@@ -399,10 +402,18 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
async getRoomInfo() {
|
||||
this.wsChatMethodsService.getGroupRoom(this.roomId).loadHistory({});
|
||||
let room = await this.chatService.getRoomInfo(this.roomId).toPromise();
|
||||
console.log('ROOM',room)
|
||||
this.room = room['room'];
|
||||
if (this.room.name) {
|
||||
this.roomName = this.room.name.split('-').join(' ');
|
||||
}
|
||||
|
||||
|
||||
if(SessionStore.user.ChatData.data.userId == this.room.u._id){
|
||||
this.isAdmin = true
|
||||
} else {
|
||||
this.isAdmin = false
|
||||
}
|
||||
|
||||
if (this.room.customFields.countDownDate) {
|
||||
this.roomCountDownDate = this.room.customFields.countDownDate;
|
||||
@@ -501,82 +512,84 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
}
|
||||
|
||||
async openGroupMessagesOptions() {
|
||||
|
||||
const enterAnimation = (baseEl: any) => {
|
||||
const backdropAnimation = this.animationController.create()
|
||||
.addElement(baseEl.querySelector('ion-backdrop')!)
|
||||
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
|
||||
|
||||
const wrapperAnimation = this.animationController.create()
|
||||
.addElement(baseEl.querySelector('.modal-wrapper')!)
|
||||
.keyframes([
|
||||
{ offset: 0, opacity: '1', right: '-100%' },
|
||||
{ offset: 1, opacity: '1', right: '0px' }
|
||||
]);
|
||||
|
||||
return this.animationController.create()
|
||||
.addElement(baseEl)
|
||||
.easing('ease-out')
|
||||
.duration(500)
|
||||
.addAnimation([backdropAnimation, wrapperAnimation]);
|
||||
}
|
||||
|
||||
const leaveAnimation = (baseEl: any) => {
|
||||
return enterAnimation(baseEl).direction('reverse');
|
||||
}
|
||||
|
||||
|
||||
/* const popover = await this.popoverController.create({
|
||||
component: MessagesOptionsPage,
|
||||
componentProps: {
|
||||
roomId: this.dm._id,
|
||||
},
|
||||
cssClass: 'messages-options',
|
||||
event: ev,
|
||||
translucent: true,
|
||||
});
|
||||
return await popover.present(); */
|
||||
const enterAnimation = (baseEl: any) => {
|
||||
const backdropAnimation = this.animationController.create()
|
||||
.addElement(baseEl.querySelector('ion-backdrop')!)
|
||||
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
|
||||
|
||||
const wrapperAnimation = this.animationController.create()
|
||||
.addElement(baseEl.querySelector('.modal-wrapper')!)
|
||||
.keyframes([
|
||||
{ offset: 0, opacity: '1', right: '-100%' },
|
||||
{ offset: 1, opacity: '1', right: '0px' }
|
||||
]);
|
||||
|
||||
return this.animationController.create()
|
||||
.addElement(baseEl)
|
||||
.easing('ease-out')
|
||||
.duration(500)
|
||||
.addAnimation([backdropAnimation, wrapperAnimation]);
|
||||
}
|
||||
|
||||
const leaveAnimation = (baseEl: any) => {
|
||||
return enterAnimation(baseEl).direction('reverse');
|
||||
}
|
||||
|
||||
|
||||
/* const popover = await this.popoverController.create({
|
||||
component: MessagesOptionsPage,
|
||||
componentProps: {
|
||||
roomId: this.dm._id,
|
||||
},
|
||||
cssClass: 'messages-options',
|
||||
event: ev,
|
||||
translucent: true,
|
||||
});
|
||||
return await popover.present(); */
|
||||
|
||||
|
||||
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
enterAnimation,
|
||||
leaveAnimation,
|
||||
component: ChatPopoverPage,
|
||||
cssClass: 'model profile-modal search-submodal',
|
||||
componentProps: {
|
||||
roomId: this.roomId,
|
||||
members: this.members,
|
||||
isAdmin: this.isAdmin
|
||||
}
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(res => {
|
||||
|
||||
if (res.data == 'leave') {
|
||||
this.getRoomInfo();
|
||||
this.closeAllDesktopComponents.emit();
|
||||
this.showEmptyContainer.emit();
|
||||
this.wsChatMethodsService.hidingRoom(this.roomId);
|
||||
}
|
||||
else if (res.data == 'delete') {
|
||||
this.closeAllDesktopComponents.emit();
|
||||
this.showEmptyContainer.emit();
|
||||
}
|
||||
else if (res.data == 'cancel') {
|
||||
|
||||
}
|
||||
else if (res.data == 'edit') {
|
||||
|
||||
//this.closeAllDesktopComponents.emit();
|
||||
this.openEditGroupPage.emit(this.roomId);
|
||||
}
|
||||
else {
|
||||
this.roomName = res.data.name.split('-').join(' ');
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
enterAnimation,
|
||||
leaveAnimation,
|
||||
component: ChatPopoverPage,
|
||||
cssClass: 'model profile-modal search-submodal',
|
||||
componentProps: {
|
||||
roomId: this.roomId,
|
||||
members: this.members,
|
||||
}
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(res => {
|
||||
|
||||
if (res.data == 'leave') {
|
||||
this.getRoomInfo();
|
||||
this.closeAllDesktopComponents.emit();
|
||||
this.showEmptyContainer.emit();
|
||||
this.wsChatMethodsService.hidingRoom(this.roomId);
|
||||
}
|
||||
else if (res.data == 'delete') {
|
||||
this.closeAllDesktopComponents.emit();
|
||||
this.showEmptyContainer.emit();
|
||||
}
|
||||
else if (res.data == 'cancel') {
|
||||
|
||||
}
|
||||
else if (res.data == 'edit') {
|
||||
|
||||
//this.closeAllDesktopComponents.emit();
|
||||
this.openEditGroupPage.emit(this.roomId);
|
||||
}
|
||||
else {
|
||||
this.roomName = res.data.name.split('-').join(' ');
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
openSendGroupMessageOptions(ev?: any) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
import { HttpErrorResponse, HttpHeaders } from '@angular/common/http';
|
||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
@@ -42,7 +42,9 @@ export class ContactsPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.loadUsers();
|
||||
this.chatService.refreshtoken();
|
||||
}
|
||||
|
||||
onChange(event){
|
||||
|
||||
@@ -31,6 +31,7 @@ import { AlertController, Platform } from '@ionic/angular';
|
||||
import { File } from '@awesome-cordova-plugins/file/ngx';
|
||||
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
|
||||
|
||||
const IMAGE_DIR = 'stored-images';
|
||||
@@ -154,6 +155,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.chatService.refreshtoken();
|
||||
this.scrollToBottom();
|
||||
|
||||
this.getChatMembers();
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<button (click)="leaveGroup()" class="btn-cancel" shape="round" >Sair do Grupo</button>
|
||||
<button (click)="openChangeGroupName()" class="btn-cancel" shape="round" >Alterar nome do grupo</button>
|
||||
<button *ngIf="isAdmin" (click)="openChangeGroupName()" class="btn-cancel" shape="round" >Alterar nome do grupo</button>
|
||||
<div class="solid"></div>
|
||||
<button (click)="close('cancel')" full class="btn-cancel mobile-only" shape="round" >Cancelar</button>
|
||||
<button (click)="deleteGroup()" class="btn-delete" shape="round">Apagar grupo</button>
|
||||
<button (click)="close('cancel')" full class="btn-cancel mobile-only" shape="round" >Cancelar</button>
|
||||
<button *ngIf="isAdmin" (click)="deleteGroup()" class="btn-delete" shape="round">Apagar grupo</button>
|
||||
</div>
|
||||
</ion-content>
|
||||
|
||||
@@ -5,6 +5,8 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { SetRoomOwnerPage } from 'src/app/modals/set-room-owner/set-room-owner.page';
|
||||
import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.service';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -16,6 +18,7 @@ export class ChatPopoverPage implements OnInit {
|
||||
roomId:string;
|
||||
room: any;
|
||||
members:any;
|
||||
isAdmin = false;
|
||||
|
||||
constructor(
|
||||
private popoverController: PopoverController,
|
||||
@@ -28,10 +31,11 @@ export class ChatPopoverPage implements OnInit {
|
||||
) {
|
||||
this.roomId = this.navParams.get('roomId');
|
||||
this.members = this.navParams.get('members');
|
||||
this.isAdmin = this.navParams.get('isAdmin');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.chatService.refreshtoken();
|
||||
}
|
||||
|
||||
close(action:any){
|
||||
@@ -62,6 +66,7 @@ export class ChatPopoverPage implements OnInit {
|
||||
componentProps: {
|
||||
roomId: this.roomId,
|
||||
members: this.members,
|
||||
isAdmin: this.isAdmin
|
||||
}
|
||||
});
|
||||
await modal.present();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ModalController, NavParams, PopoverController } from '@ionic/angular';
|
||||
import { ChatService } from 'src/app/services/chat.service';
|
||||
@@ -24,6 +25,7 @@ export class MessagesOptionsPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.chatService.refreshtoken();
|
||||
}
|
||||
|
||||
close(){
|
||||
|
||||
Reference in New Issue
Block a user