mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
check notification and inactivity
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Injectable, NgZone } from '@angular/core';
|
||||
import { StorageService } from '../services/storage.service';
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
@Injectable({
|
||||
@@ -13,6 +13,7 @@ export class NotificationHolderService {
|
||||
|
||||
constructor(
|
||||
private storageService: StorageService,
|
||||
private zone: NgZone,
|
||||
) {
|
||||
|
||||
try {
|
||||
@@ -106,19 +107,32 @@ export class NotificationHolderService {
|
||||
}
|
||||
}
|
||||
|
||||
if(this.notificationExist(notificationObject)) {
|
||||
if(!this.notificationExist(notificationObject)) {
|
||||
this._notificationList.push(notificationObject)
|
||||
this.reverse()
|
||||
this.save()
|
||||
|
||||
this.zone.run(()=>{
|
||||
this.reverse()
|
||||
this.save()
|
||||
})
|
||||
|
||||
|
||||
} else {
|
||||
console.log('duplicate', notification, this._notificationList)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
notificationExist(notificationObject) {
|
||||
return this._notificationList.find(item => {
|
||||
const notification = this._notificationList.find(item => {
|
||||
return item.id === notificationObject.id;
|
||||
});
|
||||
|
||||
if(notification?.id) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,8 +150,11 @@ export class NotificationHolderService {
|
||||
return e.index != notification.index
|
||||
})
|
||||
|
||||
this.reverse()
|
||||
this.save()
|
||||
|
||||
this.zone.run(()=>{
|
||||
this.save()
|
||||
this.reverse()
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@ class SessionService {
|
||||
|
||||
permission = {
|
||||
Agenda: {
|
||||
access: false
|
||||
access: false
|
||||
},
|
||||
Gabinete: {
|
||||
access: false,
|
||||
pr_tasks: false,
|
||||
access: false,
|
||||
pr_tasks: false,
|
||||
md_tasks: false,
|
||||
aprove_event: false
|
||||
aprove_event: false
|
||||
},
|
||||
Actions: {
|
||||
access : false,
|
||||
@@ -40,12 +40,18 @@ class SessionService {
|
||||
}
|
||||
}
|
||||
|
||||
hasPassLogin = false
|
||||
|
||||
constructor() {
|
||||
|
||||
this.keyName = (SHA1("SessionService")).toString()
|
||||
let restore = this.getDataFromLocalStorage()
|
||||
this._user = restore.user || new UserSession()
|
||||
|
||||
if(this._user.LoginPreference == 'Pin') {
|
||||
this._user.Inactivity = false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
getDataFromLocalStorage() {
|
||||
@@ -138,7 +144,7 @@ class SessionService {
|
||||
if (names.length > 1) {
|
||||
initials += names[names.length - 1].substring(0, 1).toUpperCase();
|
||||
}
|
||||
|
||||
|
||||
return initials;
|
||||
}
|
||||
|
||||
@@ -149,7 +155,7 @@ class SessionService {
|
||||
if (names.length > 1) {
|
||||
initials += names[names.length - 1].substring(0, 1).toUpperCase();
|
||||
}
|
||||
|
||||
|
||||
return initials;
|
||||
}
|
||||
|
||||
@@ -157,13 +163,13 @@ class SessionService {
|
||||
clearPermission() {
|
||||
this.permission = {
|
||||
Agenda: {
|
||||
access: false
|
||||
access: false
|
||||
},
|
||||
Gabinete: {
|
||||
access: false,
|
||||
pr_tasks: false,
|
||||
access: false,
|
||||
pr_tasks: false,
|
||||
md_tasks: false,
|
||||
aprove_event: false
|
||||
aprove_event: false
|
||||
},
|
||||
Actions: {
|
||||
access : false,
|
||||
|
||||
Reference in New Issue
Block a user