mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
merge with Peter branch
This commit is contained in:
@@ -15,6 +15,7 @@ import { MessageModel } from './models/beast-orm';
|
||||
import { InativityService } from "src/app/services/inativity.service";
|
||||
import { ThemeService } from 'src/app/services/theme.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { Storage } from '@ionic/storage';
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -48,10 +49,13 @@ export class AppComponent {
|
||||
private storageservice: StorageService,
|
||||
private InativityService: InativityService,
|
||||
public ThemeService: ThemeService,
|
||||
private storage: Storage,
|
||||
) {
|
||||
// this.createCacheFolder()
|
||||
this.initializeApp();
|
||||
console.log('version: '+ environment.version)
|
||||
|
||||
this.storage.set('version', environment.version).then(() => {})
|
||||
}
|
||||
|
||||
// async createCacheFolder(){
|
||||
|
||||
+23
-23
@@ -69,35 +69,35 @@ import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
|
||||
|
||||
|
||||
// The example is using Angular, Import '@sentry/vue' or '@sentry/react' when using a Sibling different than Angular.
|
||||
import * as SentrySibling from '@sentry/angular';
|
||||
import * as Sentry from '@sentry/capacitor';
|
||||
/////import * as SentrySibling from '@sentry/angular';
|
||||
/////import * as Sentry from '@sentry/capacitor';
|
||||
// The example is using Angular, Import '@sentry/vue' or '@sentry/react' when using a Sibling different than Angular.
|
||||
// For automatic instrumentation (highly recommended)
|
||||
import { Integration } from '@sentry/types';
|
||||
import { BrowserTracing } from '@sentry/tracing';
|
||||
/////import { Integration } from '@sentry/types';
|
||||
/////import { BrowserTracing } from '@sentry/tracing';
|
||||
|
||||
/* import { FCM } from '@ionic-native/fcm/ngx';
|
||||
import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
|
||||
//import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic/ngx';
|
||||
|
||||
Sentry.init(
|
||||
{
|
||||
dsn: 'https://5b345a3ae70b4e4da463da65881b4aaa@o4504340905525248.ingest.sentry.io/4504345615794176',
|
||||
// To set your release and dist versions
|
||||
release: 'gabinetedigital@1.0.0',
|
||||
dist: '1',
|
||||
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
|
||||
// We recommend adjusting this value in production.
|
||||
tracesSampleRate: 1.0,
|
||||
integrations: [
|
||||
new BrowserTracing({
|
||||
tracingOrigins: ['localhost', 'https://gd-api.oapr.gov.ao/api/'],
|
||||
}) as Integration,
|
||||
]
|
||||
},
|
||||
// Forward the init method to the sibling Framework.
|
||||
SentrySibling.init
|
||||
);
|
||||
///// Sentry.init(
|
||||
///// {
|
||||
///// dsn: 'https://5b345a3ae70b4e4da463da65881b4aaa@o4504340905525248.ingest.sentry.io/4504345615794176',
|
||||
///// // To set your release and dist versions
|
||||
///// release: 'gabinetedigital@1.0.0',
|
||||
///// dist: '1',
|
||||
///// // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
|
||||
///// // We recommend adjusting this value in production.
|
||||
///// tracesSampleRate: 1.0,
|
||||
///// integrations: [
|
||||
///// new BrowserTracing({
|
||||
///// tracingOrigins: ['localhost', 'https://gd-api.oapr.gov.ao/api/'],
|
||||
///// }) as Integration,
|
||||
///// ]
|
||||
///// },
|
||||
///// // Forward the init method to the sibling Framework.
|
||||
///// SentrySibling.init
|
||||
/////);
|
||||
@NgModule({
|
||||
declarations: [AppComponent],
|
||||
entryComponents: [],
|
||||
@@ -145,7 +145,7 @@ Sentry.init(
|
||||
{
|
||||
provide: ErrorHandler,
|
||||
// Attach the Sentry ErrorHandler
|
||||
useValue: SentrySibling.createErrorHandler(),
|
||||
/////useValue: SentrySibling.createErrorHandler(),
|
||||
},
|
||||
StatusBar,
|
||||
//SplashScreen,
|
||||
|
||||
@@ -22,6 +22,8 @@ export class AuthGuard implements CanActivate {
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
||||
|
||||
console.log('hire auth!', state.url)
|
||||
|
||||
// if user not active or no session
|
||||
if(!SessionStore.user.Inactivity || !SessionStore.exist) {
|
||||
|
||||
@@ -29,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,8 +26,15 @@ 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)){
|
||||
this.router.navigate(['/home/events']);
|
||||
|
||||
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.router.navigate(['/home/chat']);
|
||||
@@ -69,7 +78,13 @@ export class InactivityGuard implements CanActivate {
|
||||
|
||||
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']);
|
||||
//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.router.navigate(['/home/chat']);
|
||||
@@ -90,6 +105,7 @@ export class InactivityGuard implements CanActivate {
|
||||
await alertPopup.present();
|
||||
})
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ export class LoginGuard implements CanActivate {
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
||||
|
||||
console.log('hire inactinity!', state.url)
|
||||
|
||||
if(SessionStore.exist && SessionStore.user.Inactivity && SessionStore.user.LoginPreference != 'Pin' ) {
|
||||
// enter app
|
||||
|
||||
@@ -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]
|
||||
})
|
||||
|
||||
|
||||
@@ -71,6 +71,7 @@ export interface Message {
|
||||
rid: string;
|
||||
msg: string;
|
||||
ts: Ts;
|
||||
sendAttempt?: number
|
||||
u: U;
|
||||
from: 'Offline'|'History'|'stream'| 'send'
|
||||
t: string;
|
||||
|
||||
@@ -228,7 +228,7 @@
|
||||
|
||||
<div class="calendar-title-container px-20 d-none d-md-flex">
|
||||
<div class="calendar-title-description flex-grow-1 text-grey d-flex justify-center align-center" *ngIf="eventService.hasOwnCalendar">
|
||||
<div >Agenda de {{loggeduser.FullName}}</div>
|
||||
<div >Agenda de {{SessionStore.user.FullName}}</div>
|
||||
</div>
|
||||
<div class="calendar-title-description text-black align-center" *ngIf="eventService.hasSharedCalendar">
|
||||
<div class="flex-grow-1 text-grey d-flex justify-center align-center">
|
||||
@@ -284,7 +284,7 @@
|
||||
<div class="description">
|
||||
<p class="m-0">{{event.event.Subject}}</p>
|
||||
</div>
|
||||
<div class="font-13"*ngIf="eventService.getCalendarOwnNameByCalendarId(event.event.CalendarId) == 'Meu calendario'">{{loggeduser.FullName}} </div>
|
||||
<div class="font-13"*ngIf="eventService.getCalendarOwnNameByCalendarId(event.event.CalendarId) == 'Meu calendario'">{{SessionStore.user.FullName}} </div>
|
||||
<ng-template #other_content>{{eventService.getCalendarOwnNameByCalendarId(event.event.CalendarId)}}</ng-template>
|
||||
</div>
|
||||
</div>
|
||||
@@ -326,7 +326,7 @@
|
||||
<div class="description">
|
||||
<p class="m-0">{{event.event.Subject}}</p>
|
||||
</div>
|
||||
<div class="font-13"*ngIf="eventService.getCalendarOwnNameByCalendarId(event.event.CalendarId) == 'Meu calendario'">{{loggeduser.FullName}} </div>
|
||||
<div class="font-13"*ngIf="eventService.getCalendarOwnNameByCalendarId(event.event.CalendarId) == 'Meu calendario'">{{SessionStore.user.FullName}} </div>
|
||||
<ng-template #other_content>{{eventService.getCalendarOwnNameByCalendarId(event.event.CalendarId)}}</ng-template>
|
||||
</div>
|
||||
</div>
|
||||
@@ -370,7 +370,7 @@
|
||||
<div class="description">
|
||||
<p class="m-0">{{event.event.Subject}}</p>
|
||||
</div>
|
||||
<div class="font-13"*ngIf="eventService.getCalendarOwnNameByCalendarId(event.event.CalendarId) == 'Meu calendario'"> {{loggeduser.FullName}} </div>
|
||||
<div class="font-13"*ngIf="eventService.getCalendarOwnNameByCalendarId(event.event.CalendarId) == 'Meu calendario'"> {{SessionStore.user.FullName}} </div>
|
||||
<ng-template #other_content>{{eventService.getCalendarOwnNameByCalendarId(event.event.CalendarId)}}</ng-template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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" (click)="msg.send()">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" (click)="msg.send()">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" (click)="msg.send()">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" (click)="msg.send()">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" (click)="msg.send()">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" (click)="msg.send()">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;
|
||||
}
|
||||
@@ -152,7 +152,9 @@ export class EventsPage implements OnInit {
|
||||
console.error(error)
|
||||
})
|
||||
this.listToPresent = onwEvent;
|
||||
this.totalEvent = onwEvent.length;
|
||||
if(onwEvent?.length) {
|
||||
this.totalEvent = onwEvent.length;
|
||||
}
|
||||
this.showLoader = false;
|
||||
this.showAgendaLoader = false;
|
||||
} else {
|
||||
@@ -280,9 +282,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
|
||||
}
|
||||
//
|
||||
})
|
||||
|
||||
@@ -442,4 +446,6 @@ export class EventsPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -34,7 +34,7 @@ import { DataService } from 'src/app/services/data.service';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { async } from '@angular/core/testing';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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() {
|
||||
@@ -69,7 +72,6 @@ export class LoginPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Function to validade the login inputs
|
||||
validateUsername() {
|
||||
return (
|
||||
@@ -91,6 +93,7 @@ export class LoginPage implements OnInit {
|
||||
buttons: ['OK']
|
||||
});
|
||||
|
||||
|
||||
await alert.present();
|
||||
}
|
||||
|
||||
@@ -133,7 +136,7 @@ export class LoginPage implements OnInit {
|
||||
}
|
||||
|
||||
this.changeProfileService.runLogin();
|
||||
this.getToken();
|
||||
// this.getToken();
|
||||
SessionStore.setInativity(true);
|
||||
|
||||
this.goback();
|
||||
@@ -159,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) {
|
||||
|
||||
@@ -59,6 +59,7 @@ export class MessageService {
|
||||
downloadAttachments = false;
|
||||
downloadAttachmentsTemp = 0;
|
||||
UploadAttachmentsTemp = 0;
|
||||
manualRetry = false
|
||||
|
||||
constructor(
|
||||
private NfService: NfService,
|
||||
@@ -70,7 +71,7 @@ export class MessageService {
|
||||
private ChatSystemService: ChatSystemService) {
|
||||
}
|
||||
|
||||
setData({customFields = {}, channels, mentions, msg ,rid ,ts, u, t, _id, id, _updatedAt, file, attachments, temporaryData, localReference , viewed = [], received = [], delate = false, delateRequest =false, from }:Message) {
|
||||
setData({customFields = {}, channels, mentions, msg ,rid ,ts, u, t, _id, id, _updatedAt, file, attachments, temporaryData, localReference , viewed = [], received = [], delate = false, delateRequest =false, from, sendAttempt = 0 }:Message) {
|
||||
|
||||
this.channels = channels || []
|
||||
this.mentions = mentions || []
|
||||
@@ -87,6 +88,7 @@ export class MessageService {
|
||||
this.id = id
|
||||
this.delate = delate
|
||||
this.delateRequest = delateRequest
|
||||
this.sendAttempt = 0
|
||||
|
||||
if(this.attachments?.length >= 1 && attachments?.length >= 1) {
|
||||
this.attachments[0] = Object.assign(this.attachments[0], attachments[0])
|
||||
@@ -148,6 +150,7 @@ export class MessageService {
|
||||
async send(): Promise<any> {
|
||||
|
||||
this.sendAttempt++;
|
||||
this.manualRetry = false
|
||||
|
||||
if(!this.hasFile) {
|
||||
|
||||
@@ -215,8 +218,10 @@ export class MessageService {
|
||||
|
||||
}
|
||||
|
||||
async sendRequest(params) {
|
||||
|
||||
functionTimer = null;
|
||||
|
||||
async sendRequest(params) {
|
||||
if(params?.attachments) {
|
||||
if(params?.attachments[0]?.image_url) {
|
||||
delete params?.attachments[0]?.image_url
|
||||
@@ -225,19 +230,64 @@ export class MessageService {
|
||||
|
||||
if(this.NetworkServiceService.getCurrentNetworkStatus() == ConnectionStatus.Online) {
|
||||
// console.log('online send')
|
||||
this.RochetChatConnectorService.send(params).then(
|
||||
(ChatMessage: any) => {
|
||||
ChatMessage = ChatMessage.message.result
|
||||
|
||||
this.messageSend = true
|
||||
this.redefinedMessage(ChatMessage)
|
||||
if(this.msg == '<script></script>') {
|
||||
if(this.sendAttempt >= 4) {
|
||||
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)
|
||||
})
|
||||
}
|
||||
).catch((error) => {
|
||||
console.error(error)
|
||||
})
|
||||
|
||||
} else {
|
||||
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})
|
||||
|
||||
}, 3000)
|
||||
|
||||
} else {
|
||||
// console.log("reconnect")
|
||||
this.RochetChatConnectorService.registerCallback({
|
||||
type: 'reConnect',
|
||||
funx: async ()=> {
|
||||
@@ -257,6 +307,8 @@ export class MessageService {
|
||||
|
||||
const message = this.getChatObj()
|
||||
|
||||
this.manualRetry = false
|
||||
|
||||
ChatMessage = Object.assign(message, ChatMessage)
|
||||
this.setData(ChatMessage)
|
||||
|
||||
@@ -335,6 +387,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) {
|
||||
@@ -570,7 +574,7 @@ export class RochetChatConnectorService {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.ws.registerCallback({type:'Onmessage', funx:(message) => {
|
||||
|
||||
// console.log();
|
||||
|
||||
if(message.id == requestId || message?.subs?.[0] == requestId) { // same request send
|
||||
resolve(message)
|
||||
return true
|
||||
@@ -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" (click)="msg.send()">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" (click)="msg.send()">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" (click)="msg.send()">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" (click)="msg.send()">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" (click)="msg.send()">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" (click)="msg.send()">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';
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AES, enc, SHA1 } from 'crypto-js'
|
||||
import { environment } from 'src/environments/environment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class LocalstoreService {
|
||||
|
||||
private prefix = 'v18-';
|
||||
private prefix = environment.version.lastCommitNumber+"-";
|
||||
private previewPrefix = 'v17-';
|
||||
|
||||
constructor() {
|
||||
|
||||
Reference in New Issue
Block a user