diff --git a/config.xml b/config.xml
index 9d64417cb..fc70cef4e 100644
--- a/config.xml
+++ b/config.xml
@@ -101,14 +101,14 @@
1109370933
- 2719981299
+ 4242109404
246097737
- 1779870382
+ 3914937917
diff --git a/package-lock.json b/package-lock.json
index 102fb5078..2f5db9be5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5792,11 +5792,6 @@
"integrity": "sha512-7KrmqLaOGq1RP8N2z1ezN1kqkWFzTwwMvQ3/qAkd+exxFZuOe3DIN4eaU1gdNphsxdirI8Ajnr9q4So5vQbWqw==",
"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": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/cordova-plugin-okhttp/-/cordova-plugin-okhttp-2.0.0.tgz",
diff --git a/package.json b/package.json
index 58810689c..cbe0e9b78 100644
--- a/package.json
+++ b/package.json
@@ -47,7 +47,6 @@
"angular-tag-cloud-module": "^5.2.2",
"cordova-plugin-camera": "^5.0.1",
"cordova-plugin-filepath": "^1.5.8",
- "cordova-plugin-mfp-push": "^8.0.2020072705",
"cordova-plugin-okhttp": "^2.0.0",
"cordova-res": "^0.15.3",
"cordova-sqlite-storage": "^5.1.0",
@@ -119,7 +118,6 @@
"cordova-sqlite-storage": {},
"cordova-plugin-compat": {},
"cordova-plugin-mfp": {},
- "cordova-plugin-mfp-push": {},
"cordova-plugin-androidx": {},
"cordova-plugin-androidx-adapter": {},
"cordova-plugin-fcm-with-dependecy-updated": {
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 4bd74f256..3cc61ca02 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -29,7 +29,7 @@ import { adapterFactory } from 'angular-calendar/date-adapters/date-fns';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
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({
diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts
index a3200840e..4fa504b95 100644
--- a/src/app/home/home.page.ts
+++ b/src/app/home/home.page.ts
@@ -1,15 +1,19 @@
///
-///
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 { ModalController, AlertController } from '@ionic/angular';
+import { ModalController, AlertController, AnimationController } from '@ionic/angular';
//import { AlertController } from 'ionic-angular';
/* import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed, Modals } from '@capacitor/core'; */
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; */
@@ -27,93 +31,119 @@ export class HomePage implements OnInit {
totalExpediente = 0;
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) => {
- document.querySelectorAll('ion-modal').forEach((e)=>e.remove())
+ document.querySelectorAll('ion-modal').forEach((e) => e.remove())
});
-
+
+ {
+ //this.folderId = this.navParams.get('folderId');
+ }
+
}
ngOnInit() {
//this.securityCheck()
this.mobileFirstTest()
-/* //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;
- });
+ this.pushCordova()
+ /* //Initialize profile as mdgpr
-/*
- PushNotifications.addListener('registrationError', (error: any) => {
- alert('Error on registration: ' + JSON.stringify(error));
- });
-
- PushNotifications.addListener('pushNotificationReceived', notification => {
-
- //const isPushNotification = !!notification.title || !!notification.body;
-
- // if this is a push notification received when the app is in the foreground on Android
- //if (isAndroid && isPushNotification) {
-
- // We schedule a LocalNotification 1 second later since Capacitor for Android doesn't show anything in this case
- console.log('Recived: ', notification)
- //}
- });
-
-
- PushNotifications.addListener(
- 'pushNotificationActionPerformed',
- (notification: PushNotificationActionPerformed) => {
- let service = notification.notification.data.Service;
- let object = notification.notification.data.Object;
- 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)
- }
-
- },
- ); */
+ 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;
+ });
+
+ /*
+ PushNotifications.addListener('registrationError', (error: any) => {
+ alert('Error on registration: ' + JSON.stringify(error));
+ });
+
+ PushNotifications.addListener('pushNotificationReceived', notification => {
+
+ //const isPushNotification = !!notification.title || !!notification.body;
+
+ // if this is a push notification received when the app is in the foreground on Android
+ //if (isAndroid && isPushNotification) {
+
+ // We schedule a LocalNotification 1 second later since Capacitor for Android doesn't show anything in this case
+ console.log('Recived: ', notification)
+ //}
+ });
+
+
+ PushNotifications.addListener(
+ 'pushNotificationActionPerformed',
+ (notification: PushNotificationActionPerformed) => {
+ let service = notification.notification.data.Service;
+ let object = notification.notification.data.Object;
+ 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() {
@@ -137,8 +167,8 @@ export class HomePage implements OnInit {
(response) => {
// Will display "Hello world" in an alert dialog.
console.log("Success: " + response.responseText);
-
- this.MFPushNotification()
+
+ //this.MFPushNotification()
},
(error) => {
console.log("Failure: " + JSON.stringify(error));
@@ -156,101 +186,137 @@ export class HomePage implements OnInit {
MFPushNotification() {
- var pushNotificationReceived = function (message) {
- console.log(JSON.stringify(message));
- }
-
- MFPPush.initialize (
- function(successResponse) {
- //alert("Successfully intialized");
- MFPPush.registerNotificationsCallback(notificationReceived);
- },
- function(failureResponse) {
- console.log("Failed to initialize");
+ /* var pushNotificationReceived = function (message) {
+ console.log(JSON.stringify(message));
}
- );
- 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) {
- 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 + '
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
- }
+
+ MFPPush.initialize (
+ function(successResponse) {
+ //alert("Successfully intialized");
+ MFPPush.registerNotificationsCallback(notificationReceived);
},
- {
- text: 'Ok',
- handler: data => {
- console.log('PincodeChallengeHandler', data.username);
- PincodeChallengeHandler.submitChallengeAnswer(data);
- }
+ function(failureResponse) {
+ console.log("Failed to initialize");
}
- ]
+ );
+ 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({
component: ApproveEventModalPage,
- componentProps:{
+ componentProps: {
serialNumber: eventSerialNumber,
},
cssClass: 'cal-modal',
@@ -259,46 +325,17 @@ export class HomePage implements OnInit {
await modal.present();
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) {
- console.log(this.profile);
- console.log("Expediente id: ", serialNumber);
+ let classs;
+ 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({
component: ExpedienteDetailPage,
@@ -306,43 +343,71 @@ export class HomePage implements OnInit {
serialNumber: serialNumber,
profile: this.profile,
},
- cssClass: 'modal',
- backdropDismiss: false
+ cssClass: classs,
});
await modal.present();
- modal.onDidDismiss();
- } */
+ modal.onDidDismiss().then((res) => {
+ if (res) {
+ console.log(res);
+ }
+ });
+ }
-
-
- /* async viewPublicationDetail(folderId) {
+ async viewPublicationDetail(publicationId: string) {
const modal = await this.modalController.create({
component: PublicationDetailPage,
componentProps: {
- folderId: folderId,
+ publicationId: publicationId,
+ folderId: this.folderId,
},
cssClass: 'publication-detail',
backdropDismiss: false
});
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({
component: ViewPublicationsPage,
enterAnimation,
leaveAnimation,
componentProps: {
- item: folderId,
+ folderId: folderId,
},
cssClass: 'new-action',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss();
- } */
-
+ }