diff --git a/package-lock.json b/package-lock.json index 857cf86e5..bad395976 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2162,6 +2162,11 @@ "resolved": "https://registry.npmjs.org/@capacitor/keyboard/-/keyboard-1.1.2.tgz", "integrity": "sha512-EUduhQzrHma4PlGfdSxVeGIwxR2+/xLRDbjQH5Q4cXqrlYssIX2UyQrL4wNpDaAOg1Z4VD8EzzVolC81LG6Q+A==" }, + "@capacitor/push-notifications": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@capacitor/push-notifications/-/push-notifications-1.0.7.tgz", + "integrity": "sha512-vbvAptFq5cI6xKYYWMb7tsWvA88/PTG4v6ptxN0Ygtc1fQ4l/AzONQiYqdtFpbBhF2fML2kXQ/5eSAfn8HY9aw==" + }, "@capacitor/status-bar": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@capacitor/status-bar/-/status-bar-1.0.5.tgz", diff --git a/package.json b/package.json index 67bc368d0..92ffef029 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "@capacitor/core": "^3.3.0", "@capacitor/haptics": "^1.1.2", "@capacitor/keyboard": "^1.1.2", + "@capacitor/push-notifications": "^1.0.7", "@capacitor/status-bar": "^1.0.5", "@fortawesome/angular-fontawesome": "^0.9.0", "@fortawesome/fontawesome-free": "^5.15.3", diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 66d63b16e..d3f69aa73 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -2,8 +2,8 @@ /* tslint:disable */ import { Component, OnInit, NgZone } from '@angular/core'; import { Event } from '../models/event.model'; -/* import { NotificationsService } from '../services/notifications.service'; -import { WebNotificationsService } from '../services/webnotifications.service'; */ +import { NotificationsService } from '../services/notifications.service'; +/*import { WebNotificationsService } from '../services/webnotifications.service'; */ import { AlertController, Platform } from '@ionic/angular'; import { Router, ActivatedRoute } from '@angular/router'; import { ToDayEventStorage } from '../store/to-day-event-storage.service'; @@ -14,7 +14,7 @@ import { InativityService } from '../services/inativity.service'; import { SessionStore } from '../store/session.service'; import { StorageService } from '../services/storage.service'; import { File } from '@ionic-native/file/ngx'; -import { WebNotificationPopupService } from '../services/notification/web-notification-popup.service'; +/* import { WebNotificationPopupService } from '../services/notification/web-notification-popup.service'; */ import { DocumentCounterService } from '../services/worker/document-counter.service'; import { PermissionService } from '../services/worker/permission.service'; import { Network } from '@ionic-native/network/ngx'; @@ -24,7 +24,6 @@ import { Storage } from '@ionic/storage'; import { EventsService } from 'src/app/services/events.service'; import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx'; - @Component({ selector: 'app-home', templateUrl: './home.page.html', @@ -70,7 +69,7 @@ export class HomePage implements OnInit { private zone: NgZone, private router: Router, public modalCtrl: AlertController, - /* private notificationsService: NotificationsService, */ + private notificationsService: NotificationsService, private platform: Platform, private activeroute: ActivatedRoute, /* private webnotification: WebNotificationsService, */ @@ -79,14 +78,14 @@ export class HomePage implements OnInit { private despachoRule: DespachoService, private inativityService: InativityService, private storageService: StorageService, - private webNotificationPopupService: WebNotificationPopupService, + /* private webNotificationPopupService: WebNotificationPopupService, */ private backgroundservice: BackgroundService, private offlinemanager: OfflineManagerService, private storage: Storage, private eventservice: EventsService, private screenOrientation: ScreenOrientation,) { - this.webNotificationPopupService.askNotificationPermission() + /* this.webNotificationPopupService.askNotificationPermission() */ this.router.events.subscribe((val) => { document.querySelectorAll('ion-modal').forEach((e: any) => e.remove()) @@ -114,6 +113,8 @@ export class HomePage implements OnInit { ngOnInit() { + this.notificationsService.onReciveForeground(); + this.notificationsService.onReciveBackground(); window.addEventListener('online', () => { console.log('Became online') @@ -143,12 +144,12 @@ export class HomePage implements OnInit { updateList() { - /* this.notificationsService.registerCallback( - 'despachos', - () => { - this.despachoRule.getList({ updateStore: true }) - } - ) */ + /* this.notificationsService.registerCallback( + 'despachos', + () => { + this.despachoRule.getList({ updateStore: true }) + } + ) */ document.addEventListener('pause', function () { // console.log('App going to background'); diff --git a/src/app/modals/profile/profile.page.html b/src/app/modals/profile/profile.page.html index ff5276b6e..5069a3183 100644 --- a/src/app/modals/profile/profile.page.html +++ b/src/app/modals/profile/profile.page.html @@ -56,8 +56,8 @@

{{item.Location}}

-

{{item.alert}}

-

{{item.desc}}

+

{{item.title}}

+

{{item.body}}