mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Change action click with wasTapped
This commit is contained in:
+40
-32
@@ -4,7 +4,7 @@ import { EventsService } from '../services/events.service';
|
|||||||
import { Event } from '../models/event.model';
|
import { Event } from '../models/event.model';
|
||||||
import { ProcessesService } from '../services/processes.service';
|
import { ProcessesService } from '../services/processes.service';
|
||||||
import { NotificationsService } from '../services/notifications.service';
|
import { NotificationsService } from '../services/notifications.service';
|
||||||
import { ModalController, AlertController, AnimationController } from '@ionic/angular';
|
import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular';
|
||||||
//import { AlertController } from 'ionic-angular';
|
//import { AlertController } from 'ionic-angular';
|
||||||
/* import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed, Modals } from '@capacitor/core'; */
|
/* import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed, Modals } from '@capacitor/core'; */
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
@@ -61,7 +61,8 @@ export class HomePage implements OnInit {
|
|||||||
public modalCtrl: AlertController,
|
public modalCtrl: AlertController,
|
||||||
private fcm: FCM,
|
private fcm: FCM,
|
||||||
private animationController: AnimationController,
|
private animationController: AnimationController,
|
||||||
private notificatinsservice: NotificationsService,) {
|
private notificatinsservice: NotificationsService,
|
||||||
|
private platform: Platform) {
|
||||||
|
|
||||||
router.events.subscribe((val) => {
|
router.events.subscribe((val) => {
|
||||||
document.querySelectorAll('ion-modal').forEach((e) => e.remove())
|
document.querySelectorAll('ion-modal').forEach((e) => e.remove())
|
||||||
@@ -105,40 +106,47 @@ export class HomePage implements OnInit {
|
|||||||
}
|
}
|
||||||
pushCordova() {
|
pushCordova() {
|
||||||
|
|
||||||
this.fcm.onNotification().subscribe(data => {
|
if(this.platform.is('desktop')) {
|
||||||
this.viewEventDetail(data.IdObject)
|
console.log('Notifications not supported')
|
||||||
if (data.wasTapped) {
|
} else {
|
||||||
console.log("Received in background: ", data);
|
|
||||||
|
|
||||||
if (data.Service === "agenda") {
|
this.fcm.onNotification().subscribe(data => {
|
||||||
//this.router.navigate(['/home/', service, IdObject, 'home']);
|
this.viewEventDetail(data.IdObject)
|
||||||
this.viewEventDetail(data.IdObject)
|
if (data.wasTapped === true) {
|
||||||
}
|
console.log("Received in background: ", data);
|
||||||
else if (data.Service === "gabinete-digital" && data.Object === "expediente") {
|
|
||||||
console.log('expediante 1')
|
|
||||||
this.viewExpedientDetail(data.IdObject)
|
|
||||||
}
|
|
||||||
else if (data.Service === "gabinete-digital" && data.Object === "event-list") {
|
|
||||||
// this.ngZone.run(() => {this.router.navigate(['/home/gabinete-digital/event-list', IdObject])})
|
|
||||||
this.openApproveModal(data.IdObject);
|
|
||||||
}
|
|
||||||
else if (data.Service === "accoes" && data.Object === "accao") {
|
|
||||||
this.viewPublications(data.IdObject)
|
|
||||||
alert(data.IdObject)
|
|
||||||
}
|
|
||||||
else if (data.Service === "accoes" && data.Object === "publicacao") {
|
|
||||||
this.viewPublicationDetail(data.IdObject)
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
if (data.Service === "agenda") {
|
||||||
console.log("Received in foreground: ", data);
|
//this.router.navigate(['/home/', service, IdObject, 'home']);
|
||||||
|
this.viewEventDetail(data.IdObject)
|
||||||
|
}
|
||||||
|
else if (data.Service === "gabinete-digital" && data.Object === "expediente") {
|
||||||
|
console.log('expediante 1')
|
||||||
|
this.viewExpedientDetail(data.IdObject)
|
||||||
|
}
|
||||||
|
else if (data.Service === "gabinete-digital" && data.Object === "event-list") {
|
||||||
|
// this.ngZone.run(() => {this.router.navigate(['/home/gabinete-digital/event-list', IdObject])})
|
||||||
|
this.openApproveModal(data.IdObject);
|
||||||
|
}
|
||||||
|
else if (data.Service === "accoes" && data.Object === "accao") {
|
||||||
|
this.viewPublications(data.IdObject)
|
||||||
|
alert(data.IdObject)
|
||||||
|
}
|
||||||
|
else if (data.Service === "accoes" && data.Object === "publicacao") {
|
||||||
|
this.viewPublicationDetail(data.IdObject)
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.log("Received in foreground: ", data);
|
||||||
|
|
||||||
|
console.log(data.Service)
|
||||||
|
console.log(data.Object)
|
||||||
|
console.log(data.IdObject)
|
||||||
|
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
console.log(data.Service)
|
|
||||||
console.log(data.Object)
|
|
||||||
console.log(data.IdObject)
|
|
||||||
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { ExpedientePage } from '../pages/gabinete-digital/expediente/expediente.
|
|||||||
import { EventListPage } from '../pages/gabinete-digital/event-list/event-list.page';
|
import { EventListPage } from '../pages/gabinete-digital/event-list/event-list.page';
|
||||||
import { PublicationsPage } from '../pages/publications/publications.page'
|
import { PublicationsPage } from '../pages/publications/publications.page'
|
||||||
import { ViewPublicationsPage } from '../pages/publications/view-publications/view-publications.page' */
|
import { ViewPublicationsPage } from '../pages/publications/view-publications/view-publications.page' */
|
||||||
import { ModalController, AlertController, AnimationController } from '@ionic/angular';
|
import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular';
|
||||||
import { ViewEventPage } from '../pages/agenda/view-event/view-event.page';
|
import { ViewEventPage } from '../pages/agenda/view-event/view-event.page';
|
||||||
import { ExpedienteDetailPage } from '../pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page';
|
import { ExpedienteDetailPage } from '../pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page';
|
||||||
import { PublicationDetailPage } from '../pages/publications/publication-detail/publication-detail.page';
|
import { PublicationDetailPage } from '../pages/publications/publication-detail/publication-detail.page';
|
||||||
@@ -31,7 +31,8 @@ export class NotificationsService {
|
|||||||
private storageService: StorageService,
|
private storageService: StorageService,
|
||||||
private modalController: ModalController,
|
private modalController: ModalController,
|
||||||
public modalCtrl: AlertController,
|
public modalCtrl: AlertController,
|
||||||
private animationController: AnimationController,/* ,
|
private animationController: AnimationController,
|
||||||
|
private platform: Platform/* ,
|
||||||
public agenda: AgendaPage,
|
public agenda: AgendaPage,
|
||||||
public expediante: ExpedientePage,
|
public expediante: ExpedientePage,
|
||||||
public eventList: EventListPage,
|
public eventList: EventListPage,
|
||||||
@@ -45,7 +46,11 @@ export class NotificationsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAndpostToken(username) {
|
getAndpostToken(username) {
|
||||||
const geturl = environment.apiURL + 'notifications/token';
|
if(this.platform.is('desktop')) {
|
||||||
|
console.log('Notifications not supported')
|
||||||
|
} else {
|
||||||
|
|
||||||
|
const geturl = environment.apiURL + 'notifications/token';
|
||||||
|
|
||||||
return this.fcm.getToken().then(token => {
|
return this.fcm.getToken().then(token => {
|
||||||
console.log('token: ', token)
|
console.log('token: ', token)
|
||||||
@@ -69,10 +74,12 @@ export class NotificationsService {
|
|||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async onReceviNotification(viewEventDetail,viewExpedientDetail,openApproveModal,viewPublications,viewPublicationDetail) {
|
async onReceviNotification(viewEventDetail, viewExpedientDetail, openApproveModal, viewPublications, viewPublicationDetail) {
|
||||||
this.fcm.onNotification().subscribe(data => {
|
this.fcm.onNotification().subscribe(data => {
|
||||||
if (data.click_action) {
|
if (data.click_action) {
|
||||||
console.log("Received in background: ", data);
|
console.log("Received in background: ", data);
|
||||||
|
|
||||||
@@ -105,6 +112,13 @@ export class NotificationsService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
platformVerify() {
|
||||||
|
|
||||||
|
if (this.platform.is('cordova')) {
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async viewEventDetail(eventId: any) {
|
async viewEventDetail(eventId: any) {
|
||||||
|
|
||||||
const modal = await this.modalController.create({
|
const modal = await this.modalController.create({
|
||||||
@@ -124,17 +138,17 @@ export class NotificationsService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async openApproveModal(eventSerialNumber){
|
async openApproveModal(eventSerialNumber) {
|
||||||
let classs;
|
let classs;
|
||||||
if( window.innerWidth <= 1024){
|
if (window.innerWidth <= 1024) {
|
||||||
classs = 'cal-modal modal modal-desktop'
|
classs = 'cal-modal modal modal-desktop'
|
||||||
} else {
|
} else {
|
||||||
classs = 'gabinete-digital-mobile-modal-to-Desktop'
|
classs = 'gabinete-digital-mobile-modal-to-Desktop'
|
||||||
}
|
}
|
||||||
|
|
||||||
const modal = await this.modalController.create({
|
const modal = await this.modalController.create({
|
||||||
component: ApproveEventModalPage,
|
component: ApproveEventModalPage,
|
||||||
componentProps:{
|
componentProps: {
|
||||||
serialNumber: eventSerialNumber,
|
serialNumber: eventSerialNumber,
|
||||||
},
|
},
|
||||||
cssClass: 'event-list',
|
cssClass: 'event-list',
|
||||||
|
|||||||
Reference in New Issue
Block a user