check notification and inactivity

This commit is contained in:
Peter Maquiran
2023-09-28 09:02:15 +01:00
parent b46d179dfe
commit 8de8a35bfc
11 changed files with 93 additions and 60 deletions
-3
View File
@@ -14,9 +14,6 @@ export class AuthGuard implements CanActivate {
constructor( constructor(
private router:Router, private router:Router,
public p: PermissionService, public p: PermissionService,
private RouteService: RouteService,
private FirstEnterService: FirstEnterService,
private alertController: AlertController,
){} ){}
canActivate( canActivate(
-1
View File
@@ -13,7 +13,6 @@ export class LoginGuard implements CanActivate {
constructor( constructor(
private router:Router, private router:Router,
private platform: Platform, private platform: Platform,
private RouteService: RouteService,
private FirstEnterService: FirstEnterService ) { private FirstEnterService: FirstEnterService ) {
} }
+2 -2
View File
@@ -125,8 +125,6 @@ export class LoginPage implements OnInit {
loader.remove() loader.remove()
console.log('attempt', attempt)
if (attempt) { if (attempt) {
if (attempt.UserId == SessionStore.user.UserId) { if (attempt.UserId == SessionStore.user.UserId) {
@@ -146,6 +144,7 @@ export class LoginPage implements OnInit {
this.getToken(); this.getToken();
SessionStore.setInativity(true); SessionStore.setInativity(true);
SessionStore.hasPassLogin = true;
this.goback(); this.goback();
@@ -187,6 +186,7 @@ export class LoginPage implements OnInit {
this.router.navigate(['/home/events']); this.router.navigate(['/home/events']);
} }
SessionStore.hasPassLogin = true;
} }
}/* }/*
@@ -9,7 +9,7 @@ import { ViewPublicationsPageRoutingModule } from './view-publications-routing.m
import { ViewPublicationsPage } from './view-publications.page'; import { ViewPublicationsPage } from './view-publications.page';
import { Attributes, IntersectionObserverHooks, LazyLoadImageModule, LAZYLOAD_IMAGE_HOOKS } from 'ng-lazyload-image'; import { Attributes, IntersectionObserverHooks, LazyLoadImageModule, LAZYLOAD_IMAGE_HOOKS } from 'ng-lazyload-image';
import { ShowMorePageModule } from 'src/app/shared/publication/view-publications/show-more/show-more.module'
export class LazyLoadImageHooks extends IntersectionObserverHooks { export class LazyLoadImageHooks extends IntersectionObserverHooks {
setup(attributes: Attributes) { setup(attributes: Attributes) {
attributes.offset = 10; attributes.offset = 10;
@@ -26,7 +26,9 @@ setup(attributes: Attributes) {
IonicModule, IonicModule,
ViewPublicationsPageRoutingModule, ViewPublicationsPageRoutingModule,
LazyLoadImageModule LazyLoadImageModule,
//page
ShowMorePageModule,
], ],
exports: [ViewPublicationsPage], exports: [ViewPublicationsPage],
declarations: [ViewPublicationsPage], declarations: [ViewPublicationsPage],
@@ -32,11 +32,9 @@
<p class="px-20 item-content-detail font-14-em">{{publicationFolderService.FolderDetails[folderId].Detail}}</p> <p class="px-20 item-content-detail font-14-em">{{publicationFolderService.FolderDetails[folderId].Detail}}</p>
<ion-card *ngFor="let publication of publicationFolderService.publicationList[folderId] let i = index" <ion-card *ngFor="let publication of publicationFolderService.publicationList[folderId] let i = index">
(click)="goToPublicationDetail(publication.DocumentId, publication.ProcessId)"
>
<ion-card-content> <ion-card-content>
<div class="post-img"> <div class="post-img" (click)="goToPublicationDetail(publication.DocumentId, publication.ProcessId)">
<img [lazyLoad]="publication.FileBase64"> <img [lazyLoad]="publication.FileBase64">
</div> </div>
<div class="post-content"> <div class="post-content">
@@ -47,7 +45,10 @@
<div class="post-data font-13-em">{{publication.DatePublication | date: 'dd-MM-yyyy HH:mm'}}</div> <div class="post-data font-13-em">{{publication.DatePublication | date: 'dd-MM-yyyy HH:mm'}}</div>
</div> </div>
<div class="post-description "> <div class="post-description ">
<pre class="text font-14-em">{{publication.Message}}</pre> <!-- <pre class="text font-14-em">{{publication.Message}}</pre> -->
<app-show-more
[text]=publication.Message
></app-show-more>
</div> </div>
</div> </div>
</ion-card-content> </ion-card-content>
@@ -124,13 +124,21 @@
} }
.post-img{ .post-img{
width: 100%; width: 100%;
//height: 400px; height: 100%;
margin: 0 auto;
border-radius: 0px!important; max-height: 400px;
min-height: 350px;
min-width: 350px;
margin: 5px auto;
border-radius: 0px !important;
overflow: hidden; overflow: hidden;
background-color: white; background-color: white;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center;
background: black;
} }
.post-img img{ .post-img img{
@@ -103,6 +103,7 @@ export class NotificationsService {
// this.storenotification(notification) // this.storenotification(notification)
} }
); );
@@ -199,6 +199,7 @@ export class NotificationsService {
(notification: ActionPerformed) => { (notification: ActionPerformed) => {
this.active = true this.active = true
console.log('NOtification Listener Backgroud', notification) console.log('NOtification Listener Backgroud', notification)
/* this.DataArray.push(notification.notification) /* this.DataArray.push(notification.notification)
this.storageService.store("Notifications", this.DataArray) this.storageService.store("Notifications", this.DataArray)
@@ -54,6 +54,7 @@
</div> </div>
<div class="d-block justify-space-between"> <div class="d-block justify-space-between">
<!-- <pre *ngIf="msg.delate == false" class="message-box text ma-0 font-13-rem" style="font-size: 0.8125rem !important;" >{{msg.msg}} </pre> -->
<ion-label *ngIf="msg.delate == false" class="message-box">{{msg.msg}} </ion-label> <ion-label *ngIf="msg.delate == false" class="message-box">{{msg.msg}} </ion-label>
<ion-label *ngIf="msg.delate == true" class="flex-0">Apagou a mensagem</ion-label> <ion-label *ngIf="msg.delate == true" class="flex-0">Apagou a mensagem</ion-label>
+21 -4
View File
@@ -1,4 +1,4 @@
import { Injectable } from '@angular/core'; import { Injectable, NgZone } from '@angular/core';
import { StorageService } from '../services/storage.service'; import { StorageService } from '../services/storage.service';
import { v4 as uuidv4 } from 'uuid' import { v4 as uuidv4 } from 'uuid'
@Injectable({ @Injectable({
@@ -13,6 +13,7 @@ export class NotificationHolderService {
constructor( constructor(
private storageService: StorageService, private storageService: StorageService,
private zone: NgZone,
) { ) {
try { try {
@@ -106,19 +107,32 @@ export class NotificationHolderService {
} }
} }
if(this.notificationExist(notificationObject)) { if(!this.notificationExist(notificationObject)) {
this._notificationList.push(notificationObject) this._notificationList.push(notificationObject)
this.zone.run(()=>{
this.reverse() this.reverse()
this.save() this.save()
})
} else {
console.log('duplicate', notification, this._notificationList)
} }
} }
notificationExist(notificationObject) { notificationExist(notificationObject) {
return this._notificationList.find(item => { const notification = this._notificationList.find(item => {
return item.id === notificationObject.id; 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 return e.index != notification.index
}) })
this.reverse()
this.zone.run(()=>{
this.save() this.save()
this.reverse()
})
} }
} }
+6
View File
@@ -40,12 +40,18 @@ class SessionService {
} }
} }
hasPassLogin = false
constructor() { constructor() {
this.keyName = (SHA1("SessionService")).toString() this.keyName = (SHA1("SessionService")).toString()
let restore = this.getDataFromLocalStorage() let restore = this.getDataFromLocalStorage()
this._user = restore.user || new UserSession() this._user = restore.user || new UserSession()
if(this._user.LoginPreference == 'Pin') {
this._user.Inactivity = false
}
} }
getDataFromLocalStorage() { getDataFromLocalStorage() {