mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
improve enter
This commit is contained in:
@@ -27,7 +27,36 @@ export class InactivityGuard implements CanActivate {
|
||||
|
||||
if ( (this.platform.is('desktop') || this.platform.is('mobileweb')) ) {
|
||||
|
||||
this.FirstEnterService.enter()
|
||||
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']);
|
||||
}
|
||||
}
|
||||
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
|
||||
} else if(SessionStore.exist && SessionStore.user.Inactivity && !SessionStore.hasPin ) {
|
||||
@@ -48,7 +77,34 @@ export class InactivityGuard implements CanActivate {
|
||||
else {
|
||||
|
||||
if((SessionStore?.user?.Inactivity)) {
|
||||
this.FirstEnterService.enter()
|
||||
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']);
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ export interface Message {
|
||||
rid: string;
|
||||
msg: string;
|
||||
ts: Ts;
|
||||
sendAttempt?: number
|
||||
u: U;
|
||||
from: 'Offline'|'History'|'stream'| 'send'
|
||||
t: string;
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||
</ion-label>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
@@ -106,7 +106,7 @@
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||
</ion-label>
|
||||
</div>
|
||||
<div *ngIf="msg.file.type != 'application/img'">
|
||||
@@ -160,7 +160,7 @@
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||
</ion-label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||
</ion-label>
|
||||
</div>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
@@ -101,7 +101,7 @@
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||
</ion-label>
|
||||
|
||||
</div>
|
||||
@@ -167,7 +167,7 @@
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||
</ion-label>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -152,7 +152,9 @@ export class EventsPage implements OnInit {
|
||||
console.error(error)
|
||||
})
|
||||
this.listToPresent = onwEvent;
|
||||
this.totalEvent = onwEvent.length;
|
||||
if(onwEvent?.length) {
|
||||
this.totalEvent = onwEvent.length;
|
||||
}
|
||||
this.showLoader = false;
|
||||
this.showAgendaLoader = false;
|
||||
} else {
|
||||
|
||||
@@ -198,7 +198,22 @@ export class LoginPage implements OnInit {
|
||||
if(pathName) {
|
||||
this.router.navigate([pathName]);
|
||||
} else {
|
||||
this.FirstEnterService.enter()
|
||||
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']);
|
||||
}
|
||||
}
|
||||
//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)){
|
||||
this.router.navigate(['/home/chat']);
|
||||
}
|
||||
else if(this.p.userPermission(this.p.permissionList.Actions.access)){
|
||||
this.router.navigate(['/home/publications']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ export class MessageService {
|
||||
private ChatSystemService: ChatSystemService) {
|
||||
}
|
||||
|
||||
setData({customFields = {}, channels, mentions, msg ,rid ,ts, u, t, _id, id, _updatedAt, file, attachments, temporaryData, localReference , viewed = [], received = [], delate = false, delateRequest =false, from }:Message) {
|
||||
setData({customFields = {}, channels, mentions, msg ,rid ,ts, u, t, _id, id, _updatedAt, file, attachments, temporaryData, localReference , viewed = [], received = [], delate = false, delateRequest =false, from, sendAttempt = 0 }:Message) {
|
||||
|
||||
this.channels = channels || []
|
||||
this.mentions = mentions || []
|
||||
@@ -88,6 +88,7 @@ export class MessageService {
|
||||
this.id = id
|
||||
this.delate = delate
|
||||
this.delateRequest = delateRequest
|
||||
this.sendAttempt = 0
|
||||
|
||||
if(this.attachments?.length >= 1 && attachments?.length >= 1) {
|
||||
this.attachments[0] = Object.assign(this.attachments[0], attachments[0])
|
||||
@@ -149,6 +150,7 @@ export class MessageService {
|
||||
async send(): Promise<any> {
|
||||
|
||||
this.sendAttempt++;
|
||||
this.manualRetry = false
|
||||
|
||||
if(!this.hasFile) {
|
||||
|
||||
@@ -220,7 +222,6 @@ export class MessageService {
|
||||
functionTimer = null;
|
||||
|
||||
async sendRequest(params) {
|
||||
|
||||
if(params?.attachments) {
|
||||
if(params?.attachments[0]?.image_url) {
|
||||
delete params?.attachments[0]?.image_url
|
||||
@@ -229,19 +230,39 @@ export class MessageService {
|
||||
|
||||
if(this.NetworkServiceService.getCurrentNetworkStatus() == ConnectionStatus.Online) {
|
||||
// console.log('online send')
|
||||
this.RochetChatConnectorService.send(params).then(
|
||||
(ChatMessage: any) => {
|
||||
ChatMessage = ChatMessage.message.result
|
||||
clearTimeout(this.functionTimer);
|
||||
|
||||
this.messageSend = true
|
||||
this.redefinedMessage(ChatMessage)
|
||||
|
||||
if(this.msg == '<script></script>') {
|
||||
if(this.sendAttempt >= 4) {
|
||||
this.RochetChatConnectorService.send(params).then(
|
||||
(ChatMessage: any) => {
|
||||
ChatMessage = ChatMessage.message.result
|
||||
clearTimeout(this.functionTimer);
|
||||
|
||||
this.messageSend = true
|
||||
this.redefinedMessage(ChatMessage)
|
||||
|
||||
}
|
||||
).catch((error) => {
|
||||
clearTimeout(this.functionTimer);
|
||||
console.error(error)
|
||||
})
|
||||
}
|
||||
).catch((error) => {
|
||||
clearTimeout(this.functionTimer);
|
||||
console.error(error)
|
||||
})
|
||||
|
||||
} else {
|
||||
this.RochetChatConnectorService.send(params).then(
|
||||
(ChatMessage: any) => {
|
||||
ChatMessage = ChatMessage.message.result
|
||||
clearTimeout(this.functionTimer);
|
||||
|
||||
this.messageSend = true
|
||||
this.redefinedMessage(ChatMessage)
|
||||
|
||||
}
|
||||
).catch((error) => {
|
||||
clearTimeout(this.functionTimer);
|
||||
console.error(error)
|
||||
})
|
||||
}
|
||||
|
||||
this.functionTimer = setTimeout(() => {
|
||||
|
||||
@@ -264,7 +285,7 @@ export class MessageService {
|
||||
|
||||
this.RochetChatConnectorService.wsSend({message:{msg:"pong"}, loginRequired: false})
|
||||
|
||||
}, 8000)
|
||||
}, 3000)
|
||||
|
||||
} else {
|
||||
this.RochetChatConnectorService.registerCallback({
|
||||
@@ -286,6 +307,8 @@ export class MessageService {
|
||||
|
||||
const message = this.getChatObj()
|
||||
|
||||
this.manualRetry = false
|
||||
|
||||
ChatMessage = Object.assign(message, ChatMessage)
|
||||
this.setData(ChatMessage)
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||
</ion-label>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
@@ -109,7 +109,7 @@
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||
</ion-label>
|
||||
|
||||
</div>
|
||||
@@ -164,7 +164,7 @@
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||
</ion-label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||
</ion-label>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
@@ -108,7 +108,7 @@
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||
</ion-label>
|
||||
</div>
|
||||
<div *ngIf="msg.file.type != 'application/img'">
|
||||
@@ -174,7 +174,7 @@
|
||||
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
|
||||
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
|
||||
<div *ngIf="msg.manualRetry" class="try">Tentar</div>
|
||||
<div *ngIf="msg.manualRetry" class="try" (click)="msg.send()">Tentar</div>
|
||||
</ion-label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -18,7 +18,7 @@ export const environment = {
|
||||
production: true,
|
||||
domain: 'gabinetedigital.local',
|
||||
defaultuser: 'eqformacao@oapr.gov.ao',//paulo.pinto@gabinetedigital.local
|
||||
defaultuserpwd: 'M@p2022', //tabteste@006,
|
||||
defaultuserpwd: 'tabteste@006', //tabteste@006,
|
||||
chatOffline: true,
|
||||
presidencia: false,
|
||||
version: versionData,
|
||||
|
||||
Reference in New Issue
Block a user