PushNotification param change name from service to Service and object to Object

This commit is contained in:
Eudes Inácio
2021-02-08 17:07:40 +01:00
parent 254efccdb7
commit 2cd41a69f7
49 changed files with 1031 additions and 501 deletions
@@ -274,8 +274,9 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _app_pages_publications_view_publications_publication_detail_publication_detail_page__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../app/pages/publications/view-publications/publication-detail/publication-detail.page */ "./src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts");
/* harmony import */ var _app_pages_publications_view_publications_view_publications_page__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../app/pages/publications/view-publications/view-publications.page */ "./src/app/pages/publications/view-publications/view-publications.page.ts");
/* harmony import */ var _app_pages_gabinete_digital_expediente_expediente_detail_expediente_detail_page__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page */ "./src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts");
/* harmony import */ var _capacitor_core__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @capacitor/core */ "./node_modules/@capacitor/core/dist/esm/index.js");
/* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/__ivy_ngcc__/fesm2015/router.js");
/* harmony import */ var _app_pages_agenda_view_event_view_event_page__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../app/pages/agenda/view-event/view-event.page */ "./src/app/pages/agenda/view-event/view-event.page.ts");
/* harmony import */ var _capacitor_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @capacitor/core */ "./node_modules/@capacitor/core/dist/esm/index.js");
/* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/__ivy_ngcc__/fesm2015/router.js");
@@ -287,7 +288,8 @@ __webpack_require__.r(__webpack_exports__);
const { PushNotifications, LocalNotifications, LocalNotificationAction } = _capacitor_core__WEBPACK_IMPORTED_MODULE_9__["Plugins"];
const { PushNotifications, LocalNotifications, LocalNotificationAction } = _capacitor_core__WEBPACK_IMPORTED_MODULE_10__["Plugins"];
let HomePage = class HomePage {
constructor(eventService, processesbackend, router, modalController) {
this.eventService = eventService;
@@ -333,14 +335,30 @@ let HomePage = class HomePage {
PushNotifications.addListener('registrationError', (error) => {
alert('Error on registration: ' + JSON.stringify(error));
});
PushNotifications.addListener('pushNotificationReceived', (notification) => {
//alert('Push received: ' + JSON.stringify(notification));
this.localNotificationPresent(notification);
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
LocalNotifications.schedule({
notifications: [{
title: notification.title,
body: notification.body,
id: new Date().getUTCMilliseconds(),
schedule: {
at: new Date(Date.now() + 1000)
},
extra: notification.data,
channelId: 'pop-notifications'
}]
});
//}
});
PushNotifications.addListener('pushNotificationActionPerformed', (notification) => {
let service = notification.notification.data.service;
let object = notification.notification.data.object;
let idObject = notification.notification.data.idObject;
let service = notification.notification.data.Service;
let object = notification.notification.data.Object;
let idObject = notification.notification.data.IdObject;
console.log('Complete Object: ', notification);
console.log('Service: ', service);
console.log('Object: ', object);
console.log('idObject: ', idObject);
@@ -352,8 +370,19 @@ let HomePage = class HomePage {
// this.router.navigate(['/home/', service]);
// }
//if (service != null) {
/*const routeValue = {
"agenda": this.router.navigate(['/home/', service, idObject, 'home']),
"gabinete-digital": this.router.navigate(['/home/', service]),
"accoes": this.viewExpedientDetail(idObject),
}
const route = routeValue[service] && object ;
service = "agenda" ? this.router.navigate(['/home/', service, idObject, 'home']) : */
if (service === "agenda") {
this.router.navigate(['/home/', service, idObject, 'home']);
//this.router.navigate(['/home/', service, idObject, 'home']);
this.viewEventDetail(idObject);
}
else if (service === "gabinete-digital" && object != "expediente") {
this.router.navigate(['/home/', service]);
@@ -415,6 +444,26 @@ let HomePage = class HomePage {
});
});
}
viewEventDetail(eventId) {
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function* () {
console.log(this.profile);
const modal = yield this.modalController.create({
component: _app_pages_agenda_view_event_view_event_page__WEBPACK_IMPORTED_MODULE_9__["ViewEventPage"],
componentProps: {
eventId: eventId,
},
cssClass: 'modal',
backdropDismiss: false
});
yield modal.present();
modal.onDidDismiss().then((res) => {
if (res) {
console.log(res);
//this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
}
});
});
}
viewExpedientDetail(serialNumber) {
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function* () {
console.log(this.profile);
@@ -469,7 +518,7 @@ let HomePage = class HomePage {
HomePage.ctorParameters = () => [
{ type: _services_events_service__WEBPACK_IMPORTED_MODULE_2__["EventsService"] },
{ type: _services_processes_service__WEBPACK_IMPORTED_MODULE_4__["ProcessesService"] },
{ type: _angular_router__WEBPACK_IMPORTED_MODULE_10__["Router"] },
{ type: _angular_router__WEBPACK_IMPORTED_MODULE_11__["Router"] },
{ type: _ionic_angular__WEBPACK_IMPORTED_MODULE_5__["ModalController"] }
];
HomePage = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
File diff suppressed because one or more lines are too long
@@ -504,17 +504,23 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
/* harmony import */
var _capacitor_core__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(
var _app_pages_agenda_view_event_view_event_page__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(
/*! ../../app/pages/agenda/view-event/view-event.page */
"./src/app/pages/agenda/view-event/view-event.page.ts");
/* harmony import */
var _capacitor_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(
/*! @capacitor/core */
"./node_modules/@capacitor/core/dist/esm/index.js");
/* harmony import */
var _angular_router__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(
var _angular_router__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(
/*! @angular/router */
"./node_modules/@angular/router/__ivy_ngcc__/fesm2015/router.js");
var _capacitor_core__WEBP = _capacitor_core__WEBPACK_IMPORTED_MODULE_9__["Plugins"],
var _capacitor_core__WEBP = _capacitor_core__WEBPACK_IMPORTED_MODULE_10__["Plugins"],
PushNotifications = _capacitor_core__WEBP.PushNotifications,
LocalNotifications = _capacitor_core__WEBP.LocalNotifications,
LocalNotificationAction = _capacitor_core__WEBP.LocalNotificationAction;
@@ -574,13 +580,28 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
alert('Error on registration: ' + JSON.stringify(error));
});
PushNotifications.addListener('pushNotificationReceived', function (notification) {
//alert('Push received: ' + JSON.stringify(notification));
_this.localNotificationPresent(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
LocalNotifications.schedule({
notifications: [{
title: notification.title,
body: notification.body,
id: new Date().getUTCMilliseconds(),
schedule: {
at: new Date(Date.now() + 1000)
},
extra: notification.data,
channelId: 'pop-notifications'
}]
}); //}
});
PushNotifications.addListener('pushNotificationActionPerformed', function (notification) {
var service = notification.notification.data.service;
var object = notification.notification.data.object;
var idObject = notification.notification.data.idObject;
var service = notification.notification.data.Service;
var object = notification.notification.data.Object;
var idObject = notification.notification.data.IdObject;
console.log('Complete Object: ', notification);
console.log('Service: ', service);
console.log('Object: ', object);
console.log('idObject: ', idObject);
@@ -593,8 +614,17 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
// }
//if (service != null) {
/*const routeValue = {
"agenda": this.router.navigate(['/home/', service, idObject, 'home']),
"gabinete-digital": this.router.navigate(['/home/', service]),
"accoes": this.viewExpedientDetail(idObject),
}
const route = routeValue[service] && object ;
service = "agenda" ? this.router.navigate(['/home/', service, idObject, 'home']) : */
if (service === "agenda") {
_this.router.navigate(['/home/', service, idObject, 'home']);
//this.router.navigate(['/home/', service, idObject, 'home']);
_this.viewEventDetail(idObject);
} else if (service === "gabinete-digital" && object != "expediente") {
_this.router.navigate(['/home/', service]);
} else if (service === "gabinete-digital" && object === "expediente") {
@@ -664,8 +694,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}));
}
}, {
key: "viewExpedientDetail",
value: function viewExpedientDetail(serialNumber) {
key: "viewEventDetail",
value: function viewEventDetail(eventId) {
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
var modal;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
@@ -675,10 +705,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
console.log(this.profile);
_context2.next = 3;
return this.modalController.create({
component: _app_pages_gabinete_digital_expediente_expediente_detail_expediente_detail_page__WEBPACK_IMPORTED_MODULE_8__["ExpedienteDetailPage"],
component: _app_pages_agenda_view_event_view_event_page__WEBPACK_IMPORTED_MODULE_9__["ViewEventPage"],
componentProps: {
serialNumber: serialNumber,
profile: this.profile
eventId: eventId
},
cssClass: 'modal',
backdropDismiss: false
@@ -692,7 +721,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
case 6:
modal.onDidDismiss().then(function (res) {
if (res) {
console.log(res);
console.log(res); //this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
}
});
@@ -705,33 +734,39 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}));
}
}, {
key: "viewPublicationDetail",
value: function viewPublicationDetail(folderId) {
key: "viewExpedientDetail",
value: function viewExpedientDetail(serialNumber) {
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
var modal;
return regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
console.log(this.profile);
_context3.next = 3;
return this.modalController.create({
component: _app_pages_publications_view_publications_publication_detail_publication_detail_page__WEBPACK_IMPORTED_MODULE_6__["PublicationDetailPage"],
component: _app_pages_gabinete_digital_expediente_expediente_detail_expediente_detail_page__WEBPACK_IMPORTED_MODULE_8__["ExpedienteDetailPage"],
componentProps: {
folderId: folderId
serialNumber: serialNumber,
profile: this.profile
},
cssClass: 'publication-detail',
cssClass: 'modal',
backdropDismiss: false
});
case 2:
case 3:
modal = _context3.sent;
_context3.next = 5;
_context3.next = 6;
return modal.present();
case 5:
modal.onDidDismiss();
case 6:
modal.onDidDismiss().then(function (res) {
if (res) {
console.log(res);
}
});
case 7:
case "end":
return _context3.stop();
}
@@ -740,8 +775,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}));
}
}, {
key: "viewPublications",
value: function viewPublications(folderId) {
key: "viewPublicationDetail",
value: function viewPublicationDetail(folderId) {
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
var modal;
return regeneratorRuntime.wrap(function _callee4$(_context4) {
@@ -750,14 +785,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
case 0:
_context4.next = 2;
return this.modalController.create({
component: _app_pages_publications_view_publications_view_publications_page__WEBPACK_IMPORTED_MODULE_7__["ViewPublicationsPage"],
/* enterAnimation,
leaveAnimation, */
component: _app_pages_publications_view_publications_publication_detail_publication_detail_page__WEBPACK_IMPORTED_MODULE_6__["PublicationDetailPage"],
componentProps: {
item: folderId
folderId: folderId
},
cssClass: 'new-action',
cssClass: 'publication-detail',
backdropDismiss: false
});
@@ -777,6 +809,44 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}, _callee4, this);
}));
}
}, {
key: "viewPublications",
value: function viewPublications(folderId) {
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
var modal;
return regeneratorRuntime.wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
_context5.next = 2;
return this.modalController.create({
component: _app_pages_publications_view_publications_view_publications_page__WEBPACK_IMPORTED_MODULE_7__["ViewPublicationsPage"],
/* enterAnimation,
leaveAnimation, */
componentProps: {
item: folderId
},
cssClass: 'new-action',
backdropDismiss: false
});
case 2:
modal = _context5.sent;
_context5.next = 5;
return modal.present();
case 5:
modal.onDidDismiss();
case 6:
case "end":
return _context5.stop();
}
}
}, _callee5, this);
}));
}
}]);
return HomePage;
@@ -788,7 +858,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}, {
type: _services_processes_service__WEBPACK_IMPORTED_MODULE_4__["ProcessesService"]
}, {
type: _angular_router__WEBPACK_IMPORTED_MODULE_10__["Router"]
type: _angular_router__WEBPACK_IMPORTED_MODULE_11__["Router"]
}, {
type: _ionic_angular__WEBPACK_IMPORTED_MODULE_5__["ModalController"]
}];
File diff suppressed because one or more lines are too long