mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Notification code Refactory
This commit is contained in:
+15
-23
@@ -3,6 +3,7 @@ import { Component, OnInit, NgZone } from '@angular/core';
|
||||
import { EventsService } from '../services/events.service';
|
||||
import { Event } from '../models/event.model';
|
||||
import { ProcessesService } from '../services/processes.service';
|
||||
import { NotificationsService } from '../services/notifications.service';
|
||||
import { ModalController, AlertController, AnimationController } from '@ionic/angular';
|
||||
//import { AlertController } from 'ionic-angular';
|
||||
/* import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed, Modals } from '@capacitor/core'; */
|
||||
@@ -52,7 +53,15 @@ export class HomePage implements OnInit {
|
||||
postEvent: any;
|
||||
folderId: string;
|
||||
|
||||
constructor(private zone: NgZone, private eventService: EventsService, private processesbackend: ProcessesService, private router: Router, private modalController: ModalController, public modalCtrl: AlertController, private fcm: FCM, private animationController: AnimationController,) {
|
||||
constructor(private zone: NgZone,
|
||||
private eventService: EventsService,
|
||||
private processesbackend: ProcessesService,
|
||||
private router: Router,
|
||||
private modalController: ModalController,
|
||||
public modalCtrl: AlertController,
|
||||
private fcm: FCM,
|
||||
private animationController: AnimationController,
|
||||
private notificatinsservice: NotificationsService,) {
|
||||
|
||||
router.events.subscribe((val) => {
|
||||
document.querySelectorAll('ion-modal').forEach((e) => e.remove())
|
||||
@@ -66,7 +75,7 @@ export class HomePage implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.pushCordova()
|
||||
this.pushCordova();
|
||||
/* //Initialize profile as mdgpr
|
||||
|
||||
let date = new Date();
|
||||
@@ -94,7 +103,6 @@ export class HomePage implements OnInit {
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
pushCordova() {
|
||||
|
||||
this.fcm.onNotification().subscribe(data => {
|
||||
@@ -128,29 +136,13 @@ export class HomePage implements OnInit {
|
||||
console.log(data.Service)
|
||||
console.log(data.Object)
|
||||
console.log(data.IdObject)
|
||||
this.openApproveModal(data.IdObject);
|
||||
//this.openApproveModal(data.IdObject);
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
this.fcm.onTokenRefresh().subscribe(token => {
|
||||
// Register your new token in your back-end if you want
|
||||
// backend.registerToken(token);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/* ubscribeToTopic() {
|
||||
this.fcm.subscribeToTopic('enappd');
|
||||
}
|
||||
getToken() {
|
||||
this.fcm.getToken().then(token => {
|
||||
console.log('token: ', token)
|
||||
// Register your new token in your back-end if you want
|
||||
// backend.registerToken(token);
|
||||
});
|
||||
} */
|
||||
|
||||
async viewEventDetail(eventId: any) {
|
||||
console.log(this.profile);
|
||||
|
||||
@@ -200,8 +192,8 @@ export class HomePage implements OnInit {
|
||||
} else {
|
||||
classs = 'modal modal-desktop showAsideOptions'
|
||||
}
|
||||
/* console.log(this.profile);
|
||||
console.log(serialNumber); */
|
||||
console.log(this.profile);
|
||||
console.log(serialNumber);
|
||||
console.log('expediante 2')
|
||||
const modal = await this.modalController.create({
|
||||
component: ExpedienteDetailPage,
|
||||
@@ -231,7 +223,7 @@ export class HomePage implements OnInit {
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(() => {
|
||||
//this.getPublications();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user