From 6674d459b1c98ce3388f48bbaf3faaa65fe52291 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Mon, 4 Jul 2022 14:08:51 +0100 Subject: [PATCH 1/3] improve --- .../view-document/view-document.page.ts | 1 - src/app/pages/chat/chat.page.html | 4 +- src/app/pages/chat/chat.page.ts | 10 ---- .../gabinete-digital/gabinete-digital.page.ts | 49 ------------------- src/app/pages/login/login.page.html | 2 + .../services/chat/ws-chat-methods.service.ts | 10 +++- 6 files changed, 13 insertions(+), 63 deletions(-) diff --git a/src/app/modals/view-document/view-document.page.ts b/src/app/modals/view-document/view-document.page.ts index 7499f72ba..e7da18647 100644 --- a/src/app/modals/view-document/view-document.page.ts +++ b/src/app/modals/view-document/view-document.page.ts @@ -46,7 +46,6 @@ export class ViewDocumentPage implements OnInit { this.processes.GetViewer(this.docId, this.applicationId).subscribe(res=> { const link: string = res; - console.log(res,' link!!!') this.trustedUrl = this.sanitazer.bypassSecurityTrustResourceUrl(link); }, ()=>{ this.close(); diff --git a/src/app/pages/chat/chat.page.html b/src/app/pages/chat/chat.page.html index 17440a86f..85354cb17 100644 --- a/src/app/pages/chat/chat.page.html +++ b/src/app/pages/chat/chat.page.html @@ -224,8 +224,8 @@ { - // if not mobile remove all component - if (window.innerWidth < 701) { - this.modalController.dismiss(); - this.segmentVista = "listview"; - } - else { - this.segmentVista = "boxview"; - } - }; - this.checkRoutes(); - } closeAllDesktopComponent() { this.desktopComponent = { @@ -173,42 +160,6 @@ export class GabineteDigitalPage implements OnInit { ngOnInit() { - if (window.innerWidth < 701) { - this.segmentVista = "listview"; - } - else { - this.segmentVista = "boxview" - } - - const pathname = window.location.pathname - this.router.events.forEach((event) => { - if (event instanceof NavigationEnd && event.url == pathname) { - - this.waitForDomService.selector({ - selector: 'app-gabinete-digital ion-content .aside-wrapper', - callback: () => { - this.checkRoutes(); - // console.log('FIRST CALL') - this.LoadCounts(); - } - }) - } - }); - - this.hideRefreshButton(); - - this.waitForDomService.selector({ - selector: 'app-gabinete-digital ion-content .aside-wrapper', - callback: () => { - // console.log('SECOND CALL') - this.loadAllProcesses(); - } - }) - - this.backgroundservice.registerBackService('Online', () => { - this.loadAllProcesses(); - }); - } diff --git a/src/app/pages/login/login.page.html b/src/app/pages/login/login.page.html index a012c390d..3c9ae6af4 100644 --- a/src/app/pages/login/login.page.html +++ b/src/app/pages/login/login.page.html @@ -44,3 +44,5 @@ + + diff --git a/src/app/services/chat/ws-chat-methods.service.ts b/src/app/services/chat/ws-chat-methods.service.ts index f6a1ce627..48614ec51 100644 --- a/src/app/services/chat/ws-chat-methods.service.ts +++ b/src/app/services/chat/ws-chat-methods.service.ts @@ -42,6 +42,8 @@ export class WsChatMethodsService { sessionStore = SessionStore loggedUser: any; + + delete = [] constructor( private WsChatService: WsChatService, @@ -68,7 +70,7 @@ export class WsChatMethodsService { this.WsChatService.registerCallback({ type: 'reConnect', - funx: ()=>{ + funx: () => { /** * @description when the phone is in the background for a long time it could disconnects from the socket then the socket reconnects automatically, * when the connection is lost the subscribe is also lost, so we have to subscribe again when reconnection is establish. @@ -363,10 +365,16 @@ export class WsChatMethodsService { deleteRoom(roomId) { + + this.delete.push(roomId) delete this.group[roomId]; this._group = this._group.filter((e)=> e.id != roomId); } + deleteRecently(roomId) { + return this.delete.includes(roomId) + } + roomExist(roomId) { return this.dm[roomId]?.id || this.group[roomId]?.id } From 2725bffc9fde9c93ab3e88de9c121ceab4fdf0e6 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Mon, 4 Jul 2022 14:57:27 +0100 Subject: [PATCH 2/3] improve --- .../pages/chat/messages/messages.page.html | 4 +- .../gabinete-digital.page.html | 4 +- .../gabinete-digital/gabinete-digital.page.ts | 47 +++++++++++++++++++ 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/src/app/pages/chat/messages/messages.page.html b/src/app/pages/chat/messages/messages.page.html index e64908279..14d283e3b 100644 --- a/src/app/pages/chat/messages/messages.page.html +++ b/src/app/pages/chat/messages/messages.page.html @@ -47,7 +47,7 @@
-
Apagou a mensagem
-
+
diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.html b/src/app/pages/gabinete-digital/gabinete-digital.page.html index 153db1b2f..3ea279daa 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.html +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.html @@ -30,12 +30,14 @@ - +
+ +
diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.ts b/src/app/pages/gabinete-digital/gabinete-digital.page.ts index f6ef619fd..ed5bc6f7e 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.ts +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.ts @@ -149,6 +149,19 @@ export class GabineteDigitalPage implements OnInit { public p: PermissionService ) { + this.loggeduser = authService.ValidatedUser; + window.onresize = (event) => { + // if not mobile remove all component + if (window.innerWidth < 701) { + this.modalController.dismiss(); + this.segmentVista = "listview"; + } + else { + this.segmentVista = "boxview"; + } + } + + this.checkRoutes(); } closeAllDesktopComponent() { this.desktopComponent = { @@ -160,7 +173,41 @@ export class GabineteDigitalPage implements OnInit { ngOnInit() { + if (window.innerWidth < 701) { + this.segmentVista = "listview"; + } + else { + this.segmentVista = "boxview" + } + const pathname = window.location.pathname + this.router.events.forEach((event) => { + if (event instanceof NavigationEnd && event.url == pathname) { + + this.waitForDomService.selector({ + selector: 'app-gabinete-digital ion-content .aside-wrapper', + callback: () => { + this.checkRoutes(); + // console.log('FIRST CALL') + this.LoadCounts(); + } + }) + } + }); + + this.hideRefreshButton(); + + this.waitForDomService.selector({ + selector: 'app-gabinete-digital ion-content .aside-wrapper', + callback: () => { + // console.log('SECOND CALL') + this.loadAllProcesses(); + } + }) + + this.backgroundservice.registerBackService('Online', () => { + this.loadAllProcesses(); + }); } async loadAllProcesses() { From 1a8be35a6e307ef994c41f5de41972ef72a42fa2 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Mon, 4 Jul 2022 16:45:44 +0100 Subject: [PATCH 3/3] improve --- src/app/guards/login.guard.ts | 2 +- src/app/models/user.model.ts | 2 +- .../pages/chat/messages/messages.page.html | 39 ++++--------------- .../gabinete-digital/gabinete-digital.page.ts | 1 - src/app/services/auth.service.ts | 2 + 5 files changed, 12 insertions(+), 34 deletions(-) diff --git a/src/app/guards/login.guard.ts b/src/app/guards/login.guard.ts index d035602a3..1cdddb1ea 100644 --- a/src/app/guards/login.guard.ts +++ b/src/app/guards/login.guard.ts @@ -18,7 +18,7 @@ export class LoginGuard implements CanActivate { canActivate( route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { - + if(SessionStore.exist && SessionStore.user.Inactivity && SessionStore.user.LoginPreference != 'Pin' ) { this.router.navigate(['/home/events']); return false diff --git a/src/app/models/user.model.ts b/src/app/models/user.model.ts index 29bc949cd..112d9725d 100644 --- a/src/app/models/user.model.ts +++ b/src/app/models/user.model.ts @@ -76,7 +76,7 @@ export class UserSession { UserName: string Password: string RochetChatUserId: string - Profile: 'PR' | 'MDGPR' | 'Consultant' | 'Department boss' | 'Assistant' | 'Director' | 'Deputy Director' | 'Secretariat' | 'Deputy Director' | 'General secretary' ; + Profile: 'PR' | 'MDGPR' | 'Consultant' | 'Department boss' | 'Assistant' | 'Director' | 'Deputy Director' | 'Secretariat' | 'Deputy Director' | 'General secretary' | 'Administrador'; LoginPreference: 'None' | 'Password' | 'Pin' | null; PIN: string Inactivity: boolean diff --git a/src/app/pages/chat/messages/messages.page.html b/src/app/pages/chat/messages/messages.page.html index 14d283e3b..d00f37b80 100644 --- a/src/app/pages/chat/messages/messages.page.html +++ b/src/app/pages/chat/messages/messages.page.html @@ -46,8 +46,8 @@
- -
-
+
@@ -127,8 +127,8 @@ {{file.title}} -
- +
+
@@ -147,7 +147,7 @@ {{file.description}} - + @@ -203,8 +203,8 @@
Apagou a mensagem
- - +
+
@@ -214,29 +214,6 @@ - - diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.ts b/src/app/pages/gabinete-digital/gabinete-digital.page.ts index ed5bc6f7e..463c479d2 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.ts +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.ts @@ -255,7 +255,6 @@ export class GabineteDigitalPage implements OnInit { allprocess.forEach(element => { let date = new Date(element.taskStartDate); date.setMonth(date.getMonth() + 1); - let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds(); let task = { "SerialNumber": element.serialNumber, diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index d8ad8cfb8..c55f09766 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -125,6 +125,8 @@ export class AuthService { } else if(session.RoleID == 99999886) { session.Profile = 'General secretary' + } else if (session.RoleID == 100000015) { + session.Profile = 'Administrador' } session.Password = user.password