From 0af70adda79f89c53852b0df2138573b3c7670ba Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Wed, 21 Dec 2022 10:34:15 +0100 Subject: [PATCH 1/3] save --- src/app/home/home.page.ts | 1 + .../pages/agenda/new-event/new-event.page.ts | 11 ++- src/app/pages/events/events.page.ts | 70 ++++++++++--------- src/app/services/auth.service.ts | 1 - src/app/services/fcm.service.ts | 43 +----------- 5 files changed, 43 insertions(+), 83 deletions(-) diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 3836671d4..ec0339a1d 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -97,6 +97,7 @@ export class HomePage implements OnInit { this.router.events.subscribe((val) => { document.querySelectorAll('ion-modal').forEach((e: any) => e.remove()) document.querySelectorAll('popover-viewport').forEach((e: any) => e.remove()) + document.querySelectorAll('.notification').forEach((e: any) => e.remove()) }); window['platform'] = platform diff --git a/src/app/pages/agenda/new-event/new-event.page.ts b/src/app/pages/agenda/new-event/new-event.page.ts index 0adbba57c..c1db662a4 100644 --- a/src/app/pages/agenda/new-event/new-event.page.ts +++ b/src/app/pages/agenda/new-event/new-event.page.ts @@ -104,9 +104,11 @@ export class NewEventPage implements OnInit { this.taskParticipants = this.navParams.get('attendees'); - if(this.eventService.calendarNamesAry['Meu calendario']) { + if(this.eventService.calendarNamesAry.includes('Meu calendario')) { this.CalendarName = 'Meu calendario' - } else {} + } else { + this.CalendarName = this.eventService.calendarNamesAry[0] + } } @@ -178,15 +180,10 @@ export class NewEventPage implements OnInit { roundTimeQuarterHour() { var timeToReturn = new Date(); - // var minutes = timeToReturn.getMinutes(); var minutes = timeToReturn.getMinutes(); var hours = timeToReturn.getHours(); - // console.log("MINUTOS: " +minutes); - // console.log("BEFORE MINUTES: " +(Math.round(minutes/15) * 15)); - var m = (Math.round(minutes/15) * 15) % 60; - // console.log("AFTER MINUTES: " +m); var h = minutes > 52 ? (hours === 23 ? 0 : ++hours) : hours; if (m == 0) { diff --git a/src/app/pages/events/events.page.ts b/src/app/pages/events/events.page.ts index 50cf79432..7d14ebe26 100644 --- a/src/app/pages/events/events.page.ts +++ b/src/app/pages/events/events.page.ts @@ -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(); + }); } @@ -163,6 +163,8 @@ export class EventsPage implements OnInit { const list = mdOficialEvents.concat(mdPessoalEvents); + + this.addEventToDb(list); this.listToPresent = list @@ -179,8 +181,10 @@ export class EventsPage implements OnInit { let prOficialEvents = await this.eventService.getAllPrOficialEvents(start, end).toPromise(); let prPessoalEvents = await this.eventService.getAllPrPessoalEvents(start, end).toPromise(); + const list = prOficialEvents.concat(prPessoalEvents); + this.addEventToDb(list); if (list.length > 0) { this.currentEvent = list[0].Subject; diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index f01eca89c..3094310a4 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -127,7 +127,6 @@ export class AuthService { this.ChatSystemService.getAllRooms(); }, 200); - // alert('wsLogin') }).catch((error) => { console.error(error) diff --git a/src/app/services/fcm.service.ts b/src/app/services/fcm.service.ts index 3ed97ee0a..c5521200f 100644 --- a/src/app/services/fcm.service.ts +++ b/src/app/services/fcm.service.ts @@ -17,48 +17,7 @@ export class FcmService { constructor(private router: Router) { } - /* initPush() { - if (Capacitor.platform !== 'web') { - this.registerPush(); - } - } - private registerPush() { - PushNotifications.requestPermission().then((permission) => { - if (permission.granted) { - // Register with Apple / Google to receive push via APNS/FCM - PushNotifications.register(); - } else { - // No permission for push granted - } - }); - PushNotifications.addListener( - 'registration', - (token: PushNotificationToken) => { - - } - ); - - PushNotifications.addListener('registrationError', (error: any) => { - - }); - - PushNotifications.addListener( - 'pushNotificationReceived', - async (notification: PushNotification) => { - - } - ); - PushNotifications.addListener( - 'pushNotificationActionPerformed', - async (notification: PushNotificationActionPerformed) => { - const data = notification.notification.data; - - if (data.detailsId) { - this.router.navigateByUrl(`/home/notifications/notification-detail${data.detaisId}`); - } - } - ); - } */ + } From a98c0a85f597b52e1569639f35bb84e80c3b61c3 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Wed, 21 Dec 2022 10:42:25 +0100 Subject: [PATCH 2/3] improve --- src/app/pages/login/login.page.ts | 5 ++--- src/app/services/auth.service.ts | 3 --- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 077d22dff..0feb49c65 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -149,11 +149,10 @@ export class LoginPage implements OnInit { this.ChatSystemService.clearChat(); SessionStore.delete(); window.localStorage.clear(); - await MessageModel.deleteAll() - await DeleteMessageModel.deleteAll() + await MessageModel.deleteAll(); + await DeleteMessageModel.deleteAll(); await this.authService.SetSession(attempt, this.userattempt); - this.changeProfileService.run(); diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index 3094310a4..cbae58091 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -48,9 +48,6 @@ 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() } From 3b14ddea4bb2a32c6149118428ce5c6c99f5e435 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Wed, 21 Dec 2022 10:44:29 +0100 Subject: [PATCH 3/3] improve --- src/app/pages/inactivity/inactivity.page.ts | 6 +++--- src/app/pages/login/login.page.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/pages/inactivity/inactivity.page.ts b/src/app/pages/inactivity/inactivity.page.ts index 63dc58b8a..2743fd25c 100644 --- a/src/app/pages/inactivity/inactivity.page.ts +++ b/src/app/pages/inactivity/inactivity.page.ts @@ -117,9 +117,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) { diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 0feb49c65..220eb163e 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -98,9 +98,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() {