This commit is contained in:
Peter Maquiran
2022-12-13 17:21:48 +01:00
parent 2beb3d4387
commit 9116ac4d06
14 changed files with 68 additions and 63 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ export class AuthGuard implements CanActivate {
return false
} else {
if(this.p.userPermission(this.p.permissionList.Chat.access) == true) {
this.authService.loginChat();
// this.authService.loginChat();
}
const pathname = state.url
@@ -5,7 +5,7 @@
<ion-toolbar>
<div class="title-content width-100 d-flex justify-space-between align-center">
<div class= "btn-dismiss font-30 cursor-pointer" (click)="close()">
<ion-icon style="margin-bottom:-8px" *ngIf="ThemeService.currentTheme == 'doneIt' " class="font-35" src="assets/images/theme/doneIticons-arrow-arrow-left.svg"></ion-icon>
<ion-icon style="margin-bottom:-8px" *ngIf="ThemeService.currentTheme == 'doneIt' " class="font-35" src="assets/images/theme/doneIt/icons-arrow-arrow-left.svg"></ion-icon>
<ion-icon style="margin-bottom:-8px" slot="end" *ngIf="ThemeService.currentTheme != 'doneIt' " src="assets/images/icons-arrow-arrow-left.svg" class="iconsarrowarrow-left"></ion-icon>
</div>
<div class="middle d-flex align-center flex-grow-1">
+1 -1
View File
@@ -76,7 +76,7 @@ export class UserSession {
UserName: string
Password: string
RochetChatUserId: string
Profile: 'PR' | 'MDGPR' | 'Consultant' ;
Profile: 'PR' | 'MDGPR' | 'Consultant' | 'Unknown' ;
LoginPreference: 'None' | 'Password' | 'Pin' | null;
PIN: string
Inactivity: boolean
+2 -2
View File
@@ -28,7 +28,7 @@
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<div class="conteiner-box px-20 height-100" ng-swipe-up="swipe($event)">
<div *ngIf="p.userPermission([permissionList.Agenda.access])" class="schedule height-100">
<div *ngIf="p.userPermission([p.permissionList.Agenda.access])" class="schedule height-100">
<div class="schedule-header">
<div class="title">
<ion-icon class="icon" slot="end" src="assets/images/icons-default-agenda.svg" ></ion-icon>
@@ -88,7 +88,7 @@
</div>
</div>
<div *ngIf="p.userPermission([permissionList.Gabinete.access])" class="schedule height-100">
<div *ngIf="p.userPermission([p.permissionList.Gabinete.access])" class="schedule height-100">
<div class="schedule-header">
<div class="title">
<ion-icon class="icon" slot="end" src="assets/images/icons-correspondencias.svg"></ion-icon>
+1 -4
View File
@@ -14,7 +14,6 @@ import { BackgroundService } from 'src/app/services/background.service';
import { momentG } from 'src/plugin/momentG';
import { ThemeService } from 'src/app/services/theme.service'
import { Storage } from '@ionic/storage';
import { PermissionList } from 'src/app/models/permission/permissionList';
import { PermissionService } from 'src/app/services/permission.service';
import { ViewEventPage } from 'src/app/modals/view-event/view-event.page';
import { ChangeProfileService } from 'src/app/services/change-profile.service';
@@ -65,8 +64,6 @@ export class EventsPage implements OnInit {
loggeduser: LoginUserRespose;
permissionList = new PermissionList();
constructor(
private eventService: EventsService,
private router: Router,
@@ -81,7 +78,7 @@ export class EventsPage implements OnInit {
public p: PermissionService,
private changeProfileService: ChangeProfileService,
) {
this.loggeduser = SessionStore.user;
+1 -1
View File
@@ -123,7 +123,7 @@ export class InactivityPage implements OnInit {
await this.authService.SetSession(attempt, this.userattempt);
if(this.p.userPermission(this.p.permissionList.Chat.access)){
this.authService.loginChat();
// this.authService.loginChat();
}
this.getToken();
-7
View File
@@ -10,12 +10,10 @@ import { SessionStore } from 'src/app/store/session.service';
import { ClearStoreService } from 'src/app/services/clear-store.service';
import { ChangeProfileService } from 'src/app/services/change-profile.service';
import { ThemeService } from 'src/app/services/theme.service';
import { StorageService } from 'src/app/services/storage.service';
import { PermissionService } from 'src/app/services/permission.service';
import { PermissionList } from 'src/app/models/permission/permissionList';
import { MessageModel, DeleteMessageModel } from '../../models/beast-orm';
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
import { Storage } from '@ionic/storage';
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
import { ChatService } from 'src/app/services/chat.service';
@@ -37,7 +35,6 @@ export class LoginPage implements OnInit {
loginPreference: string
sessionStore = SessionStore;
permissionList = new PermissionList();
showPassword = false;
passwordIcon = "eye";
@@ -50,10 +47,8 @@ export class LoginPage implements OnInit {
private clearStoreService: ClearStoreService,
private changeProfileService: ChangeProfileService,
public ThemeService: ThemeService,
private storageservice: StorageService,
public p: PermissionService,
private RochetChatConnectorService: RochetChatConnectorService,
private storage: Storage,
public ChatSystemService: ChatSystemService,
private ChatService: ChatService
) {}
@@ -128,7 +123,6 @@ export class LoginPage implements OnInit {
await this.authService.SetSession(attempt, this.userattempt);
if(attempt.ChatData) {
await this.authService.loginChat(attempt.ChatData.data);
await this.authService.loginToChatWs();
this.ChatService.setheader()
@@ -157,7 +151,6 @@ export class LoginPage implements OnInit {
if(attempt.ChatData) {
await this.authService.loginChat(attempt.ChatData.data);
await this.authService.loginToChatWs();
this.ChatService.setheader();
this.ChatSystemService.loadChat();
+2 -10
View File
@@ -34,11 +34,9 @@ export class AuthService {
constructor(
private http: HttpClient,
private httpService: HttpService,
private storageService:StorageService,
public alertController: AlertController,
private aesencrypt: AESEncrypt,
private cookieService: CookieService,
private RochetChatConnectorService: RochetChatConnectorService,
private router: Router,
private NfService:NfService,
@@ -96,6 +94,8 @@ export class AuthService {
session.Profile = 'MDGPR'
} else if(session.RoleID == 99999872) {
session.Profile = 'Consultant'
} else {
session.Profile = 'Unknown'
}
session.Password = user.password
@@ -111,14 +111,6 @@ export class AuthService {
this.initialsService.getInitials(session.FullName);
}
async loginChat(responseChat?) {
}
async autoLoginChat(expirationDate:number) {
}
loginToChatWs() {
setTimeout(() => {
+30 -12
View File
@@ -1,6 +1,8 @@
import { Injectable } from '@angular/core';
import { ThemeService } from 'src/app/services/theme.service';
import { StorageService} from 'src/app/services/storage.service';
import { HttpClient } from '@angular/common/http';
import { environment } from 'src/environments/environment';
@Injectable({
providedIn: 'root'
@@ -15,7 +17,8 @@ export class BackgroundService {
constructor(
private themeservice: ThemeService,
private storageservice: StorageService
private storageservice: StorageService,
private http: HttpClient,
) { }
online() {
@@ -54,18 +57,33 @@ export class BackgroundService {
}
}
offline() {
document.body.style.setProperty(`--color`, "#ffb703");
document.body.style.setProperty(`--color2`, "#ffb703");
document.body.style.setProperty(`--color3`, "#ffb703");
document.body.style.setProperty(`--color4`, "#ffb703");
document.body.style.setProperty(`--color5`, "#ffb703");
this.storageservice.store('networkCheckStore','offline');
this.callBacks.forEach((e) => {
if (e.type == 'Offline') {
e.funx()
async offline() {
let opts = {
headers: {},
}
try {
await this.http.post(environment.apiURL + "UserAuthentication/Login", '', opts).toPromise();
} catch (error) {
if(error.status != 400) {
document.body.style.setProperty(`--color`, "#ffb703");
document.body.style.setProperty(`--color2`, "#ffb703");
document.body.style.setProperty(`--color3`, "#ffb703");
document.body.style.setProperty(`--color4`, "#ffb703");
document.body.style.setProperty(`--color5`, "#ffb703");
this.storageservice.store('networkCheckStore','offline');
this.callBacks.forEach((e) => {
if (e.type == 'Offline') {
e.funx()
}
})
}
})
}
}
registerBackService(type: 'Offline' | 'Online' | 'Notification', funx: Function, object = '') {
+2 -2
View File
@@ -343,7 +343,7 @@ export class ChatService {
setheader() {
try {
if (this.p.userPermission(this.p.permissionList.Chat.access)) {
if (this.p.userPermission(this.p.permissionList.Chat.access) && SessionStore.user.ChatData) {
this.headers = new HttpHeaders();
if (this.p.userPermission(this.p.permissionList.Chat.access)) {
@@ -364,7 +364,7 @@ export class ChatService {
async refreshtoken() {
if(this.headers) {
if(this.headers && SessionStore.user.ChatData) {
this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey);
let options = {
headers: this.headers
@@ -576,6 +576,8 @@ export class ChatSystemService {
const firstName = capitalizeTxt(roomName.split('.')[0])
const lastName = capitalizeTxt(roomName.split('.')[1])
return firstName + ' ' + lastName
} else if(roomData.name) {
return roomData.name
} else {
return 'Sem nome'
}
+19 -14
View File
@@ -28,11 +28,13 @@ export class HeaderPage implements OnInit {
notificationLength: 0;
SessionStore = SessionStore
check: boolean;
permissionList = new PermissionList();
production = environment.production
environment = environment
canOpenSearch = false
showProfileModal = false
permissionList = new PermissionList();
constructor(
private router: Router,
@@ -48,6 +50,7 @@ export class HeaderPage implements OnInit {
router.events.subscribe((val) => {
this.showSearch = false;
this.canOpenSearch = true;
this.showProfileModal = false
});
@@ -179,20 +182,22 @@ export class HeaderPage implements OnInit {
return enterAnimation(baseEl).direction('reverse');
}
if(!this.showProfileModal) {
this.showProfileModal = true
const modal = await this.modalController.create({
component: ProfilePage,
cssClass: 'model profile-modal search-submodal',
componentProps: {
}
});
await modal.present();
modal.onDidDismiss().then(() => {
this.notificationLengthData()
this.showProfileModal = false
})
}
const modal = await this.modalController.create({
component: ProfilePage,
cssClass: 'model profile-modal search-submodal',
componentProps: {
}
});
await modal.present();
modal.onDidDismiss().then(() => {
this.notificationLengthData()
})
}
async dynamicSearch() {
+3 -5
View File
@@ -1,16 +1,14 @@
export const environment = {
// apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',
apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/',
apiURL: 'https://gd-api.oapr.gov.ao/GabineteDigital.Services/V5/api/',
// apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/',
// apiChatUrl: 'http://192.168.0.29:3000/api/v1/',
// apiWsChatUrl: 'wss://192.168.0.29:3000/websocket',
apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/',
apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket',
apiChatUrl: 'https://gd-chat.oapr.gov.ao/api/v1/',
apiWsChatUrl: 'ws://gd-chat.oapr.gov.ao/websocket',
/* apiChatUrl: 'https://www.tabularium.pt/api/v1/',
apiWsChatUrl: 'wss://www.tabularium.pt/websocket', */
// apiChatUrl: 'https://www.tabularium.pt/api/v1/',
production: true,
domain: 'gabinetedigital.local',
defaultuser: '',//paulo.pinto paulo.pinto@gabinetedigital.local
+3 -3
View File
@@ -22,10 +22,10 @@
export const environment = {
production: false,
//apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',
apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/',
apiURL: 'https://gd-api.oapr.gov.ao/GabineteDigital.Services/V5/api/',
//apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/',
apiChatUrl: 'http://192.168.0.29:3000/api/v1/',
apiWsChatUrl: 'ws://192.168.0.29:3000/websocket',
apiChatUrl: 'https://gd-chat.oapr.gov.ao/api/v1/',
apiWsChatUrl: 'ws://gd-chat.oapr.gov.ao/websocket',
// apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/',
// apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket',
/* apiChatUrl: 'https://www.tabularium.pt/api/v1/',