diff --git a/src/app/guards/inactivity.guard.ts b/src/app/guards/inactivity.guard.ts index 07758c649..e4cd3f7a8 100644 --- a/src/app/guards/inactivity.guard.ts +++ b/src/app/guards/inactivity.guard.ts @@ -22,30 +22,17 @@ export class InactivityGuard implements CanActivate { state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { - if(SessionStore.exist && SessionStore.user.Inactivity && !SessionStore.hasPin ) { - return true - } else if(SessionStore.exist && !SessionStore.user.Inactivity) { - return true - }//Mobile or Tablet without session - else { - + if (this.platform.is('desktop') || this.platform.is('mobileweb')) { if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){ - //When user has got access to Agenda but does not have their own calendar, goes to Agenda - if(this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0){ - this.router.navigate(['/home/agenda']); - } - else{ - this.router.navigate(['/home/events']); - } + this.router.navigate(['/home/events']); } - //If user has access permission to both Chat and Action, goes to Chat by default. - else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){ + else if(this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)){ this.router.navigate(['/home/chat']); } else if(this.p.userPermission(this.p.permissionList.Actions.access)) { this.router.navigate(['/home/publications']); - } - else { + } else { + this.alertController.create({ cssClass: 'my-custom-class', header: 'Utilizador sem acesso a aplicação', @@ -58,6 +45,38 @@ export class InactivityGuard implements CanActivate { }).then( async (alertPopup) => { await alertPopup.present(); }) + + } + + return false + } else if(SessionStore.exist && SessionStore.user.Inactivity && !SessionStore.hasPin ) { + return true + } else if(SessionStore.exist && !SessionStore.user.Inactivity) { + return true + }//Mobile or Tablet without session + else { + + if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){ + this.router.navigate(['/home/events']); + } + else if(this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)){ + this.router.navigate(['/home/chat']); + } + else if(this.p.userPermission(this.p.permissionList.Actions.access)){ + this.router.navigate(['/home/publications']); + } else { + this.alertController.create({ + cssClass: 'my-custom-class', + header: 'Utilizador sem acesso a aplicação', + buttons: [{ + text: 'Ok', + handler: () => { + + } + }] + }).then( async (alertPopup)=>{ + await alertPopup.present(); + }) } return false } diff --git a/src/app/pages/chat/group-messages/group-messages.page.ts b/src/app/pages/chat/group-messages/group-messages.page.ts index 54123c486..bd869ddab 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.ts +++ b/src/app/pages/chat/group-messages/group-messages.page.ts @@ -144,7 +144,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { this.wsChatMethodsService.getUserOfRoom(this.roomId).then((value) => { }) - VoiceRecorder.requestAudioRecordingPermission(); + //this.loadFiles(); } @@ -289,6 +289,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { } async startRecording() { + VoiceRecorder.requestAudioRecordingPermission(); if(await VoiceRecorder.canDeviceVoiceRecord().then((result: GenericResponse) =>{return result.value})){ if(await VoiceRecorder.requestAudioRecordingPermission().then((result: GenericResponse) => {return result.value})){ //if(await this.hasAudioRecordingPermission()){ diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index 75797766c..0f8c1a5df 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -159,7 +159,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { this.wsChatMethodsService.getUserOfRoom(this.roomId).then((value) => { }) - VoiceRecorder.requestAudioRecordingPermission(); + this.getChatMembers(); } @@ -222,6 +222,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { } async startRecording() { + VoiceRecorder.requestAudioRecordingPermission(); if(await VoiceRecorder.canDeviceVoiceRecord().then((result: GenericResponse) =>{return result.value})){ if(await VoiceRecorder.requestAudioRecordingPermission().then((result: GenericResponse) => {return result.value})){ //if(await this.hasAudioRecordingPermission()){ diff --git a/src/app/pages/chat/new-group/new-group.page.ts b/src/app/pages/chat/new-group/new-group.page.ts index d3e904aab..e1c5889df 100644 --- a/src/app/pages/chat/new-group/new-group.page.ts +++ b/src/app/pages/chat/new-group/new-group.page.ts @@ -120,7 +120,7 @@ export class NewGroupPage implements OnInit { return await popover.present(); } - async showPicker(){ + async showPicker() { const picker = await this.pickerController.create({ cssClass: '', buttons: [ diff --git a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts index 066ebd408..db03f7f29 100644 --- a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts +++ b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts @@ -324,8 +324,7 @@ export class BookMeetingModalPage implements OnInit { loader.remove() } } - else{ - // alert(JSON.stringify(this.task)) + else { this.toastService._successMessage('Não é possível marcar a reunião de momento'); } diff --git a/src/app/shared/chat/group-messages/group-messages.page.ts b/src/app/shared/chat/group-messages/group-messages.page.ts index a7e6989bb..337d38c30 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.ts +++ b/src/app/shared/chat/group-messages/group-messages.page.ts @@ -166,7 +166,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe }, 1000); this.getChatMembers(); //this.getMessageDB(); - VoiceRecorder.requestAudioRecordingPermission(); + this.deleteRecording(); this.loadFiles(); } @@ -298,6 +298,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe } async startRecording() { + VoiceRecorder.requestAudioRecordingPermission(); if(await VoiceRecorder.canDeviceVoiceRecord().then((result: GenericResponse) =>{return result.value})){ if(await VoiceRecorder.requestAudioRecordingPermission().then((result: GenericResponse) => {return result.value})){ //if(await this.hasAudioRecordingPermission()){ diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts index 51b906f3a..d73b88d6b 100644 --- a/src/app/shared/chat/messages/messages.page.ts +++ b/src/app/shared/chat/messages/messages.page.ts @@ -157,7 +157,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy this.scrollToBottom(); this.getChatMembers(); - VoiceRecorder.requestAudioRecordingPermission(); + this.deleteRecording(); this.loadFiles(); } @@ -287,8 +287,9 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy } async startRecording() { - if(await VoiceRecorder.canDeviceVoiceRecord().then((result: GenericResponse) =>{return result.value})) { - if(await VoiceRecorder.requestAudioRecordingPermission().then((result: GenericResponse) => {return result.value})) { + VoiceRecorder.requestAudioRecordingPermission(); + if(await VoiceRecorder.canDeviceVoiceRecord().then((result: GenericResponse) =>{return result.value})){ + if(await VoiceRecorder.requestAudioRecordingPermission().then((result: GenericResponse) => {return result.value})){ //if(await this.hasAudioRecordingPermission()){ if (this.recording) { return; @@ -298,11 +299,11 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy this.calculateDuration(); //} } - else{ + else { this.toastService._badRequest('Para gravar uma mensagem de voz, permita o acesso do Gabinete Digital ao seu microfone.'); } } - else{ + else { this.toastService._badRequest('Este dispositivo não tem capacidade para gravação de áudio!'); } }