This commit is contained in:
Peter Maquiran
2023-07-15 11:39:30 +01:00
1436 changed files with 2958 additions and 3769 deletions
+30 -15
View File
@@ -21,7 +21,14 @@ export class BackgroundService {
private themeservice: ThemeService,
private storageservice: StorageService,
private http: HttpClient,
) { }
) {
window.addEventListener('focus', (event) => {
if(this.status == 'offline') {
this.tryToReachTheServer()
}
});
}
online() {
if(this.status == 'online') {
@@ -68,28 +75,36 @@ export class BackgroundService {
return false
}
const hasReachedTheServer = await this.tryToReachTheServer()
if(!hasReachedTheServer) {
this.status = 'offline'
document.body.style.setProperty(`--color`, "#ffb703");
document.body.style.setProperty(`--color2`, "#ffb703");
document.body.style.setProperty(`--color3`, "#ffb703");
document.body.style.setProperty(`--color4`, "#ffb703");
document.body.style.setProperty(`--color5`, "#ffb703");
this.storageservice.store('networkCheckStore','offline');
this.callBacks.forEach((e) => {
if (e.type == 'Offline') {
e.funx()
}
})
}
}
async tryToReachTheServer() {
let opts = {
headers: {},
}
try {
await this.http.post(environment.apiURL + "UserAuthentication/Login", '', opts).toPromise();
return true
} catch (error) {
if(error.status != 400) {
this.status = 'offline'
document.body.style.setProperty(`--color`, "#ffb703");
document.body.style.setProperty(`--color2`, "#ffb703");
document.body.style.setProperty(`--color3`, "#ffb703");
document.body.style.setProperty(`--color4`, "#ffb703");
document.body.style.setProperty(`--color5`, "#ffb703");
this.storageservice.store('networkCheckStore','offline');
this.callBacks.forEach((e) => {
if (e.type == 'Offline') {
e.funx()
}
})
return false
}
}
}
@@ -5,6 +5,7 @@ import { deepFind } from 'src/plugin/deep'
import { environment } from 'src/environments/environment';
import { SessionStore } from 'src/app/store/session.service';
import { chatHistory, Rooms } from 'src/app/models/chatMethod';
import { BackgroundService } from '../background.service';
@Injectable({
providedIn: 'root'
@@ -14,7 +15,7 @@ export class RochetChatConnectorService {
isLogin = false;
loginResponse = {}
constructor() {
constructor(private backgroundservice: BackgroundService,) {
}
connect() {
@@ -752,6 +753,7 @@ export class RochetChatConnectorService {
},
onopen: async ()=> {
this.ws.connected = true
this.backgroundservice.online();
setTimeout(()=>{
this.ws.wsMsgQueue()
@@ -804,6 +806,9 @@ export class RochetChatConnectorService {
},
onmessage: async (event: any)=> {
this.backgroundservice.online();
const data = JSON.parse(event.data)
for (const [key, value] of Object.entries(this.wsCallbacks)) {
@@ -14,7 +14,7 @@ ion-list, ion-item-sliding{
}
.item-list-small{
font-size: 14px;
font-size: rem(14);
overflow: auto;
}
.ion-item-class{
@@ -39,7 +39,7 @@ ion-list, ion-item-sliding{
padding: 10px;
}
.div-content-attachment h3{
font-size: 18px;
font-size: rem(18);
font-weight: 700;
padding-bottom: 5px;
}
@@ -14,16 +14,16 @@
<div *ngFor="let attendee of contacts;">
<ion-item (click)="selectContact(attendee)" class="cursor-pointer" lines="none" *ngIf="filterSearchList(attendee)" >
<div class="pr-10">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="font-35" src="assets/images/icons-default-profile.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-35" src="assets/images/theme/gov/icons-profile.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="font-35" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-profile.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="font-35-rem" src="assets/images/icons-default-profile.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-35-rem" src="assets/images/theme/gov/icons-profile.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="font-35-rem" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-profile.svg"></ion-icon>
</div>
<ion-label>
<h3>{{ attendee.Name }}</h3>
<p>{{ attendee.EmailAddress }}</p>
</ion-label>
<div>
<ion-icon class="font-35" src="assets/images/icons-add-25.svg"></ion-icon>
<ion-icon class="font-35-rem" src="assets/images/icons-add-25.svg"></ion-icon>
</div>
</ion-item>
</div>
@@ -37,16 +37,16 @@
<ion-item-sliding class="px-20">
<ion-item lines="none" *ngFor="let attendee of taskParticipants;" class="d-flex">
<div class="pr-10">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="font-35" src="assets/images/icons-default-profile.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-35" src="assets/images/theme/gov/icons-profile.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="font-35" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-profile.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="font-35-rem" src="assets/images/icons-default-profile.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-35-rem" src="assets/images/theme/gov/icons-profile.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="font-35-rem" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-profile.svg"></ion-icon>
</div>
<ion-label>
<h3>{{ attendee.Name }}</h3>
<p>{{ attendee.EmailAddress }}</p>
</ion-label>
<div class="cursor-pointer" (click)="remove(attendee)">
<ion-icon class="font-35" src="assets/images/icons-delete-25.svg"></ion-icon>
<ion-icon class="font-35-rem" src="assets/images/icons-delete-25.svg"></ion-icon>
</div>
</ion-item>
</ion-item-sliding>
@@ -57,16 +57,16 @@
<ion-item-sliding class="px-20">
<ion-item lines="none" *ngFor="let attendee of taskParticipantsCc;" class="d-flex">
<div class="pr-10">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="font-35" src="assets/images/icons-default-profile.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-35" src="assets/images/theme/gov/icons-profile.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="font-35" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-profile.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="font-35-rem" src="assets/images/icons-default-profile.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-35-rem" src="assets/images/theme/gov/icons-profile.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="font-35-rem" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-profile.svg"></ion-icon>
</div>
<ion-label>
<h3>{{ attendee.Name }}</h3>
<p>{{ attendee.EmailAddress }}</p>
</ion-label>
<div class="cursor-pointer" (click)="remove(attendee)">
<ion-icon class="font-35" src="assets/images/icons-delete-25.svg"></ion-icon>
<ion-icon class="font-35-rem" src="assets/images/icons-delete-25.svg"></ion-icon>
</div>
</ion-item>
</ion-item-sliding>
@@ -1,4 +1,4 @@
@import '~src/function.scss';
.content{
padding: 30px 20px 0 20px !important;
margin: 0;
@@ -24,12 +24,12 @@
}
.title{
font-size: 25px;
font-size: rem(25);
}
}
.ion-item-container{
margin: 15px auto;
margin: rem(15) auto;
border: 1px solid #ebebeb;
border-radius: 5px;
padding-left: 10px;
@@ -49,11 +49,11 @@
margin: 0px auto;
}
.ion-icon-class{
width: 45px;
height: 45px;
width: rem(45);
height: rem(45);
float: left;
padding: 10px;
font-size: 25px;
font-size: rem(25);
}
ion-select{
padding-left: 5px;
@@ -61,7 +61,7 @@
}
.ion-input-class{
width: calc(100% - 45px);
height: 45px;
height: rem(45);
border: 1px solid #ebebeb;
border-radius: 5px;
padding-left: 5px;
@@ -79,19 +79,19 @@
}
.add-people{
width: 45px;
width: rem(45);
float: right;
overflow: auto;
font-size: 25px;
height: 45px;
font-size: rem(25);
height: rem(45);
display: flex;
}
.list-people-title{
/* font-size: 13px; */
/* font-size: rem(13); */
color: #797979;
}
.attach-document{
font-size: 15px;
font-size: rem(15);
color: var(--title-text-color);
margin: 5px 5px 5px 10px;
padding: 5px;
@@ -99,39 +99,39 @@
}
.attach-icon{
width: 37px;
font-size: 35px;
font-size: rem(35);
float: left;
}
.attach-title-item{
width: 100%;
font-size: 15px;
font-size: rem(15);
color:var(--title-text-color);
}
/* SPAN */
.span-left{
float: left;
font-size: 15x;
font-size: rem(15);
}
.span-right{
text-align: right;
float: right;
font-size: 13px;
font-size: rem(13);
}
.container-footer{
margin:0 auto;
overflow: auto;
}
.button-cancel {
width: 170px;
height: 44px;
width: rem(170);
height: rem(44);
border-radius: 22.5px;
--background: #e0e9ee;
--color: #061b52;
margin:10px;
}
.button-save {
width: 170px;
height: 44px;
width: rem(170);
height: rem(44);
border-radius: 22.5px;
--background: #42b9fe;
--color:#ffffff;
@@ -149,7 +149,7 @@
/* Error Messages */
.error{
color:red;
font-size: 12px;
font-size: rem(12);
font-weight: bold;
padding-bottom: 20px;
}
@@ -14,12 +14,12 @@ ion-item-group{
.div-up h3{
margin: 0;
padding: 0;
font-size: 17px;
font-size: rem(17);
width: 100%;
}
.div-icon{
width: 10%;
font-size: 22px;
font-size: rem(22);
float: left;
color: #808080;
}
@@ -35,7 +35,7 @@ ion-item-group{
}
.ion-icon-attach{
color: #666666;
font-size: 20px;
font-size: rem(20);
}
.btn-attach{
@@ -70,14 +70,14 @@ ion-card{
margin-bottom: 25px;
}
.ion-icon-delete{
font-size: 22px;
font-size: rem(22);
color: red;
background-color: white;
padding-right: 5px;
}
.error{
color:red;
font-size: 12px;
font-size: rem(12);
font-weight: bold;
padding-bottom: 20px;
}
@@ -86,10 +86,10 @@ ion-card{
margin-top: 10px;
} */
.attendees-icon{
font-size: 14px;
font-size: rem(14);
}
.see-more-button{
text-transform: initial;
font-size: 16px;
font-size: rem(16);
}
@@ -14,12 +14,12 @@ ion-item-group{
.div-up h3{
margin: 0;
padding: 0;
font-size: 17px;
font-size: rem(17);
width: 100%;
}
.div-icon{
width: 10%;
font-size: 22px;
font-size: rem(22);
float: left;
color: #808080;
}
@@ -35,7 +35,7 @@ ion-item-group{
}
.ion-icon-attach{
color: #666666;
font-size: 20px;
font-size: rem(20);
}
.btn-attach{
@@ -70,14 +70,14 @@ ion-card{
margin-bottom: 25px;
}
.ion-icon-delete{
font-size: 22px;
font-size: rem(22);
color: red;
background-color: white;
padding-right: 5px;
}
.error{
color:red;
font-size: 12px;
font-size: rem(12);
font-weight: bold;
padding-bottom: 20px;
}
@@ -90,7 +90,7 @@ ion-card{
}
.see-more-button{
text-transform: initial;
font-size: 16px;
font-size: rem(16);
}
.header-content{
@@ -100,7 +100,7 @@ ion-card{
}
.header-icon-left{
width: 36px;
font-size: 33px;
font-size: rem(33);
color: #42b9fe;
float: left;
border: 1px solid red;
@@ -108,7 +108,7 @@ ion-card{
.header-title{
width: 300px;
font-family: Roboto;
font-size: 25px;
font-size: rem(25);
margin: 0 5px 0 5px;
padding: 0;
color:#000;
+36 -36
View File
@@ -30,7 +30,7 @@ ion-toolbar{
border: 0!important;
.div-search{
font-size: 45px;
font-size: rem(45);
float: left;
margin: 0 0 0 10px
}
@@ -44,7 +44,7 @@ ion-toolbar{
width: 100%;
}
.div-profile{
font-size: 45px;
font-size: rem(45);
float: right;
margin-right: 10px;
}
@@ -59,14 +59,14 @@ ion-toolbar{
}
.header-large{
font-family: Arial, Helvetica, sans-serif;
font-size: 12.5pt;
font-size: rem(17);
/* font-weight: 600; */
background: transparent;
color: #ffffff;
}
.header-xsmall{
font-family: Arial, Helvetica, sans-serif;
font-size: 9.7pt;
font-size: rem(13);
font-weight: bold;
padding-bottom: 3.5px;
margin-bottom: 3.5px;
@@ -74,16 +74,16 @@ ion-toolbar{
background: transparent;
}
.header-medium{
font-size: 12pt;
font-size: rem(16);
text-align: left;
font-family: roboto;
background: transparent;
margin-right: 5px;
line-height: 25px;
line-height: rem(25);
}
.p-small{
font-size: 13pt;
font-size: rem(17);
margin-top: 13px;
color:#000;
margin-right: 25px !important;
@@ -93,7 +93,7 @@ ion-toolbar{
/* CONTENT */
.item-list-small{
font-size: 14px;
font-size: rem(14);
overflow: auto;
}
.ion-item-class{
@@ -134,12 +134,12 @@ ion-toolbar{
.div-up h3{
margin: 0;
padding: 0;
font-size: 17px;
font-size: rem(17);
width: 100%;
}
.div-icon{
width: 10%;
font-size: 22px;
font-size: rem(22);
float: left;
color: #808080;
}
@@ -161,11 +161,11 @@ ion-toolbar{
padding: 0 0 0 12px;
}
.div-content-Oficial h3, .div-content-Pessoal h3{
font-size: 14pt;
font-size: rem(19);
/* border: 1px solid red; */
}
.div-content-Oficial p, .div-content-Pessoal p{
font-size: 12pt;
font-size: rem(16);
color: rgb(94, 92, 92);
padding: 0 !important;
margin: 0 !important;
@@ -183,7 +183,7 @@ ion-toolbar{
text-align: center;
display: block;
color: #000;
font-size: 16px;
font-size: rem(16);
margin: 0 auto;
}
.div-botton-middle{
@@ -203,7 +203,7 @@ ion-toolbar{
}
.ion-icon-attach{
color: #666666;
font-size: 20px;
font-size: rem(20);
}
/* NEW CSS FOR TOGGLE BUTTON */
.toggleBox{
@@ -230,7 +230,7 @@ ion-toolbar{
position: absolute;
content: "";
left: 0;
width: 30px;
width: rem(30);
height: 30px;
background: #fff;
border-radius: 50%;
@@ -253,7 +253,7 @@ ion-toolbar{
position: absolute;
color: #fff;
font-weight: 600;
font-size: 12px;
font-size: rem(12);
pointer-events: none;
}
.onbtn{
@@ -280,19 +280,19 @@ ion-toolbar{
.event-number{
color: white;
font-family: Roboto;
font-size: 15px;
font-size: rem(15);
color: var(--white);
bold{
font-family: Roboto;
font-size: 25px;
font-size: rem(25);
text-align: right;
color: var(--white);
}
}
.time{
font-family: Roboto;
font-size: 30px;
font-size: rem(30);
text-align: center;
color: var(--white);
line-height: unset;
@@ -306,7 +306,7 @@ ion-toolbar{
margin-top: 15px;
.meeting-time {
font-size: em(25px);
font-size: em(25);
font-family: Roboto;
font-weight: 300;
color: var(--white);
@@ -316,7 +316,7 @@ ion-toolbar{
.meeting-description {
margin-top: 2px;
font-family: Roboto;
font-size: 15px;
font-size: rem(15);
color: var(--white);
}
}
@@ -353,22 +353,22 @@ ion-toolbar{
.icon{
color: #e8e8e8;
height: 35px;
width: 35px;
height: rem(35);
width: rem(35);
margin-right: 10px;
}
.text{
font-family: Roboto;
font-size: 20px;
font-size: rem(20);
color: black;
}
}
.icon-next {
color: #e8e8e8;
height: 35px;
width: 35px;
font-size: 35px;
font-size: 35px;
height: rem(35);
width: rem(35);
font-size: rem(35);
font-size: rem(35);
}
}
.content{
@@ -405,19 +405,19 @@ ion-toolbar{
.time-start{
color: #797979 !important;
font-family: Roboto;
font-size: 13px;
font-size: rem(13);
}
.time-end{
color: #797979 !important;
font-family: Roboto;
font-size: 13px;
font-size: rem(13);
}
}
.schedule-date{
margin-right: 10px;
width: 22%;
color: #797979 !important;
font-size: 13px;
font-size: rem(13);
}
.schedule-details{
display: flex;
@@ -426,7 +426,7 @@ ion-toolbar{
width: 78%;
.location{
font-family: Roboto;
font-size: 13px;
font-size: rem(13);
color: black;
width: 100%;
@@ -434,7 +434,7 @@ ion-toolbar{
.description{
width: 100%;
font-family: Roboto;
font-size: 15px;
font-size: rem(15);
font-weight: bold;
color: #0d89d1;
}
@@ -446,7 +446,7 @@ ion-toolbar{
}
.color{
width: 5px;
height: 40px;
height: rem(40);
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
background-color: #f05d5e;
@@ -463,7 +463,7 @@ ion-toolbar{
.resume{
.title{
font-family: Roboto;
font-size: 15px;
font-size: rem(15);
font-weight: 500;
color: #797979;
margin-bottom: 5px;
@@ -471,7 +471,7 @@ ion-toolbar{
}
.event-num, .first-event-time{
font-family: Roboto;
font-size: 15px;
font-size: rem(15);
display: block;
color: black;
}
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { LoggingInterceptorService } from './logging-interceptor.service';
describe('LoggingInterceptorService', () => {
let service: LoggingInterceptorService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(LoggingInterceptorService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -0,0 +1,48 @@
import { HttpHandler, HttpRequest, HttpResponse } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { finalize, tap } from 'rxjs/operators';
import { BackgroundService } from './background.service';
import { environment } from 'src/environments/environment';
@Injectable({
providedIn: 'root'
})
export class LoggingInterceptorService {
constructor(
private backgroundservice: BackgroundService,
) {}
intercept(req: HttpRequest<any>, next: HttpHandler) {
// extend server response observable with logging
return next.handle(req)
.pipe(
tap({
// Succeeds when there is a response; ignore other events
next: (event) => {
const ok = event instanceof HttpResponse ? 'succeeded' : ''
if(ok == 'succeeded' || (typeof event['status'] == 'number' && event['status'] !=0)) {
// set to online
this.backgroundservice.online();
}
},
// Operation failed; error is an HttpErrorResponse
error: (error) => {
if (error.status === 0 && error.error instanceof ProgressEvent &&
!req.url.includes('UserAuthentication/Login') &&
req.url.includes(environment.apiURL)
) {
// A client-side or network error occurred. Handle it accordingly.
this.backgroundservice.offline();
}
}
}),
// Log when response observable either completes or errors
finalize(() => {})
);
}
}
+1 -3
View File
@@ -17,9 +17,7 @@ export class ThemeService {
currentTheme: 'gov' | 'default' | 'doneIt' = this.defaultTheme
keyName: string
constructor(
private storageservice: StorageService
) {
constructor() {
this.keyName = (SHA1("ThemeService")).toString()
let restore = localstoreService.get(this.keyName, {
+12 -1
View File
@@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
import { AnimationController, ModalController, ToastController } from '@ionic/angular';
import { BadRequestPage } from '../shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from '../shared/popover/success-message/success-message.page';
import { ThemeService } from 'src/app/services/theme.service';
@Injectable({
providedIn: 'root'
@@ -10,6 +11,7 @@ export class ToastService {
constructor(
public toastController: ToastController,
public ThemeService: ThemeService,
) { }
ngOnInit() {}
@@ -188,6 +190,15 @@ export class ToastService {
}
async ViewEventOption() {
// this.ThemeService.currentTheme == 'default'
// this.ThemeService.currentTheme == 'gov'
// this.ThemeService.currentTheme == 'doneIt'
if(this.ThemeService.currentTheme == 'default') {
} else if (this.ThemeService.currentTheme == 'gov') {}
}
async notificationMessage(message?: any, callback?: any,data?: any) {
@@ -266,4 +277,4 @@ export class ToastService {
}
export const ToastsService = new ToastService(new ToastController())
export const ToastsService = new ToastService(new ToastController(), new ThemeService())