mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
chat retry
This commit is contained in:
@@ -22,7 +22,7 @@ export class AuthGuard implements CanActivate {
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
||||
|
||||
console.log('hire inactinity!', state.url)
|
||||
console.log('hire auth!', state.url)
|
||||
|
||||
// if user not active or no session
|
||||
if(!SessionStore.user.Inactivity || !SessionStore.exist) {
|
||||
@@ -31,6 +31,7 @@ export class AuthGuard implements CanActivate {
|
||||
this.router.navigate(['/pin']);
|
||||
} else {
|
||||
this.router.navigate(['/']);
|
||||
// console.log('goto login page')
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Observable } from 'rxjs';
|
||||
import { SessionStore } from '../store/session.service';
|
||||
import { AlertController, Platform } from '@ionic/angular';
|
||||
import { PermissionService } from '../services/permission.service';
|
||||
import { FirstEnterService } from '../services/first-enter.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -14,7 +15,8 @@ export class InactivityGuard implements CanActivate {
|
||||
private router:Router,
|
||||
private platform: Platform,
|
||||
public p: PermissionService,
|
||||
private alertController: AlertController
|
||||
private alertController: AlertController,
|
||||
private FirstEnterService: FirstEnterService
|
||||
) {}
|
||||
|
||||
canActivate(
|
||||
@@ -24,30 +26,8 @@ export class InactivityGuard implements CanActivate {
|
||||
console.log('hire inactinity!', state.url)
|
||||
|
||||
if ( (this.platform.is('desktop') || this.platform.is('mobileweb')) ) {
|
||||
if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){
|
||||
|
||||
}
|
||||
else if(this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)){
|
||||
this.router.navigate(['/home/chat']);
|
||||
}
|
||||
else if(this.p.userPermission(this.p.permissionList.Actions.access)) {
|
||||
this.router.navigate(['/home/publications']);
|
||||
} else {
|
||||
|
||||
this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Utilizador sem acesso a aplicação',
|
||||
buttons: [{
|
||||
text: 'Ok',
|
||||
handler: () => {
|
||||
|
||||
}
|
||||
}]
|
||||
}).then( async (alertPopup) => {
|
||||
await alertPopup.present();
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
this.FirstEnterService.enter()
|
||||
|
||||
return false
|
||||
} else if(SessionStore.exist && SessionStore.user.Inactivity && !SessionStore.hasPin ) {
|
||||
@@ -68,28 +48,8 @@ export class InactivityGuard implements CanActivate {
|
||||
else {
|
||||
|
||||
if((SessionStore?.user?.Inactivity)) {
|
||||
if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){
|
||||
this.router.navigate(['/home/events']);
|
||||
}
|
||||
else if(this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)){
|
||||
this.router.navigate(['/home/chat']);
|
||||
}
|
||||
else if(this.p.userPermission(this.p.permissionList.Actions.access)){
|
||||
this.router.navigate(['/home/publications']);
|
||||
} else {
|
||||
this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Utilizador sem acesso a aplicação',
|
||||
buttons: [{
|
||||
text: 'Ok',
|
||||
handler: () => {
|
||||
|
||||
}
|
||||
}]
|
||||
}).then( async (alertPopup)=>{
|
||||
await alertPopup.present();
|
||||
})
|
||||
}
|
||||
this.FirstEnterService.enter()
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,11 @@ import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
import { AuthGuard } from '../guards/auth.guard';
|
||||
import { InactivityGuard } from '../guards/inactivity.guard';
|
||||
import { AgendaPageModule } from '../pages/agenda/agenda.module';
|
||||
import { ChatPageModule } from '../pages/chat/chat.module';
|
||||
import { EventsPageModule } from '../pages/events/events.module';
|
||||
import { GabineteDigitalPageModule } from '../pages/gabinete-digital/gabinete-digital.module';
|
||||
import { PublicationsPageModule } from '../pages/publications/publications.module';
|
||||
import { UserDataResolver } from '../resolvers/userData.resolver';
|
||||
import { HomePage } from './home.page';
|
||||
|
||||
@@ -18,7 +23,7 @@ const routes: Routes = [
|
||||
children: [
|
||||
{
|
||||
path:'',
|
||||
loadChildren: ()=> import('../pages/events/events.module').then(m => m.EventsPageModule)
|
||||
loadChildren: ()=> EventsPageModule
|
||||
},
|
||||
{
|
||||
path:':eventId/:caller',
|
||||
@@ -80,7 +85,7 @@ const routes: Routes = [
|
||||
children: [
|
||||
{
|
||||
path:'',
|
||||
loadChildren: ()=> import('../pages/agenda/agenda.module').then(m => m.AgendaPageModule)
|
||||
loadChildren: () => AgendaPageModule
|
||||
},
|
||||
{
|
||||
path:':eventId/:caller',
|
||||
@@ -128,7 +133,7 @@ const routes: Routes = [
|
||||
children: [
|
||||
{
|
||||
path:'',
|
||||
loadChildren: ()=> import('../pages/gabinete-digital/gabinete-digital.module').then(m => m.GabineteDigitalPageModule)
|
||||
loadChildren: ()=> GabineteDigitalPageModule
|
||||
},
|
||||
{
|
||||
path:'expediente',
|
||||
@@ -290,7 +295,7 @@ const routes: Routes = [
|
||||
children: [
|
||||
{
|
||||
path:'',
|
||||
loadChildren: ()=> import('../pages/publications/publications.module').then(m => m.PublicationsPageModule)
|
||||
loadChildren: ()=> PublicationsPageModule
|
||||
},
|
||||
{
|
||||
path:':folderId',
|
||||
@@ -321,7 +326,7 @@ const routes: Routes = [
|
||||
children: [
|
||||
{
|
||||
path:'',
|
||||
loadChildren: ()=> import('../pages/chat/chat.module').then(m => m.ChatPageModule)
|
||||
loadChildren: ()=> ChatPageModule
|
||||
},
|
||||
{
|
||||
path:'messages',
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Event } from '../models/event.model';
|
||||
import { NotificationsService } from '../services/notifications.service';
|
||||
@@ -97,7 +95,7 @@ export class HomePage implements OnInit {
|
||||
this.router.events.subscribe((val) => {
|
||||
document.querySelectorAll('ion-modal').forEach((e: any) => e.remove())
|
||||
document.querySelectorAll('popover-viewport').forEach((e: any) => e.remove())
|
||||
document.querySelectorAll('.notification').forEach((e: any) => e.remove())
|
||||
document.querySelectorAll('.loading-blocker').forEach((e: any) => e.remove())
|
||||
});
|
||||
|
||||
window['platform'] = platform
|
||||
|
||||
@@ -9,6 +9,7 @@ export class MessageModel extends models.Model {
|
||||
channels = ArrayField()
|
||||
mentions = ArrayField()
|
||||
msg = models.CharField()
|
||||
sendAttempt = models.IntegerField()
|
||||
rid = models.CharField()
|
||||
ts = JsonField({blank:true})
|
||||
u = JsonField()
|
||||
@@ -37,7 +38,7 @@ export class DeleteMessageModel extends models.Model {
|
||||
models.register({
|
||||
databaseName: 'chat-storage',
|
||||
type: 'indexedDB',
|
||||
version: 4,
|
||||
version: 5,
|
||||
models: [MessageModel, DeleteMessageModel]
|
||||
})
|
||||
|
||||
|
||||
@@ -63,10 +63,11 @@
|
||||
|
||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||
|
||||
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
</ion-label>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
@@ -101,10 +102,11 @@
|
||||
<img *ngIf="msg.attachments[0].image_url" src="{{msg.attachments[0].image_url}}" alt="image" >
|
||||
<ion-icon *ngIf="msg.attachments[0].image_url == null" name="download-outline"></ion-icon>
|
||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
</ion-label>
|
||||
</div>
|
||||
<div *ngIf="msg.file.type != 'application/img'">
|
||||
@@ -158,6 +160,7 @@
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
</ion-label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -387,3 +387,11 @@
|
||||
.float-status-all {
|
||||
font-size: 10pt !important;
|
||||
}
|
||||
|
||||
.try {
|
||||
color: red;
|
||||
background: #f3414159;
|
||||
padding: 6px;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -60,10 +60,11 @@
|
||||
|
||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||
|
||||
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
</ion-label>
|
||||
</div>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
@@ -96,10 +97,11 @@
|
||||
<img *ngIf="msg.attachments[0].image_url" src="{{msg.attachments[0].image_url}}" alt="image">
|
||||
|
||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
</ion-label>
|
||||
|
||||
</div>
|
||||
@@ -161,10 +163,11 @@
|
||||
|
||||
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
|
||||
<!-- <span *ngIf="msg.messageSend == false" >{{ msg.sendAttempt }}</span> -->
|
||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
</ion-label>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -356,3 +356,11 @@ button::-moz-focus-inner {
|
||||
.float-status-all {
|
||||
font-size: 10pt !important;
|
||||
}
|
||||
|
||||
.try {
|
||||
color: red;
|
||||
background: #f3414159;
|
||||
padding: 6px;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -280,9 +280,11 @@ export class EventsPage implements OnInit {
|
||||
}
|
||||
})
|
||||
this.listToPresent = todayEvents
|
||||
this.totalEvent = this.listToPresent.length
|
||||
this.currentEvent = this.listToPresent[0].Subject
|
||||
this.currentHoursMinutes = this.listToPresent[0].StartDate
|
||||
if(this.listToPresent?.length) {
|
||||
this.totalEvent = this.listToPresent.length
|
||||
this.currentEvent = this.listToPresent[0].Subject
|
||||
this.currentHoursMinutes = this.listToPresent[0].StartDate
|
||||
}
|
||||
//
|
||||
})
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-co
|
||||
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
|
||||
import { ChatService } from 'src/app/services/chat.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
|
||||
import { FirstEnterService } from '../../services/first-enter.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
@@ -52,10 +52,13 @@ export class LoginPage implements OnInit {
|
||||
public ChatSystemService: ChatSystemService,
|
||||
private ChatService: ChatService,
|
||||
private platform: Platform,
|
||||
) {}
|
||||
private FirstEnterService: FirstEnterService
|
||||
) {
|
||||
console.log('constructor')
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
console.log('ngOngInit')
|
||||
}
|
||||
|
||||
togglePassword() {
|
||||
@@ -68,7 +71,6 @@ export class LoginPage implements OnInit {
|
||||
}
|
||||
|
||||
}
|
||||
//
|
||||
|
||||
//Function to validade the login inputs
|
||||
validateUsername() {
|
||||
@@ -134,7 +136,7 @@ export class LoginPage implements OnInit {
|
||||
}
|
||||
|
||||
this.changeProfileService.runLogin();
|
||||
this.getToken();
|
||||
// this.getToken();
|
||||
SessionStore.setInativity(true);
|
||||
|
||||
this.goback();
|
||||
@@ -160,7 +162,7 @@ export class LoginPage implements OnInit {
|
||||
this.ChatSystemService.loadChat();
|
||||
}
|
||||
|
||||
this.getToken();
|
||||
// this.getToken();
|
||||
|
||||
if(!this.platform.is('desktop') && !this.platform.is('mobileweb')) {
|
||||
if(this.sessionStore.hasPin) {
|
||||
@@ -196,22 +198,7 @@ export class LoginPage implements OnInit {
|
||||
if(pathName) {
|
||||
this.router.navigate([pathName]);
|
||||
} else {
|
||||
if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){
|
||||
//When user has got access to Agenda but does not have their own calendar, goes to Agenda
|
||||
if(this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0){
|
||||
this.router.navigate(['/home/agenda']);
|
||||
}
|
||||
else{
|
||||
this.router.navigate(['/home/events']);
|
||||
}
|
||||
}
|
||||
//If user has access permission to both Chat and Action, goes to Chat by default.
|
||||
else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){
|
||||
this.router.navigate(['/home/chat']);
|
||||
}
|
||||
else if(this.p.userPermission(this.p.permissionList.Actions.access)){
|
||||
this.router.navigate(['/home/publications']);
|
||||
}
|
||||
this.FirstEnterService.enter()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ export class MessageService {
|
||||
downloadAttachments = false;
|
||||
downloadAttachmentsTemp = 0;
|
||||
UploadAttachmentsTemp = 0;
|
||||
manualRetry = false
|
||||
|
||||
constructor(
|
||||
private NfService: NfService,
|
||||
@@ -215,6 +216,9 @@ export class MessageService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
functionTimer = null;
|
||||
|
||||
async sendRequest(params) {
|
||||
|
||||
if(params?.attachments) {
|
||||
@@ -228,16 +232,41 @@ export class MessageService {
|
||||
this.RochetChatConnectorService.send(params).then(
|
||||
(ChatMessage: any) => {
|
||||
ChatMessage = ChatMessage.message.result
|
||||
clearTimeout(this.functionTimer);
|
||||
|
||||
this.messageSend = true
|
||||
this.redefinedMessage(ChatMessage)
|
||||
|
||||
}
|
||||
).catch((error) => {
|
||||
clearTimeout(this.functionTimer);
|
||||
console.error(error)
|
||||
})
|
||||
|
||||
this.functionTimer = setTimeout(() => {
|
||||
|
||||
this.RochetChatConnectorService.registerCallback({
|
||||
type:'Onmessage',
|
||||
key:'ping-pong-message',
|
||||
funx:(message: any) => {
|
||||
if(message.msg == "ping") {
|
||||
if(this.sendAttempt >= 3) {
|
||||
this.manualRetry = true
|
||||
} else {
|
||||
this.send()
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
this.save()
|
||||
}
|
||||
})
|
||||
|
||||
this.RochetChatConnectorService.wsSend({message:{msg:"pong"}, loginRequired: false})
|
||||
|
||||
}, 8000)
|
||||
|
||||
} else {
|
||||
// console.log("reconnect")
|
||||
this.RochetChatConnectorService.registerCallback({
|
||||
type: 'reConnect',
|
||||
funx: async ()=> {
|
||||
@@ -335,6 +364,7 @@ export class MessageService {
|
||||
channels: this.channels,
|
||||
mentions: this.mentions,
|
||||
//msg: this.AESEncrypt.encrypt(this.msg, SessionStore.user.UserName),
|
||||
sendAttempt: this.sendAttempt,
|
||||
msg:this.msg,
|
||||
rid: this.rid,
|
||||
ts: this.ts,
|
||||
|
||||
@@ -46,6 +46,10 @@ export class RochetChatConnectorService {
|
||||
|
||||
}
|
||||
|
||||
wsSend({message, requestId = uuidv4(), loginRequired = true}:send) {
|
||||
this.ws.send({message:{msg:"pong"}, loginRequired: false})
|
||||
}
|
||||
|
||||
login() {
|
||||
// dont login if is already login
|
||||
if(this.isLogin == true) {
|
||||
@@ -739,7 +743,7 @@ export class RochetChatConnectorService {
|
||||
} else {
|
||||
let messageStr = JSON.stringify(message)
|
||||
//
|
||||
// console.log(messageStr)
|
||||
console.log(messageStr)
|
||||
this.socket.send(messageStr)
|
||||
}
|
||||
return requestId
|
||||
@@ -747,6 +751,8 @@ export class RochetChatConnectorService {
|
||||
|
||||
onmessage: async (event: any)=> {
|
||||
const data = JSON.parse(event.data)
|
||||
|
||||
console.log('data', data)
|
||||
|
||||
for (const [key, value] of Object.entries(this.wsCallbacks)) {
|
||||
if(value.type== 'Onmessage') {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FirstEnterService } from './first-enter.service';
|
||||
|
||||
describe('FirstEnterService', () => {
|
||||
let service: FirstEnterService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(FirstEnterService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,51 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
|
||||
|
||||
import { AlertController, Platform } from '@ionic/angular';
|
||||
import { PermissionService } from '../services/permission.service';
|
||||
import { SessionStore } from '../store/session.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FirstEnterService {
|
||||
|
||||
constructor(private router:Router,
|
||||
private platform: Platform,
|
||||
public p: PermissionService,
|
||||
private alertController: AlertController) { }
|
||||
|
||||
|
||||
enter( ) {
|
||||
if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){
|
||||
//When user has got access to Agenda but does not have their own calendar, goes to Agenda
|
||||
if(this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0){
|
||||
this.router.navigate(['/home/agenda']);
|
||||
}
|
||||
else{
|
||||
this.router.navigate(['/home/events']);
|
||||
}
|
||||
}
|
||||
else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){
|
||||
this.router.navigate(['/home/chat']);
|
||||
}
|
||||
else if(this.p.userPermission(this.p.permissionList.Actions.access)) {
|
||||
this.router.navigate(['/home/publications']);
|
||||
} else {
|
||||
|
||||
this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Utilizador sem acesso a aplicação',
|
||||
buttons: [{
|
||||
text: 'Ok',
|
||||
handler: () => {
|
||||
|
||||
}
|
||||
}]
|
||||
}).then( async (alertPopup) => {
|
||||
await alertPopup.present();
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,10 +59,11 @@
|
||||
|
||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||
|
||||
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
</ion-label>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
@@ -104,10 +105,11 @@
|
||||
<img *ngIf="msg.attachments[0].image_url" src="{{msg.attachments[0].image_url}}" alt="image">
|
||||
<ion-icon *ngIf="msg.attachments[0].image_url == null" name="download-outline"></ion-icon>
|
||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
</ion-label>
|
||||
|
||||
</div>
|
||||
@@ -158,10 +160,11 @@
|
||||
</ion-label>
|
||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||
|
||||
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
</ion-label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -321,3 +321,12 @@
|
||||
.float-status-all {
|
||||
font-size: 10pt !important;
|
||||
}
|
||||
|
||||
|
||||
.try {
|
||||
color: red;
|
||||
background: #f3414159;
|
||||
padding: 6px;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -60,10 +60,11 @@
|
||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||
|
||||
|
||||
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
</ion-label>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
@@ -103,10 +104,11 @@
|
||||
<img *ngIf="msg.attachments[0].image_url" src={{msg.attachments[0].image_url}} alt="image">
|
||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||
|
||||
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
</ion-label>
|
||||
</div>
|
||||
<div *ngIf="msg.file.type != 'application/img'">
|
||||
@@ -168,10 +170,11 @@
|
||||
</ion-label>
|
||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||
|
||||
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
</ion-label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -388,4 +388,13 @@ ion-footer {
|
||||
.audioButtonPlay {
|
||||
margin-bottom: 100%;
|
||||
right: 50%;
|
||||
}
|
||||
|
||||
|
||||
.try {
|
||||
color: red;
|
||||
background: #f3414159;
|
||||
padding: 6px;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -32,7 +32,6 @@ 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 { Howl } from 'howler';
|
||||
import { runInThisContext } from 'vm';
|
||||
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
|
||||
import { ChatMessageDebuggingPage } from 'src/app/shared/popover/chat-message-debugging/chat-message-debugging.page';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user