mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
Especific route on click for pushNotification
This commit is contained in:
+32
-10
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user