This commit is contained in:
Peter Maquiran
2023-01-09 17:07:02 +01:00
parent efa7774c1c
commit 58f9e7eacd
10 changed files with 62 additions and 32 deletions
+18 -2
View File
@@ -11,10 +11,12 @@ import { PermissionService } from '../services/permission.service';
import { BackgroundService } from 'src/app/services/background.service';
import { Storage } from '@ionic/storage';
import { EventsService } from 'src/app/services/events.service';
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
import { ProcessesService } from 'src/app/services/processes.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { Device } from '@capacitor/device';
import { RouteService } from 'src/app/services/route.service';
import { NetworkServiceService, ConnectionStatus } from 'src/app/services/network-service.service';
import { NativeNotificationService } from 'src/app/services/native-notification.service';
import { UserSession } from '../models/user.model';
import { PermissionList } from '../models/permission/permissionList';
@@ -85,6 +87,8 @@ export class HomePage implements OnInit {
public RouteService: RouteService,
private NativeNotificationService: NativeNotificationService,
private sqliteservice: SqliteService,
private RochetChatConnectorService: RochetChatConnectorService,
private NetworkServiceService: NetworkServiceService
) {
if (SessionStore.exist) {
this.user = SessionStore.user;
@@ -139,14 +143,26 @@ export class HomePage implements OnInit {
this.notificationsService.onReciveBackground();
window.addEventListener('online', () => {
// console.log('Became online')
this.backgroundservice.online()
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
this.synchWhenOnline()
}
});
this.RochetChatConnectorService.registerCallback({
type: 'reConnect',
funx: async () => {
this.backgroundservice.online()
}
})
this.NetworkServiceService.onNetworkChange().subscribe((status) => {
if(status == ConnectionStatus.Online) {
this.backgroundservice.online()
}
})
window.addEventListener('offline', () => {
// console.log('Became offline')
this.backgroundservice.offline()
@@ -228,7 +228,7 @@
</div>
<div class="exp-card-text">
<p class="text-center exp-card-title " *ngIf="p.userPermission([p.permissionList.Gabinete.md_tasks])">Despacho do Presidente da República</p>
<p class="text-center exp-card-title " *ngIf="p.userPermission([p.permissionList.Gabinete.pr_tasks])">Despachos criados por mim</p>
<p class="text-center exp-card-title " *ngIf="p.userPermission([p.permissionList.Gabinete.pr_tasks]) && !p.userPermission([p.permissionList.Gabinete.md_tasks])">Despachos criados por mim</p>
<p class="text-center exp-card-content">{{ despachoprstore.count }} <span class="title1">Documentos</span> </p>
</div>
</div>
+2 -2
View File
@@ -7,9 +7,9 @@
<div class="bg-4 d-flex justify-center align-center">
<div class="div-logo">
<img *ngIf="ThemeService.currentTheme == 'default' " src='assets/images/fullLogo-no-g.png' alt='logo'>
<!-- <img *ngIf="ThemeService.currentTheme == 'default' " src='assets/images/fullLogo-no-g.png' alt='logo'>
<img *ngIf="ThemeService.currentTheme == 'gov' " src='assets/images/theme/gov/governoangola_A.png' alt='logo'>
<img *ngIf="ThemeService.currentTheme == 'doneIt' " src='assets/images/theme/{{ThemeService.currentTheme}}/governoangola_A.png' alt='logo'>
<img *ngIf="ThemeService.currentTheme == 'doneIt' " src='assets/images/theme/{{ThemeService.currentTheme}}/governoangola_A.png' alt='logo'> -->
</div>
</div>
+12 -4
View File
@@ -15,6 +15,8 @@ export class BackgroundService {
funx: Function
}[] = []
status: 'online'| 'offline' = 'online'
constructor(
private themeservice: ThemeService,
private storageservice: StorageService,
@@ -22,14 +24,18 @@ export class BackgroundService {
) { }
online() {
if(this.status == 'online') {
return false
}
this.status = 'online'
this.paint()
this.callBacks.forEach((e) => {
if (e.type == 'Online') {
e.funx()
}
})
this.status = 'offline'
}
paint() {
@@ -59,6 +65,10 @@ export class BackgroundService {
async offline() {
if(this.status == 'offline') {
return false
}
let opts = {
headers: {},
}
@@ -68,6 +78,7 @@ export class BackgroundService {
} 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");
@@ -82,8 +93,6 @@ export class BackgroundService {
}
}
}
registerBackService(type: 'Offline' | 'Online' | 'Notification', funx: Function, object = '') {
@@ -94,5 +103,4 @@ export class BackgroundService {
})
}
}
+5 -1
View File
@@ -21,7 +21,11 @@ export class NetworkServiceService {
this.initializeNetworkEvents();
let status = this.network.type !== 'none' ? ConnectionStatus.Online : ConnectionStatus.Offline;
this.status.next(status);
});
});
this.onNetworkChange().subscribe((status) => {
console.log(status)
})
}
+7 -7
View File
@@ -5,9 +5,9 @@
<div title="Pesquisa" *ngIf="!hideSearchBtn" class="div-search">
<div (click)="openSearch()">
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="font-45" src="assets/images/theme/doneIt/icons-search.svg"></ion-icon>
<!-- <ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="font-45" src="assets/images/theme/doneIt/icons-search.svg"></ion-icon>
<ion-icon *ngIf=" ThemeService.currentTheme == 'default' " class="font-45" src='assets/images/icons-search.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-45" src='assets/images/theme/gov/icons-search.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-45" src='assets/images/theme/gov/icons-search.svg'></ion-icon> -->
</div>
</div>
@@ -19,14 +19,14 @@
</div>
<div *ngIf="ThemeService.currentTheme == 'gov'" class="logo-description d-flex align-center justify-content-center">
<div class="logo-description-content">
<p class="logo-description-text tp-5" >Presidente da República</p>
<p class="logo-description-text tp-5" ></p>
<div class="add-line"></div>
<p class="logo-description-text tp-5" >GABINETE DIGITAL</p>
</div>
</div>
<div *ngIf="ThemeService.currentTheme == 'default' " class="logo-description d-flex align-center justify-content-center">
<div class="logo-description-content">
<p class="logo-description-text tp-5 color-white" >Presidente da República</p>
<p class="logo-description-text tp-5 color-white" ></p>
<div class="add-line-white"></div>
<p class="logo-description-text tp-5 color-white" >GABINETE DIGITAL</p>
</div>
@@ -45,9 +45,9 @@
<div class="d-flex justify-space-between align-center">
<div tab="events" class="div-logo height-fit-content">
<div class="logo-icon">
<img *ngIf="ThemeService.currentTheme == 'default'" src='assets/images/logo-no-bg.png' alt='logo'>
<!-- <img *ngIf="ThemeService.currentTheme == 'default'" src='assets/images/logo-no-bg.png' alt='logo'>
<img *ngIf="ThemeService.currentTheme == 'gov' " src='assets/images/theme/gov/governoangola_A.png' alt='logo'>
<img *ngIf="ThemeService.currentTheme == 'doneIt' " src='assets/images/theme/{{ThemeService.currentTheme}}/governoangola_A1.png' alt='logo'>
<img *ngIf="ThemeService.currentTheme == 'doneIt' " src='assets/images/theme/{{ThemeService.currentTheme}}/governoangola_A1.png' alt='logo'> -->
</div>
<div class="logo-description d-flex align-center justify-content-center">
@@ -55,7 +55,7 @@
<div *ngIf="ThemeService.currentTheme == 'gov' " class="logo-description-content">
<p *ngIf="environment.presidencia" class="logo-description-text">Calendário Partilhado</p>
<p *ngIf="!environment.presidencia" class="logo-description-text" >Presidente República</p>
<p *ngIf="!environment.presidencia" class="logo-description-text" ></p>
<div class="add-line"></div>
<p *ngIf="!environment.presidencia" class="logo-description-text" >GABINETE DIGITAL</p>
</div>