Lot of changes

This commit is contained in:
Eudes Inácio
2021-11-09 17:23:39 +01:00
parent 308e5b36fe
commit bef79d674b
29 changed files with 84 additions and 247 deletions
+5
View File
@@ -2162,6 +2162,11 @@
"resolved": "https://registry.npmjs.org/@capacitor/keyboard/-/keyboard-1.1.2.tgz",
"integrity": "sha512-EUduhQzrHma4PlGfdSxVeGIwxR2+/xLRDbjQH5Q4cXqrlYssIX2UyQrL4wNpDaAOg1Z4VD8EzzVolC81LG6Q+A=="
},
"@capacitor/network": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/@capacitor/network/-/network-1.0.6.tgz",
"integrity": "sha512-xkkmRLlFcg1dM0WfblxKwcKFjcfBQ04yWYX0ubD/n5QfQjLCCb8GbAHlorqIyt2j4PUvSAb0ERLyL89hpKlh2w=="
},
"@capacitor/push-notifications": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/@capacitor/push-notifications/-/push-notifications-1.0.7.tgz",
+1
View File
@@ -36,6 +36,7 @@
"@capacitor/core": "^3.3.0",
"@capacitor/haptics": "^1.1.2",
"@capacitor/keyboard": "^1.1.2",
"@capacitor/network": "^1.0.6",
"@capacitor/push-notifications": "^1.0.7",
"@capacitor/status-bar": "^1.0.5",
"@fortawesome/angular-fontawesome": "^0.9.0",
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 58 KiB

+3 -4
View File
@@ -6,7 +6,7 @@ import { AuthService } from 'src/app/services/auth.service';
import { LocalstoreService } from 'src/app/store/localstore.service';
import { EditProfilePage } from './edit-profile/edit-profile.page';
import { StorageService } from '../../services/storage.service';
/* import { NotificationsService } from '../../services/notifications.service'; */
import { NotificationsService } from '../../services/notifications.service';
import { SessionStore } from 'src/app/store/session.service';
import { EventTrigger } from '../../services/eventTrigger.service';
import { ThemeService } from 'src/app/services/theme.service'
@@ -38,9 +38,8 @@ export class ProfilePage implements OnInit {
private localstoreService: LocalstoreService,
private storageservice: StorageService,
private zone: NgZone,
/* private notificationservice: NotificationsService, */
private notificationservice: NotificationsService,
private platform: Platform,
/* private notificationsService: NotificationsService, */
private eventtrigger: EventTrigger,
public ThemeService: ThemeService
) {
@@ -189,7 +188,7 @@ export class ProfilePage implements OnInit {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', IdObject, 'gabinete-digital']));
}
//this.notificationservice.tempClearArray();
this.notificationservice.tempClearArray();
this.deleteNotification(index);
this.eventtrigger.publishSomeData({
notification: "deleted"
@@ -68,7 +68,7 @@
--border-radius: 5px;
--box-shadow: none;
overflow: auto;
--icon-color:#0d89d1;
--icon-color: var(--font-awesome);
}
}
@@ -120,14 +120,14 @@
}
.members-checkbox ion-checkbox{
--border-color: #0d89d1;
--background-checked:#0d89d1;
--border-color: var(--title-text-color);
--background-checked:var(--title-text-color);
float: left;
}
.item-checkbox ion-checkbox{
--border-color: #0d89d1;
--background-checked:#0d89d1;
--border-color: var(--title-text-color);
--background-checked:var(--title-text-color);
float: left;
}
@@ -137,7 +137,7 @@
width: 330px;
padding-left: 10px;
font-size: 15px;
color: #0d89d1;
color: var(--title-text-color);
float: left;
}
.item-checkbox ion-icon, .members-checkbox ion-icon{
@@ -69,7 +69,7 @@
--border-radius: 5px;
--box-shadow: none;
overflow: auto;
--icon-color:#0d89d1;
--icon-color:var(--title-text-color);
}
}
@@ -102,8 +102,8 @@ ion-content{
}
.item-checkbox ion-checkbox{
--border-color: #0d89d1;
--background-checked:#0d89d1;
--border-color: var(--title-text-color);
--background-checked:var(--title-text-color);
float: left;
}
@@ -113,7 +113,7 @@ ion-content{
width: 330px;
padding-left: 10px;
font-size: 15px;
color: #0d89d1;
color: var(--title-text-color);
float: left;
}
.item-checkbox ion-icon{
+12 -12
View File
@@ -1,6 +1,7 @@
import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs'
import { Platform } from '@ionic/angular'
import { Network } from '@capacitor/network';
@Injectable({
providedIn: 'root'
@@ -9,20 +10,19 @@ import { Platform } from '@ionic/angular'
export class NetworkConnectionService {
online: boolean = true;
constructor(){}
checkOnline() {
window.addEventListener('online', (on) => {
this.online === true;
console.log('Became online');
constructor(){
Network.addListener('networkStatusChange', status => {
console.log('Network status changed', status);
});
}
checkOffline() {
window.addEventListener('offline', (off) => {
this.online === false;
console.log('Became offline')
});
}
logCurrentNetworkStatus = async () => {
const status = await Network.getStatus();
return status;
};
}
+33 -194
View File
@@ -162,220 +162,59 @@ export class NotificationsService {
);
}
/*
async onReceviNotification() {
this.fcm.onNotification().subscribe(data => {
if (data.click_action) {
console.log("Received in background: ", data);
this.notificatinsRoutes(data)
} else {
console.log("Received in foreground: ", data);
console.log(data.Service)
console.log(data.Object)
console.log(data.IdObject)
this.DataArray.push(data)
console.log("On ReceiveNotification", this.DataArray)
this.storageService.store("Notifications", this.DataArray)
};
});
} */
/////////////////////////////////////////////////////
/* getTokenByUserIdAndId(user, userID) {
const geturl = environment.apiURL + 'notifications/user/' + userID;
return this.http.get<Token[]>(`${geturl}`);
}
*/
/* getAndpostToken(username) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
//console.log('Notifications not supported')
} else {
const geturl = environment.apiURL + 'notifications/token';
if(window['WLAuthorizationManager']) {
if(window['WLAuthorizationManager'].obtainAccessToken) {
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
(token) => {
console.log('Push Notification: Success ' + token);
window['MFPPush'].initialize(
function (successResponse) {
console.log("Push notification Successfully Service intialized: " + successResponse);
},
function (failureResponse) {
console.log("Push notification failure Service intialized: " + failureResponse);
}
);
window['MFPPush'].registerDevice(null, async (successResponse) => {
console.log("Successfully registered: " + JSON.stringify(successResponse));
console.log('token: ', successResponse.deviceId)
await this.storageService.store(username, successResponse.deviceId).then((tokennoti) => {
console.log('token store',tokennoti)
});
await this.storageService.get(username).then(value => {
console.log('STORAGE TOKEN', value)
this.storageService.get(AuthConnstants.USER).then(res => {
console.log('USERID', res);
const headers = { 'Authorization': SessionStore.user.BasicAuthKey };
const body = {
UserId: res.UserId,
TokenId: successResponse.deviceId,
Status: 1,
Service: 1
};
this.http.post<Token>(`${geturl}`, body, { headers }).subscribe(data => {
console.log('TOKEN USER MIDLE', data);
})
});
});
},
function (failureResponse) {
console.log("Successfully failue: " + JSON.stringify(failureResponse));
}
);
}, (error) => {
console.log('Push notification recived: failure ' + error.responseText);
console.log(JSON.stringify(error));
}
);
}
}
}
} */
tempClearArray() {
this.DataArray = new Array;
}
/* async onReceviNotification() {
if(window['WLAuthorizationManager']) {
if(window['WLAuthorizationManager'].obtainAccessToken) {
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
(token) => {
console.log('Push Notification: Success ' + token);
window['MFPPush'].initialize(
function (successResponse) {
console.log("Push notification Successfully intialized: " + successResponse);
window['MFPPush'].registerNotificationsCallback(notificationReceived);
},
function (failureResponse) {
console.log("Push notification failure intialized: " + failureResponse);
}
);
var notificationReceived = (message) => {
//this.jsonstore.createCollection('Notifications',message);
this.DataArray.push(message)
console.log("On ReceiveNotification", this.DataArray)
this.storageService.store("Notifications",this.DataArray)
console.log(message);
this.eventtrigger.publishSomeData({
notification: "recive"
})
var data = JSON.parse(message.payload);
//synchro.$send(data)
console.log('data.Service', data.Service); // module
console.log('data.IdObject', data.IdObject); // Object id
console.log('data.Object', data.Object); // details
if(message.actionName){
this.notificatinsRoutes(data);
} else {
/* this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
//this.notificatinsRoutes(data);
console.log(data)
}
this.callbacks.forEach( e=> {
if(e.type == data.Object || e.type == "any") {
e.funx()
}
})
}
}, (error) => {
console.log('Push notification recived: failure ' + error.responseText);
console.log(JSON.stringify(error));
}
);
}
}
} */
notificatinsRoutes = (notification) => {
if (notification.data.Service === "agenda") {
this.zone.run(() => this.router.navigate(['/home/agenda', notification.data.IdObject, 'agenda']));
}
else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "expediente") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', notification.data.IdObject, 'gabinete-digital']));
}
else if (notification.data.Service === "agenda" && notification.data.Object === "event-list") {
this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', notification.data.IdObject, 'agenda']));
} else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "despachos") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', notification.data.IdObject, 'gabinete-digital'], { replaceUrl: true }));
}
else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "parecer") {
console.log('Push action performed 2222: ' + JSON.stringify(notification.data));
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.data.IdObject, 'gabinete-digital']));
if (notification.notification.data.Service === "agenda" && notification.notification.data.IdObject.length > 10) {
console.log("Id Lenght", notification.notification.data.IdObject.length)
this.zone.run(() => this.router.navigate(['/home/agenda', notification.notification.data.IdObject, 'agenda']));
}
else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "deferimento") {
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expediente") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', notification.notification.data.IdObject, 'gabinete-digital']));
}
else if (notification.notification.data.Service === "agenda" && notification.notification.data.Object === "event-list") {
//this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',IdObject, 'agenda']));
this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', notification.notification.data.IdObject, 'agenda']));
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.data.IdObject, 'gabinete-digital']));
}
else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "despachos-pr") {
} else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "despachos") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos-pr', notification.data.IdObject, 'gabinete-digital']));
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', notification.notification.data.IdObject, 'gabinete-digital'], { replaceUrl: true }));
}
else if (notification.data.Service === "accoes" && notification.data.Object === "accao") {
this.zone.run(() => this.router.navigate(['/home/publications', notification.data.IdObject]));
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "parecer") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.IdObject, 'gabinete-digital']));
}
else if (notification.data.Service === "accoes" && notification.data.Object === "publicacao") {
this.zone.run(() => this.router.navigate(['/home/publications/view-publications', notification.data.FolderId, notification.data.IdObject]));
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "deferimento") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.IdObject, 'gabinete-digital']));
}
else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "diplomas") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', notification.data.IdObject, 'gabinete-digital']));
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "despachos-pr") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos-pr', notification.notification.data.IdObject, 'gabinete-digital']));
}
else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "diplomas-assinar") {
let navigationExtras: NavigationExtras = {
queryParams: {
"serialNumber": notification.data.IdObject,
else if (notification.notification.data.Service === "accoes" && notification.notification.data.Object === "accao") {
this.zone.run(() => this.router.navigate(['/home/publications', notification.notification.data.IdObject]));
}
};
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar/diploma-assinar'], navigationExtras));
else if (notification.notification.data.Service === "accoes" && notification.notification.data.Object === "publicacao") {
this.zone.run(() => this.router.navigate(['/home/publications/view-publications', notification.notification.data.FolderId, notification.data.IdObject]));
}
else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "expedientes-pr") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', notification.data.IdObject, 'gabinete-digital']));
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diplomas") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', notification.notification.data.IdObject, 'gabinete-digital']));
}
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diplomas-assinar") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar', notification.notification.data.IdObject, 'gabinete-digital']));
}
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expedientes-pr") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', notification.notification.data.IdObject, 'gabinete-digital']));
}
platformVerify() {
if (this.platform.is('cordova')) {
} else {
}
}
}
+1 -1
View File
@@ -16,7 +16,7 @@
<img *ngIf="ThemeService.currentTheme == 'tribunal' " src='assets/images/theme/tribunal/tribunal-constitucional.png' alt='logo'>
</div>
<div class="div-profile cursor-pointer" (click)="openProfile()">
<div *ngIf="this.notificationLength > 0" class="icon-badge">{{this.notificationLength}}</div>
<div *ngIf="this.notificationLength > 0" class="icon-badge">{{notificationLength}}</div>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="icon" src='assets/images/icons-profile.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="icon" src='assets/images/theme/gov/icons-profile.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'tribunal' " class="icon" src='assets/images/theme/tribunal/icons-profile.svg'></ion-icon>
+12 -19
View File
@@ -27,6 +27,7 @@ export class HeaderPage implements OnInit {
DataArray: Array<object> = [];
notificationLength: 0;
SessionStore = SessionStore
check: boolean;
production = environment.production
@@ -49,31 +50,22 @@ export class HeaderPage implements OnInit {
ngOnInit() {
this.hideSearch();
this.notificationLengthData();
this.eventrigger.getObservable().subscribe((data) => {
this.update()
/* this.notificationLengthData();
this.eventrigger.getObservable().subscribe(async (data) => {
if (data.notification === "delete" || "recive") {
setInterval(()=>
{
this.notificationLengthData();
console.log('SETTIMEOUT')
}, 1000);
//clearInterval(timer)
await this.notificationLengthData();
console.log('Current badge: ', this.notificationLength)
console.log('Deleted notification', data)
console.log('Deleted notification', data.notification)
}
})
/* if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
console.log('Notifications not supported')
this.UpdateNotificationCount();
} else {
this.UpdateNotificationCount();
} */
}) */
}
update() {
setInterval(() => {
this.notificationLengthData();
}, 5000)
}
@@ -94,9 +86,10 @@ export class HeaderPage implements OnInit {
/* var data = JSON.parse(value); */
this.notificationLength = value.length;
console.log('Timer badge count 1', this.notificationLength)
})
console.log('Timer badge count', this.notificationLength)
console.log('Timer badge count2', this.notificationLength)
}
hideSearch() {