last sentry changed

This commit is contained in:
Eudes Inácio
2022-12-19 19:20:45 +01:00
23 changed files with 239 additions and 194 deletions
+2
View File
@@ -15,6 +15,7 @@ import { StorageService } from 'src/app/services/storage.service';
import { MessageModel } from './models/beast-orm';
import { InativityService } from "src/app/services/inativity.service";
import { ThemeService } from 'src/app/services/theme.service';
import { environment } from 'src/environments/environment';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
@@ -51,6 +52,7 @@ export class AppComponent {
) {
// this.createCacheFolder()
this.initializeApp();
console.log('version:'+ environment.version)
}
// async createCacheFolder(){
+4 -4
View File
@@ -32,14 +32,10 @@ export class AuthGuard implements CanActivate {
this.router.navigate(['/']);
return false
} else {
if(this.p.userPermission(this.p.permissionList.Chat.access) == true) {
// this.authService.loginChat();
}
const pathname = state.url
if(pathname.startsWith('/home/agenda')) {
if(this.p.userPermission(this.p.permissionList.Agenda.access)) {
return true;
} else {
@@ -48,6 +44,7 @@ export class AuthGuard implements CanActivate {
}
} else if ( pathname.startsWith('/home/gabinete-digital')) {
if(this.p.userPermission(this.p.permissionList.Gabinete.access)) {
return true;
@@ -86,6 +83,9 @@ export class AuthGuard implements CanActivate {
}
}
return true
}
}
+1
View File
@@ -21,6 +21,7 @@ export class InactivityGuard implements CanActivate {
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
console.log('hire inactinity!', state.url)
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)){
+4
View File
@@ -19,9 +19,13 @@ export class LoginGuard implements CanActivate {
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
if(SessionStore.exist && SessionStore.user.Inactivity && SessionStore.user.LoginPreference != 'Pin' ) {
this.router.navigate(['/home/events']);
return false
} else if(SessionStore.exist && !SessionStore.user.Inactivity && SessionStore.user.LoginPreference == 'Pin' && SessionStore.forceToLoginWithForceToLogInWithPassword && !this.platform.is('desktop') && !this.platform.is('mobileweb')) {
SessionStore.forceToLoginWithForceToLogInWithPassword = false
return true
} else if(SessionStore.exist && !SessionStore.hasPin && !this.platform.is('desktop') && !this.platform.is('mobileweb') ) {
this.router.navigate(['/pin']);
return false
+4 -3
View File
@@ -123,7 +123,8 @@ export class HomePage implements OnInit {
}
goto(url) {
this.router.navigate([url])
// this.router.navigateByUrl('/home/events', { replaceUrl: true });
this.router.navigate([url], { replaceUrl: true })
}
refreshing() { }
@@ -132,8 +133,8 @@ export class HomePage implements OnInit {
this.logDeviceInfo();
this.notificationsService.onReciveForeground();
this.notificationsService.onReciveBackground();
// this.notificationsService.onReciveForeground();
// this.notificationsService.onReciveBackground();
window.addEventListener('online', () => {
// console.log('Became online')
+1 -1
View File
@@ -178,7 +178,7 @@ export class ProfilePage implements OnInit {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', IdObject, 'gabinete-digital']));
}
this.notificationservice.tempClearArray();
// this.notificationservice.tempClearArray();
this.deleteNotification(index);
this.eventtrigger.publishSomeData({
notification: "deleted"
+3 -3
View File
@@ -797,8 +797,8 @@ export class AgendaPage implements OnInit {
this.listToPresent = this.CalendarStore.eventSource
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
console.log(this.CalendarStore.eventSource)
console.log('this.TimelineMDList', this.TimelineMDList)
// console.log(this.CalendarStore.eventSource)
// console.log('this.TimelineMDList', this.TimelineMDList)
this.myCal.update();
@@ -847,7 +847,7 @@ export class AgendaPage implements OnInit {
this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
console.log('this.TimelinePRList', this.TimelinePRList)
// console.log('this.TimelinePRList', this.TimelinePRList)
//
this.myCal.update();
+33 -33
View File
@@ -79,54 +79,54 @@ export class EventsPage implements OnInit {
private changeProfileService: ChangeProfileService,
) {
this.loggeduser = SessionStore.user;
// this.loggeduser = SessionStore.user;
this.platform.resize.subscribe(async () => {
//
//
// this.platform.resize.subscribe(async () => {
// //
// //
});
// });
window['zipPhoneCallback'] = function (zipphone) {
var frame = document.getElementById('home-iframe');
if(frame) {
frame['contentWindow']['postMessage']({call:'cookies', value: { cookies: {} }});
}
}
// window['zipPhoneCallback'] = function (zipphone) {
// var frame = document.getElementById('home-iframe');
// if(frame) {
// frame['contentWindow']['postMessage']({call:'cookies', value: { cookies: {} }});
// }
// }
this.changeProfileService.registerCallback(() => {
// this.changeProfileService.registerCallback(() => {
this.listToPresent = [];
this.listToPresentexpediente = []
})
// this.listToPresent = [];
// this.listToPresentexpediente = []
// })
}
ngOnInit() {
this.segment = "Combinada";
this.profile = "mdgpr";
// this.segment = "Combinada";
// this.profile = "mdgpr";
this.showGreeting();
// this.showGreeting();
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url == '/home/events') {
this.RefreshEvents();
setTimeout(() => {
this.LoadList();
}, 1500)
}
});
this.hideSearch();
// this.router.events.forEach((event) => {
// if (event instanceof NavigationEnd && event.url == '/home/events') {
// this.RefreshEvents();
// setTimeout(() => {
// this.LoadList();
// }, 1500)
// }
// });
// this.hideSearch();
this.backgroundservice.registerBackService('Online', () => {
this.showGreeting();
this.RefreshEvents();
this.LoadList();
this.hideSearch();
});
// this.backgroundservice.registerBackService('Online', () => {
// this.showGreeting();
// this.RefreshEvents();
// this.LoadList();
// this.hideSearch();
// });
}
@@ -17,7 +17,7 @@
<div *ngIf="!SessionStore.hasPin" class="title">Digite o novo PIN</div>
<div class="terminal">
<div class="d-flex pt-25 align-center justify-center pin-4">
<div class="d-flex pt-25 align-center justify-center pin-4">
<div class="dot" [class.dot-active]="code.length >= 1"></div>
<div class="dot" [class.dot-active]="code.length >= 2"></div>
<div class="dot" [class.dot-active]="code.length >= 3"></div>
@@ -25,19 +25,19 @@
</div>
<div class="d-flex align-center justify-center">
<div [class.hide]="code.length == 4" class="d-flex align-center justify-center">
<div class="circle" (click)="setCode('1')">1</div> <div class="circle" (click)="setCode('2')">2</div> <div class="circle" (click)="setCode('3')">3</div>
</div>
<div class="d-flex align-center justify-center">
<div [class.hide]="code.length == 4" class="d-flex align-center justify-center">
<div class="circle" (click)="setCode('4')">4</div> <div class="circle" (click)="setCode('5')">5</div> <div class="circle" (click)="setCode('6')">6</div>
</div>
<div class="d-flex align-center justify-center">
<div [class.hide]="code.length == 4" class="d-flex align-center justify-center">
<div class="circle" (click)="setCode('7')">7</div> <div class="circle" (click)="setCode('8')">8</div> <div class="circle" (click)="setCode('9')">9</div>
</div>
<div class="d-flex align-center justify-center">
<div [class.hide]="code.length == 4" class="d-flex align-center justify-center">
<div class="circle" (click)="setCode('0')">0</div>
</div>
@@ -348,3 +348,8 @@ ion-item{
}
.hide {
opacity: 0 !important;
}
+8 -4
View File
@@ -38,7 +38,7 @@ export class InactivityPage implements OnInit {
loop = false
ngOnInit() {
alert('pin')
}
runloop() {
@@ -101,6 +101,8 @@ export class InactivityPage implements OnInit {
} else {
SessionStore.delete()
window.localStorage.clear();
SessionStore.setInativity(true)
await this.authService.SetSession(attempt, this.userattempt);
}
@@ -117,9 +119,9 @@ export class InactivityPage implements OnInit {
}
getToken() {
this.notificatinsservice.requestPermissions();
this.notificatinsservice.registrationError();
this.notificatinsservice.getAndpostToken(this.username);
// this.notificatinsservice.requestPermissions();
// this.notificatinsservice.registrationError();
// this.notificatinsservice.getAndpostToken(this.username);
}
setCode(code: string) {
@@ -205,6 +207,8 @@ export class InactivityPage implements OnInit {
enterWithPasswordButton() {
this.enterWithPassword = true
SessionStore.forceToLoginWithForceToLogInWithPassword = true
this.router.navigate(['/']);
}
+14 -5
View File
@@ -15,6 +15,8 @@ import { MessageModel, DeleteMessageModel } from '../../models/beast-orm';
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
import { ChatService } from 'src/app/services/chat.service';
import { Platform } from '@ionic/angular';
@Component({
@@ -49,7 +51,8 @@ export class LoginPage implements OnInit {
public p: PermissionService,
private RochetChatConnectorService: RochetChatConnectorService,
public ChatSystemService: ChatSystemService,
private ChatService: ChatService
private ChatService: ChatService,
private platform: Platform,
) {}
ngOnInit() {
@@ -93,9 +96,9 @@ export class LoginPage implements OnInit {
}
getToken() {
this.notificatinsservice.requestPermissions();
this.notificatinsservice.registrationError();
this.notificatinsservice.getAndpostToken(this.username);
// this.notificatinsservice.requestPermissions();
// this.notificatinsservice.registrationError();
// this.notificatinsservice.getAndpostToken(this.username);
}
async Login() {
@@ -158,7 +161,13 @@ export class LoginPage implements OnInit {
this.getToken();
this.router.navigateByUrl('/home/events', { replaceUrl: true });
if(!this.platform.is('desktop') && !this.platform.is('mobileweb')) {
this.router.navigateByUrl('/pin', { replaceUrl: true });
} else {
this.router.navigateByUrl('/home/events');
}
}
}
else{
+3
View File
@@ -50,10 +50,13 @@ export class AuthService {
this.headers = new HttpHeaders();
if (SessionStore.exist) {
SessionStore.setInativity(true)
if(this.p.userPermission(this.p.permissionList.Chat.access) == true ) {
this.loginToChatWs()
}
}
+6 -2
View File
@@ -392,9 +392,13 @@ export class ChatService {
}
} else {
} else if (!this.headers) {
this.setheader()
await this.refreshtoken();
this.refreshtoken()
} else {
setTimeout(async ()=>{
await this.refreshtoken();
}, 4000)
}
}
+8 -3
View File
@@ -136,9 +136,14 @@ export class MessageService {
private usernameToDisplayName(username) {
const firstName = capitalizeTxt(username.split('.')[0])
const lastName = capitalizeTxt(username.split('.')[1])
return firstName + ' ' + lastName
try {
const firstName = capitalizeTxt(username.split('.')[0])
const lastName = capitalizeTxt(username.split('.')[1])
return firstName + ' ' + lastName
} catch (error) {
return username
}
}
async send(): Promise<any> {
+8 -3
View File
@@ -992,9 +992,14 @@ export class RoomService {
usernameToDisplayName(username) {
const firstName = capitalizeTxt(username.split('.')[0])
const lastName = capitalizeTxt(username.split('.')[1])
return firstName + ' ' + lastName
try {
const firstName = capitalizeTxt(username.split('.')[0])
const lastName = capitalizeTxt(username.split('.')[1])
return firstName + ' ' + lastName
} catch(error) {
return username
}
}
sendReadMessage() {
+28 -28
View File
@@ -17,7 +17,7 @@ export class TimeService {
end = new Date();
start = new Date(start);
const totalSeconds = Math.floor((end - (start))/1000);;
const totalSeconds = Math.floor((end - (start))/1000);
const totalMinutes = Math.floor(totalSeconds/60);
const totalHours = Math.floor(totalMinutes/60);
const totalDays = Math.floor(totalHours/24);
@@ -75,37 +75,37 @@ export class TimeService {
}
countDownDateTimer(date:any, roomId:string){
let timer = setInterval(() =>{
let difference = new Date(date).getTime() - new Date().getTime();
let c_day = Math.floor(difference/(1000*60*60*24));
let c_hours = Math.floor((difference % (1000*60*60*24)) / (1000*60*60));
let c_minutes = Math.floor((difference % (1000*60*60)) / (1000*60));
let c_seconds = Math.floor((difference % (1000*60)) / 1000);
// let timer = setInterval(() =>{
// let difference = new Date(date).getTime() - new Date().getTime();
// let c_day = Math.floor(difference/(1000*60*60*24));
// let c_hours = Math.floor((difference % (1000*60*60*24)) / (1000*60*60));
// let c_minutes = Math.floor((difference % (1000*60*60)) / (1000*60));
// let c_seconds = Math.floor((difference % (1000*60)) / 1000);
this.countDownTime = this.addZero(c_day) + " : " + this.addZero(c_hours) + " : " + this.addZero(c_minutes) + " : " + this.addZero(c_seconds) ;
// this.countDownTime = this.addZero(c_day) + " : " + this.addZero(c_hours) + " : " + this.addZero(c_minutes) + " : " + this.addZero(c_seconds) ;
if(difference < 0) {
clearInterval(timer);
this.countDownTime = "Expired";
let body = { "roomId":roomId, }
this.chatService.getRoomInfo(roomId).subscribe(room=>{
this.room = room['room'];
// if(difference < 0) {
// clearInterval(timer);
// this.countDownTime = "Expired";
// let body = { "roomId":roomId, }
// this.chatService.getRoomInfo(roomId).subscribe(room=>{
// this.room = room['room'];
if(this.room.t === 'p'){
this.chatService.deleteGroup(body).subscribe(res=>{
this.ChatSystemService.deleteRoom(roomId)
});
}
else{
// if(this.room.t === 'p'){
// this.chatService.deleteGroup(body).subscribe(res=>{
// this.ChatSystemService.deleteRoom(roomId)
// });
// }
// else{
this.chatService.deleteChannel(body).subscribe(res=>{
this.ChatSystemService.deleteRoom(roomId)
});
}
});
}
})
return this.countDownTime;
// this.chatService.deleteChannel(body).subscribe(res=>{
// this.ChatSystemService.deleteRoom(roomId)
// });
// }
// });
// }
// })
// return this.countDownTime;
}
addZero(i) {
+2 -2
View File
@@ -118,9 +118,9 @@ export class NotificationsService {
};
this.http.post<Tokenn>(`${geturl}`, body, { headers }).subscribe(data => {
console.log(data)
//console.log(data)
}, (error) => {
console.log(error)
//console.log(error)
})
});
@@ -84,7 +84,7 @@ export class RequestOptionsPage implements OnInit {
this.toastService._successMessage()
this.close();
loader.remove()
},()=>{
}, ()=> {
loader.remove()
this.toastService._badRequest('Processo não encontrado')
+2
View File
@@ -14,6 +14,8 @@ class SessionService {
// local storage keyName
private keyName: string;
forceToLoginWithForceToLogInWithPassword = false
constructor() {
this.keyName = (SHA1(this.constructor.name)).toString()