mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
Cache of Firebase token
This commit is contained in:
@@ -483,15 +483,22 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
||||
var _capacitor_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(
|
||||
/*! @capacitor/core */
|
||||
"./node_modules/@capacitor/core/dist/esm/index.js");
|
||||
/* harmony import */
|
||||
|
||||
|
||||
var _angular_router__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(
|
||||
/*! @angular/router */
|
||||
"./node_modules/@angular/router/__ivy_ngcc__/fesm2015/router.js");
|
||||
|
||||
var PushNotifications = _capacitor_core__WEBPACK_IMPORTED_MODULE_5__["Plugins"].PushNotifications;
|
||||
|
||||
var HomePage = /*#__PURE__*/function () {
|
||||
function HomePage(eventService, processesbackend) {
|
||||
function HomePage(eventService, processesbackend, router) {
|
||||
_classCallCheck(this, HomePage);
|
||||
|
||||
this.eventService = eventService;
|
||||
this.processesbackend = processesbackend;
|
||||
this.router = router;
|
||||
this.totalEvent = 0;
|
||||
this.totalExpediente = 0;
|
||||
}
|
||||
@@ -519,13 +526,22 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
||||
this.processesbackend.GetTasksList("Expediente", true).subscribe(function (result) {
|
||||
_this.totalExpediente = result;
|
||||
});
|
||||
PushNotifications.requestPermission().then(function (result) {
|
||||
PushNotifications.register();
|
||||
});
|
||||
PushNotifications.addListener('registration', function (token) {
|
||||
alert('Push registration success, token: ' + token.value);
|
||||
console.log('FIREBASE: ', token.value);
|
||||
});
|
||||
/*
|
||||
(PushNotifications as any).requestPermission().then(result => {
|
||||
PushNotifications.register();
|
||||
});
|
||||
|
||||
PushNotifications.addListener(
|
||||
'registration',
|
||||
(token: PushNotificationToken) => {
|
||||
alert('Push registration success, token: ' + token.value);
|
||||
console.log('FIREBASE: ', token.value)
|
||||
this.storageService.store(this.username,token.value);
|
||||
},
|
||||
);
|
||||
|
||||
console.log(this.storageService.get(this.username)) */
|
||||
|
||||
PushNotifications.addListener('registrationError', function (error) {
|
||||
alert('Error on registration: ' + JSON.stringify(error));
|
||||
});
|
||||
@@ -533,7 +549,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
||||
alert('Push received: ' + JSON.stringify(notification));
|
||||
});
|
||||
PushNotifications.addListener('pushNotificationActionPerformed', function (notification) {
|
||||
alert('Push action performed: ' + JSON.stringify(notification));
|
||||
alert('Push action performed: ' + JSON.stringify(notification.notification.data));
|
||||
|
||||
_this.router.navigate(['/home/events']);
|
||||
});
|
||||
}
|
||||
}]);
|
||||
@@ -546,6 +564,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
||||
type: _services_events_service__WEBPACK_IMPORTED_MODULE_2__["EventsService"]
|
||||
}, {
|
||||
type: _services_processes_service__WEBPACK_IMPORTED_MODULE_4__["ProcessesService"]
|
||||
}, {
|
||||
type: _angular_router__WEBPACK_IMPORTED_MODULE_6__["Router"]
|
||||
}];
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user