diff --git a/android/.idea/compiler.xml b/android/.idea/compiler.xml new file mode 100644 index 000000000..61a9130cd --- /dev/null +++ b/android/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 256b3a4b2..cc2c29d38 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -8,11 +8,11 @@ import { ModalController } from '@ionic/angular'; import { PublicationDetailPage } from '../../app/pages/publications/view-publications/publication-detail/publication-detail.page'; import { ViewPublicationsPage } from '../../app/pages/publications/view-publications/view-publications.page'; -import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed } from '@capacitor/core'; +import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed, Modals } from '@capacitor/core'; import { Router } from '@angular/router'; import { MethodCall } from '@angular/compiler'; -const { PushNotifications } = Plugins; +const { PushNotifications, LocalNotifications } = Plugins; @Component({ selector: 'app-home', @@ -72,7 +72,9 @@ export class HomePage implements OnInit { PushNotifications.addListener( 'pushNotificationReceived', (notification: PushNotification) => { - alert('Push received: ' + JSON.stringify(notification)); + //alert('Push received: ' + JSON.stringify(notification)); + //this.localNotificationPresent(notification); + }, ); @@ -87,7 +89,7 @@ export class HomePage implements OnInit { let publicationId = notification.notification.data.publicationId; let processId = notification.notification.data.processId; - console.log('FOLDER PROCESS',folder.ProcessId) + console.log('FOLDER PROCESS', folder.ProcessId) if (service != null) { @@ -98,20 +100,20 @@ export class HomePage implements OnInit { } else if (service === "gabinete-digital") { this.router.navigate(['/home/', service]); } else if (service === "gabinete-digital-expediente") { - this.router.navigate(['/home/gabinete-digital/', object,idObject]); - } + this.router.navigate(['/home/gabinete-digital/', object, idObject]); + } } else { - if ( processId || publicationId != null) { - this.viewPublicationDetail(processId,publicationId) + if (processId || publicationId != null) { + this.viewPublicationDetail(processId, publicationId) } if (notification.notification.data.folder.ProcessId != null) { this.viewPublications(folder) } - + } - + /*switch (service) { @@ -147,6 +149,26 @@ export class HomePage implements OnInit { ); } + async localNotificationPresent(notification) { + + LocalNotifications.schedule({ + notifications: [ + { + title: notification.title, + body: notification.body, + id: 1, + schedule: { at: new Date(Date.now() + 1000) }, + sound: null, + attachments: null, + actionTypeId: "", + extra: null + } + ] + }); + } + + + async viewPublicationDetail(processId: string, publicationId: string) { const modal = await this.modalController.create({ component: PublicationDetailPage, diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index c3999cee8..7205170f6 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -82,7 +82,13 @@ export class LoginPage implements OnInit { this.storageService.store(this.username, token.value); this.storageService.get(this.username).then(value => { console.log('STORAGE TOKEN',value ) - }) + this.storageService.get(AuthConnstants.USER).then(res=>{ + console.log('USERID',res); + + }); + + }); + }, ); @@ -103,6 +109,7 @@ export class LoginPage implements OnInit { if (await this.authService.login(this.userattempt)) { /* this.loginRocketChat(); */ this.storeUserIdANdToken() + this.router.navigate(['/home/events']); } else {