mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
push cordova
This commit is contained in:
+2
-2
@@ -101,14 +101,14 @@
|
|||||||
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
|
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
|
||||||
<mfp:android>
|
<mfp:android>
|
||||||
<mfp:sdkChecksum>1109370933</mfp:sdkChecksum>
|
<mfp:sdkChecksum>1109370933</mfp:sdkChecksum>
|
||||||
<mfp:appChecksum>2719981299</mfp:appChecksum>
|
<mfp:appChecksum>4242109404</mfp:appChecksum>
|
||||||
<mfp:security>
|
<mfp:security>
|
||||||
<mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
|
<mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
|
||||||
</mfp:security>
|
</mfp:security>
|
||||||
</mfp:android>
|
</mfp:android>
|
||||||
<mfp:ios>
|
<mfp:ios>
|
||||||
<mfp:sdkChecksum>246097737</mfp:sdkChecksum>
|
<mfp:sdkChecksum>246097737</mfp:sdkChecksum>
|
||||||
<mfp:appChecksum>1779870382</mfp:appChecksum>
|
<mfp:appChecksum>3914937917</mfp:appChecksum>
|
||||||
<mfp:security>
|
<mfp:security>
|
||||||
<mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
|
<mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
|
||||||
</mfp:security>
|
</mfp:security>
|
||||||
|
|||||||
Generated
-5
@@ -5792,11 +5792,6 @@
|
|||||||
"integrity": "sha512-7KrmqLaOGq1RP8N2z1ezN1kqkWFzTwwMvQ3/qAkd+exxFZuOe3DIN4eaU1gdNphsxdirI8Ajnr9q4So5vQbWqw==",
|
"integrity": "sha512-7KrmqLaOGq1RP8N2z1ezN1kqkWFzTwwMvQ3/qAkd+exxFZuOe3DIN4eaU1gdNphsxdirI8Ajnr9q4So5vQbWqw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"cordova-plugin-mfp-push": {
|
|
||||||
"version": "8.0.2020072705",
|
|
||||||
"resolved": "https://registry.npmjs.org/cordova-plugin-mfp-push/-/cordova-plugin-mfp-push-8.0.2020072705.tgz",
|
|
||||||
"integrity": "sha512-aA7EAZnFgu8R5U+Vpt5fGbCq1lRYHrt9AXXEJMwc5Vv0sFVUz9iOyzMXHYuSFSqmYgW/XldRXgTxoc8UvXErcQ=="
|
|
||||||
},
|
|
||||||
"cordova-plugin-okhttp": {
|
"cordova-plugin-okhttp": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/cordova-plugin-okhttp/-/cordova-plugin-okhttp-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/cordova-plugin-okhttp/-/cordova-plugin-okhttp-2.0.0.tgz",
|
||||||
|
|||||||
@@ -47,7 +47,6 @@
|
|||||||
"angular-tag-cloud-module": "^5.2.2",
|
"angular-tag-cloud-module": "^5.2.2",
|
||||||
"cordova-plugin-camera": "^5.0.1",
|
"cordova-plugin-camera": "^5.0.1",
|
||||||
"cordova-plugin-filepath": "^1.5.8",
|
"cordova-plugin-filepath": "^1.5.8",
|
||||||
"cordova-plugin-mfp-push": "^8.0.2020072705",
|
|
||||||
"cordova-plugin-okhttp": "^2.0.0",
|
"cordova-plugin-okhttp": "^2.0.0",
|
||||||
"cordova-res": "^0.15.3",
|
"cordova-res": "^0.15.3",
|
||||||
"cordova-sqlite-storage": "^5.1.0",
|
"cordova-sqlite-storage": "^5.1.0",
|
||||||
@@ -119,7 +118,6 @@
|
|||||||
"cordova-sqlite-storage": {},
|
"cordova-sqlite-storage": {},
|
||||||
"cordova-plugin-compat": {},
|
"cordova-plugin-compat": {},
|
||||||
"cordova-plugin-mfp": {},
|
"cordova-plugin-mfp": {},
|
||||||
"cordova-plugin-mfp-push": {},
|
|
||||||
"cordova-plugin-androidx": {},
|
"cordova-plugin-androidx": {},
|
||||||
"cordova-plugin-androidx-adapter": {},
|
"cordova-plugin-androidx-adapter": {},
|
||||||
"cordova-plugin-fcm-with-dependecy-updated": {
|
"cordova-plugin-fcm-with-dependecy-updated": {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import { adapterFactory } from 'angular-calendar/date-adapters/date-fns';
|
|||||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { MessagesPage } from './pages/chat/messages/messages.page';
|
import { MessagesPage } from './pages/chat/messages/messages.page';
|
||||||
|
|
||||||
import { FCM } from '@ionic-native/fcm/ngx'
|
import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic/ngx'
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|||||||
+286
-221
@@ -1,15 +1,19 @@
|
|||||||
///<reference path="../../../plugins/cordova-plugin-mfp/typings/worklight.d.ts" />
|
///<reference path="../../../plugins/cordova-plugin-mfp/typings/worklight.d.ts" />
|
||||||
///<reference path="../../../plugins/cordova-plugin-mfp-push/typings/mfppush.d.ts" />
|
|
||||||
import { Component, OnInit, NgZone } from '@angular/core';
|
import { Component, OnInit, NgZone } from '@angular/core';
|
||||||
import { EventsService } from '../services/events.service';
|
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 { ModalController, AlertController } from '@ionic/angular';
|
import { ModalController, AlertController, AnimationController } 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';
|
||||||
|
|
||||||
import { FCM } from '@ionic-native/fcm/ngx';
|
import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic/ngx';
|
||||||
|
import { ViewEventPage } from '../pages/agenda/view-event/view-event.page';
|
||||||
|
import { ApproveEventModalPage } from '../pages/agenda/approve-event-modal/approve-event-modal.page';
|
||||||
|
import { ExpedienteDetailPage } from '../pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page';
|
||||||
|
import { PublicationDetailPage } from '../pages/publications/publication-detail/publication-detail.page';
|
||||||
|
import { ViewPublicationsPage } from '../pages/publications/view-publications/view-publications.page';
|
||||||
|
|
||||||
/* const { PushNotifications, LocalNotifications, LocalNotificationAction } = Plugins; */
|
/* const { PushNotifications, LocalNotifications, LocalNotificationAction } = Plugins; */
|
||||||
|
|
||||||
@@ -27,93 +31,119 @@ export class HomePage implements OnInit {
|
|||||||
totalExpediente = 0;
|
totalExpediente = 0;
|
||||||
profile: string;
|
profile: string;
|
||||||
|
|
||||||
constructor(private zone: NgZone,private eventService: EventsService, private processesbackend: ProcessesService, private router: Router, private modalController: ModalController, public alertCtrl: AlertController) {
|
adding: "intervenient" | "CC" = "intervenient";
|
||||||
|
mobileComponent = {
|
||||||
|
showAddNewEvent: false,
|
||||||
|
showEditEvent: false,
|
||||||
|
showEventDetails: false,
|
||||||
|
showEventList: false,
|
||||||
|
transparentEventList: false,
|
||||||
|
transparentEventToApprove: false,
|
||||||
|
showEventToApprove: false,
|
||||||
|
showAttendees: false,
|
||||||
|
showAttendeeModal: false
|
||||||
|
}
|
||||||
|
eventToaprove: any = {
|
||||||
|
back: false,
|
||||||
|
serialNumber: "",
|
||||||
|
saveData: {}
|
||||||
|
}
|
||||||
|
selectedEvent: Event;
|
||||||
|
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,) {
|
||||||
|
|
||||||
router.events.subscribe((val) => {
|
router.events.subscribe((val) => {
|
||||||
document.querySelectorAll('ion-modal').forEach((e)=>e.remove())
|
document.querySelectorAll('ion-modal').forEach((e) => e.remove())
|
||||||
});
|
});
|
||||||
|
|
||||||
|
{
|
||||||
|
//this.folderId = this.navParams.get('folderId');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
//this.securityCheck()
|
//this.securityCheck()
|
||||||
this.mobileFirstTest()
|
this.mobileFirstTest()
|
||||||
/* //Initialize profile as mdgpr
|
this.pushCordova()
|
||||||
|
/* //Initialize profile as mdgpr
|
||||||
let date = new Date();
|
|
||||||
date.setMonth(date.getMonth() + 1);
|
|
||||||
let start = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds();
|
|
||||||
let end = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" 23:59:59";
|
|
||||||
|
|
||||||
this.profile = "mdgpr";
|
|
||||||
if (this.profile == "mdgpr") {
|
|
||||||
this.eventService.getAllMdEvents(start, end).subscribe(res => {
|
|
||||||
this.eventsList = res;
|
|
||||||
this.totalEvent = this.eventsList.length;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.eventService.getAllPrEvents(start, end).subscribe(res => {
|
|
||||||
this.eventsList = res;
|
|
||||||
this.totalEvent = this.eventsList.length;
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
this.processesbackend.GetTasksList("Expediente", true).subscribe(result => {
|
|
||||||
this.totalExpediente = result;
|
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
let date = new Date();
|
||||||
PushNotifications.addListener('registrationError', (error: any) => {
|
date.setMonth(date.getMonth() + 1);
|
||||||
alert('Error on registration: ' + JSON.stringify(error));
|
let start = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds();
|
||||||
});
|
let end = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" 23:59:59";
|
||||||
|
|
||||||
PushNotifications.addListener('pushNotificationReceived', notification => {
|
this.profile = "mdgpr";
|
||||||
|
if (this.profile == "mdgpr") {
|
||||||
//const isPushNotification = !!notification.title || !!notification.body;
|
this.eventService.getAllMdEvents(start, end).subscribe(res => {
|
||||||
|
this.eventsList = res;
|
||||||
// if this is a push notification received when the app is in the foreground on Android
|
this.totalEvent = this.eventsList.length;
|
||||||
//if (isAndroid && isPushNotification) {
|
});
|
||||||
|
}
|
||||||
// We schedule a LocalNotification 1 second later since Capacitor for Android doesn't show anything in this case
|
else {
|
||||||
console.log('Recived: ', notification)
|
this.eventService.getAllPrEvents(start, end).subscribe(res => {
|
||||||
//}
|
this.eventsList = res;
|
||||||
});
|
this.totalEvent = this.eventsList.length;
|
||||||
|
});
|
||||||
|
|
||||||
PushNotifications.addListener(
|
}
|
||||||
'pushNotificationActionPerformed',
|
this.processesbackend.GetTasksList("Expediente", true).subscribe(result => {
|
||||||
(notification: PushNotificationActionPerformed) => {
|
this.totalExpediente = result;
|
||||||
let service = notification.notification.data.Service;
|
});
|
||||||
let object = notification.notification.data.Object;
|
|
||||||
let idObject = notification.notification.data.IdObject;
|
/*
|
||||||
|
PushNotifications.addListener('registrationError', (error: any) => {
|
||||||
console.log('Complete Object: ', notification.notification )
|
alert('Error on registration: ' + JSON.stringify(error));
|
||||||
|
});
|
||||||
console.log('Service: ', service);
|
|
||||||
console.log('Object: ', object);
|
PushNotifications.addListener('pushNotificationReceived', notification => {
|
||||||
console.log('idObject: ', idObject);
|
|
||||||
|
//const isPushNotification = !!notification.title || !!notification.body;
|
||||||
if (service === "agenda") {
|
|
||||||
//this.router.navigate(['/home/', service, idObject, 'home']);
|
// if this is a push notification received when the app is in the foreground on Android
|
||||||
this.viewEventDetail(idObject)
|
//if (isAndroid && isPushNotification) {
|
||||||
}
|
|
||||||
else if (service === "gabinete-digital" && object === "expediente") {
|
// We schedule a LocalNotification 1 second later since Capacitor for Android doesn't show anything in this case
|
||||||
this.viewExpedientDetail(idObject)
|
console.log('Recived: ', notification)
|
||||||
}
|
//}
|
||||||
else if (service === "gabinete-digital" && object === "event-list") {
|
});
|
||||||
// this.ngZone.run(() => {this.router.navigate(['/home/gabinete-digital/event-list', idObject])})
|
|
||||||
this.openApproveModal(idObject);
|
|
||||||
}
|
PushNotifications.addListener(
|
||||||
else if (service === "accoes" && object === "accao") {
|
'pushNotificationActionPerformed',
|
||||||
this.viewPublications(idObject)
|
(notification: PushNotificationActionPerformed) => {
|
||||||
}
|
let service = notification.notification.data.Service;
|
||||||
else if (service === "accoes" && object === "publicacao") {
|
let object = notification.notification.data.Object;
|
||||||
this.viewPublicationDetail(idObject)
|
let idObject = notification.notification.data.IdObject;
|
||||||
}
|
|
||||||
|
console.log('Complete Object: ', notification.notification )
|
||||||
},
|
|
||||||
); */
|
console.log('Service: ', service);
|
||||||
|
console.log('Object: ', object);
|
||||||
|
console.log('idObject: ', idObject);
|
||||||
|
|
||||||
|
if (service === "agenda") {
|
||||||
|
//this.router.navigate(['/home/', service, idObject, 'home']);
|
||||||
|
this.viewEventDetail(idObject)
|
||||||
|
}
|
||||||
|
else if (service === "gabinete-digital" && object === "expediente") {
|
||||||
|
this.viewExpedientDetail(idObject)
|
||||||
|
}
|
||||||
|
else if (service === "gabinete-digital" && object === "event-list") {
|
||||||
|
// this.ngZone.run(() => {this.router.navigate(['/home/gabinete-digital/event-list', idObject])})
|
||||||
|
this.openApproveModal(idObject);
|
||||||
|
}
|
||||||
|
else if (service === "accoes" && object === "accao") {
|
||||||
|
this.viewPublications(idObject)
|
||||||
|
}
|
||||||
|
else if (service === "accoes" && object === "publicacao") {
|
||||||
|
this.viewPublicationDetail(idObject)
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
); */
|
||||||
}
|
}
|
||||||
|
|
||||||
mobileFirstTest() {
|
mobileFirstTest() {
|
||||||
@@ -137,8 +167,8 @@ export class HomePage implements OnInit {
|
|||||||
(response) => {
|
(response) => {
|
||||||
// Will display "Hello world" in an alert dialog.
|
// Will display "Hello world" in an alert dialog.
|
||||||
console.log("Success: " + response.responseText);
|
console.log("Success: " + response.responseText);
|
||||||
|
|
||||||
this.MFPushNotification()
|
//this.MFPushNotification()
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
console.log("Failure: " + JSON.stringify(error));
|
console.log("Failure: " + JSON.stringify(error));
|
||||||
@@ -156,101 +186,137 @@ export class HomePage implements OnInit {
|
|||||||
|
|
||||||
MFPushNotification() {
|
MFPushNotification() {
|
||||||
|
|
||||||
var pushNotificationReceived = function (message) {
|
/* var pushNotificationReceived = function (message) {
|
||||||
console.log(JSON.stringify(message));
|
console.log(JSON.stringify(message));
|
||||||
}
|
|
||||||
|
|
||||||
MFPPush.initialize (
|
|
||||||
function(successResponse) {
|
|
||||||
//alert("Successfully intialized");
|
|
||||||
MFPPush.registerNotificationsCallback(notificationReceived);
|
|
||||||
},
|
|
||||||
function(failureResponse) {
|
|
||||||
console.log("Failed to initialize");
|
|
||||||
}
|
}
|
||||||
);
|
|
||||||
MFPPush.isPushSupported (
|
MFPPush.initialize (
|
||||||
function(successResponse) {
|
function(successResponse) {
|
||||||
//alert("Push Supported: " + successResponse);
|
//alert("Successfully intialized");
|
||||||
},
|
MFPPush.registerNotificationsCallback(notificationReceived);
|
||||||
function(failureResponse) {
|
|
||||||
console.log("Failed to get push support status");
|
|
||||||
}
|
|
||||||
);
|
|
||||||
MFPPush.registerDevice(
|
|
||||||
null,function(successResponse) {
|
|
||||||
console.log("Successfully registered: "+ successResponse);
|
|
||||||
},
|
|
||||||
function(failureResponse) {
|
|
||||||
console.log("Successfully registered: "+ failureResponse);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
function notificationReceived(message) {
|
|
||||||
console.log(JSON.stringify(message.alert));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
securityCheck() {
|
|
||||||
|
|
||||||
this.registerChallengeHandler();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
registerChallengeHandler() {
|
|
||||||
alert('--> Pi called');
|
|
||||||
let PincodeChallengeHandler = WL.Client.createSecurityCheckChallengeHandler("PinCodeAttempts");
|
|
||||||
PincodeChallengeHandler.handleChallenge = ((challenge: any) => {
|
|
||||||
alert('--> PincodeChallengeHandler.handleChallenge called');
|
|
||||||
this.displayLoginChallenge(challenge, PincodeChallengeHandler);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async displayLoginChallenge(response, PincodeChallengeHandler) {
|
|
||||||
if (response.errorMsg) {
|
|
||||||
var msg = response.errorMsg + ' <br> Remaining attempts: ' + response.remainingAttempts;
|
|
||||||
console.log('--> displayLoginChallenge ERROR: ' + msg);
|
|
||||||
}
|
|
||||||
const prompt = await this.alertCtrl.create({
|
|
||||||
header: 'MFP Gateway',
|
|
||||||
message: msg,
|
|
||||||
inputs: [
|
|
||||||
{
|
|
||||||
name: 'pin',
|
|
||||||
placeholder: 'please enter the pincode',
|
|
||||||
type: 'password'
|
|
||||||
}
|
|
||||||
|
|
||||||
],
|
|
||||||
buttons: [
|
|
||||||
{
|
|
||||||
text: 'Cancel',
|
|
||||||
role: 'cancel',
|
|
||||||
handler: () => {
|
|
||||||
console.log('PincodeChallengeHandler: Cancel clicked');
|
|
||||||
PincodeChallengeHandler.Cancel();
|
|
||||||
prompt.dismiss();
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
function(failureResponse) {
|
||||||
text: 'Ok',
|
console.log("Failed to initialize");
|
||||||
handler: data => {
|
|
||||||
console.log('PincodeChallengeHandler', data.username);
|
|
||||||
PincodeChallengeHandler.submitChallengeAnswer(data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
);
|
||||||
|
MFPPush.isPushSupported (
|
||||||
|
function(successResponse) {
|
||||||
|
//alert("Push Supported: " + successResponse);
|
||||||
|
},
|
||||||
|
function(failureResponse) {
|
||||||
|
console.log("Failed to get push support status");
|
||||||
|
}
|
||||||
|
);
|
||||||
|
MFPPush.registerDevice(
|
||||||
|
null,function(successResponse) {
|
||||||
|
console.log("Successfully registered: "+ successResponse);
|
||||||
|
},
|
||||||
|
function(failureResponse) {
|
||||||
|
console.log("Successfully registered: "+ failureResponse);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
function notificationReceived(message) {
|
||||||
|
alert(message)
|
||||||
|
console.log(JSON.stringify(message.alert));
|
||||||
|
} */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
pushCordova() {
|
||||||
|
|
||||||
|
this.fcm.onNotification().subscribe(data => {
|
||||||
|
this.viewEventDetail(data.idObject)
|
||||||
|
if (data.click_action) {
|
||||||
|
console.log("Received in background: ", data);
|
||||||
|
|
||||||
|
if (data.service === "agenda") {
|
||||||
|
//this.router.navigate(['/home/', service, idObject, 'home']);
|
||||||
|
this.viewEventDetail(data.idObject)
|
||||||
|
}
|
||||||
|
else if (data.service === "gabinete-digital" && data.object === "expediente") {
|
||||||
|
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);
|
||||||
|
if (data.service === "agenda") {
|
||||||
|
//this.router.navigate(['/home/', service, idObject, 'home']);
|
||||||
|
this.viewEventDetail(data.idObject)
|
||||||
|
}
|
||||||
|
else if (data.service === "gabinete-digital" && data.object === "expediente") {
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
else if (data.service === "accoes" && data.object === "publicacao") {
|
||||||
|
this.viewPublicationDetail(data.idObject)
|
||||||
|
}
|
||||||
|
};
|
||||||
});
|
});
|
||||||
prompt.present();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
this.fcm.onTokenRefresh().subscribe(token => {
|
||||||
|
// Register your new token in your back-end if you want
|
||||||
|
// backend.registerToken(token);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.ubscribeToTopic()
|
||||||
|
this.getToken()
|
||||||
|
|
||||||
/* async openApproveModal(eventSerialNumber){
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
const modal = await this.modalController.create({
|
||||||
|
component: ViewEventPage,
|
||||||
|
componentProps: {
|
||||||
|
eventId: eventId,
|
||||||
|
adding: this.adding
|
||||||
|
},
|
||||||
|
cssClass: 'modal modal-desktop',
|
||||||
|
backdropDismiss: false
|
||||||
|
});
|
||||||
|
await modal.present();
|
||||||
|
modal.onDidDismiss().then((res) => {
|
||||||
|
if (res) {
|
||||||
|
//this.viewEventDetailDismiss(res);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async openApproveModal(eventSerialNumber) {
|
||||||
const modal = await this.modalController.create({
|
const modal = await this.modalController.create({
|
||||||
component: ApproveEventModalPage,
|
component: ApproveEventModalPage,
|
||||||
componentProps:{
|
componentProps: {
|
||||||
serialNumber: eventSerialNumber,
|
serialNumber: eventSerialNumber,
|
||||||
},
|
},
|
||||||
cssClass: 'cal-modal',
|
cssClass: 'cal-modal',
|
||||||
@@ -259,46 +325,17 @@ export class HomePage implements OnInit {
|
|||||||
|
|
||||||
await modal.present();
|
await modal.present();
|
||||||
modal.onDidDismiss();
|
modal.onDidDismiss();
|
||||||
} */
|
|
||||||
|
|
||||||
/* async viewEventDetail(eventId:any) {
|
|
||||||
console.log(this.profile);
|
|
||||||
|
|
||||||
const modal = await this.modalController.create({
|
|
||||||
component: ViewEventPage,
|
|
||||||
componentProps:{
|
|
||||||
eventId: eventId,
|
|
||||||
},
|
|
||||||
cssClass: 'modal',
|
|
||||||
backdropDismiss: false
|
|
||||||
});
|
|
||||||
await modal.present();
|
|
||||||
modal.onDidDismiss();
|
|
||||||
} */
|
|
||||||
|
|
||||||
/* async viewExpedientDetail(serialNumber:any) {
|
|
||||||
console.log(this.profile);
|
|
||||||
|
|
||||||
const modal = await this.modalController.create({
|
|
||||||
component: ViewEventPage,
|
|
||||||
componentProps: {
|
|
||||||
eventId: eventId,
|
|
||||||
},
|
|
||||||
cssClass: 'modal',
|
|
||||||
backdropDismiss: false
|
|
||||||
});
|
|
||||||
await modal.present();
|
|
||||||
modal.onDidDismiss().then((res) => {
|
|
||||||
if (res) {
|
|
||||||
console.log(res);
|
|
||||||
//this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async viewExpedientDetail(serialNumber: any) {
|
async viewExpedientDetail(serialNumber: any) {
|
||||||
console.log(this.profile);
|
let classs;
|
||||||
console.log("Expediente id: ", serialNumber);
|
if (window.innerWidth <= 800) {
|
||||||
|
classs = 'modal'
|
||||||
|
} else {
|
||||||
|
classs = 'modal modal-desktop showAsideOptions'
|
||||||
|
}
|
||||||
|
/* console.log(this.profile);
|
||||||
|
console.log(serialNumber); */
|
||||||
|
|
||||||
const modal = await this.modalController.create({
|
const modal = await this.modalController.create({
|
||||||
component: ExpedienteDetailPage,
|
component: ExpedienteDetailPage,
|
||||||
@@ -306,43 +343,71 @@ export class HomePage implements OnInit {
|
|||||||
serialNumber: serialNumber,
|
serialNumber: serialNumber,
|
||||||
profile: this.profile,
|
profile: this.profile,
|
||||||
},
|
},
|
||||||
cssClass: 'modal',
|
cssClass: classs,
|
||||||
backdropDismiss: false
|
|
||||||
});
|
});
|
||||||
await modal.present();
|
await modal.present();
|
||||||
modal.onDidDismiss();
|
modal.onDidDismiss().then((res) => {
|
||||||
} */
|
if (res) {
|
||||||
|
console.log(res);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async viewPublicationDetail(publicationId: string) {
|
||||||
|
|
||||||
/* async viewPublicationDetail(folderId) {
|
|
||||||
const modal = await this.modalController.create({
|
const modal = await this.modalController.create({
|
||||||
component: PublicationDetailPage,
|
component: PublicationDetailPage,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
folderId: folderId,
|
publicationId: publicationId,
|
||||||
|
folderId: this.folderId,
|
||||||
},
|
},
|
||||||
cssClass: 'publication-detail',
|
cssClass: 'publication-detail',
|
||||||
backdropDismiss: false
|
backdropDismiss: false
|
||||||
});
|
});
|
||||||
await modal.present();
|
await modal.present();
|
||||||
modal.onDidDismiss();
|
modal.onDidDismiss().then(() => {
|
||||||
} */
|
//this.getPublications();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async viewPublications(folderId) {
|
||||||
|
|
||||||
|
const enterAnimation = (baseEl: any) => {
|
||||||
|
const backdropAnimation = this.animationController.create()
|
||||||
|
.addElement(baseEl.querySelector('ion-backdrop')!)
|
||||||
|
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
|
||||||
|
|
||||||
|
const wrapperAnimation = this.animationController.create()
|
||||||
|
.addElement(baseEl.querySelector('.modal-wrapper')!)
|
||||||
|
.keyframes([
|
||||||
|
{ offset: 0, opacity: '0', transform: 'scale(0)' },
|
||||||
|
{ offset: 1, opacity: '0.99', transform: 'scale(1)' }
|
||||||
|
]);
|
||||||
|
|
||||||
|
return this.animationController.create()
|
||||||
|
.addElement(baseEl)
|
||||||
|
.easing('ease-out')
|
||||||
|
.duration(500)
|
||||||
|
.addAnimation([backdropAnimation, wrapperAnimation]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const leaveAnimation = (baseEl: any) => {
|
||||||
|
return enterAnimation(baseEl).direction('reverse');
|
||||||
|
}
|
||||||
|
|
||||||
/* async viewPublications(folderId) {
|
|
||||||
const modal = await this.modalController.create({
|
const modal = await this.modalController.create({
|
||||||
component: ViewPublicationsPage,
|
component: ViewPublicationsPage,
|
||||||
enterAnimation,
|
enterAnimation,
|
||||||
leaveAnimation,
|
leaveAnimation,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
item: folderId,
|
folderId: folderId,
|
||||||
},
|
},
|
||||||
cssClass: 'new-action',
|
cssClass: 'new-action',
|
||||||
backdropDismiss: false
|
backdropDismiss: false
|
||||||
});
|
});
|
||||||
await modal.present();
|
await modal.present();
|
||||||
modal.onDidDismiss();
|
modal.onDidDismiss();
|
||||||
} */
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user