mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
1 line
14 KiB
JSON
1 line
14 KiB
JSON
|
|
{"ast":null,"code":"import _asyncToGenerator from \"C:/Users/eudes.inacio/GabineteDigital/gabinete-digital-fo/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { __decorate } from \"tslib\";\nimport { Injectable } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { SessionStore } from '../store/session.service';\nimport { AlertController, Platform } from '@ionic/angular';\nimport { PermissionService } from '../services/permission.service';\nimport { FirstEnterService } from '../services/first-enter.service';\nlet InactivityGuard = class InactivityGuard {\n constructor(router, platform, p, alertController, FirstEnterService) {\n this.router = router;\n this.platform = platform;\n this.p = p;\n this.alertController = alertController;\n this.FirstEnterService = FirstEnterService;\n }\n canActivate(route, state) {\n // console.log('hire inactinity!', state.url)\n if (this.platform.is('desktop') || this.platform.is('mobileweb')) {\n if (this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)) {\n //When user has got access to Agenda but does not have their own calendar, goes to Agenda\n if (this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0) {\n this.router.navigate(['/home/agenda']);\n } else {\n this.router.navigate(['/home/events']);\n }\n } else if (this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) {\n this.router.navigate(['/home/chat']);\n } else if (this.p.userPermission(this.p.permissionList.Actions.access)) {\n this.router.navigate(['/home/publications']);\n } else {\n this.alertController.create({\n cssClass: 'my-custom-class',\n header: 'Utilizador sem acesso a aplicação',\n buttons: [{\n text: 'Ok',\n handler: () => {}\n }]\n }).then( /*#__PURE__*/function () {\n var _ref = _asyncToGenerator(function* (alertPopup) {\n yield alertPopup.present();\n });\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }());\n }\n return false;\n } else if (SessionStore.exist && SessionStore.user.Inactivity && !SessionStore.hasPin) {\n // set pin\n return true;\n } else if (SessionStore.exist && !SessionStore.user.Inactivity && SessionStore.user.LoginPreference == 'Pin') {\n // inactivity login\n return true;\n } else if (!SessionStore.user.Inactivity && this.platform.is('mobile')) {\n // try to login\n return true;\n } else if (SessionStore.user.LoginPreference != 'Pin' && SessionStore.hasPin) {\n // no right to be in this page\n this.router.navigateByUrl('/', {\n replaceUrl: true\n });\n return false;\n } //Mobile or Tablet without session\n else {\n if (SessionStore?.user?.Inactivity) {\n if (this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)) {\n //When user has got access to Agenda but does not have their own calendar, goes to Agenda\n if (this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0) {\n this.router.navigate(['/home/agenda']);\n } else {\n this.router.navigate(['/home/events']);\n }\n } else if (this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) {\n this.router.navigate(['/home/chat']);\n } else if (this.p.userPermission(this.p.permissionList.Actions.access)) {\n this.router.navigate(['/home/publications']);\n } else {\n this.alertController.create({\n cssClass: 'my-custom-class',\n header: 'Utilizador sem acesso
|