Merge with migraCapacitor

This commit is contained in:
Eudes Inácio
2021-11-05 10:29:49 +01:00
20 changed files with 1066 additions and 307 deletions
+28 -14
View File
@@ -3,7 +3,7 @@
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 { 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,10 @@ import { Storage } from '@ionic/storage';
import { EventsService } from 'src/app/services/events.service';
import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
<<<<<<< HEAD
=======
>>>>>>> migraCapacitor
@Component({
selector: 'app-home',
templateUrl: './home.page.html',
@@ -73,20 +76,24 @@ export class HomePage implements OnInit {
private notificationsService: NotificationsService,
private platform: Platform,
private activeroute: ActivatedRoute,
private webnotification: WebNotificationsService,
/* private webnotification: WebNotificationsService, */
public p: PermissionService,
public documentCounterService: DocumentCounterService,
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,
<<<<<<< HEAD
private screenOrientation: ScreenOrientation) {
=======
private screenOrientation: ScreenOrientation,) {
>>>>>>> migraCapacitor
this.webNotificationPopupService.askNotificationPermission()
/* this.webNotificationPopupService.askNotificationPermission() */
this.router.events.subscribe((val) => {
document.querySelectorAll('ion-modal').forEach((e: any) => e.remove())
@@ -114,17 +121,24 @@ export class HomePage implements OnInit {
ngOnInit() {
<<<<<<< HEAD
this.notificationsService.onReceviNotification();
=======
this.notificationsService.onReciveForeground();
this.notificationsService.onReciveBackground();
>>>>>>> migraCapacitor
window.addEventListener('online', () => {
console.log('Became online')
this.backgroundservice.online()
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
<<<<<<< HEAD
this.webnotification.webconnection();
=======
>>>>>>> migraCapacitor
} else {
this.notificationsService.onReceviNotification();
//this.mobilefirstConnect();
//this.notificationsService.onReceviNotification();
/* this.notificationsService.onReceviNotification(); */
this.offlinemanager.synchnize()
}
});
@@ -146,12 +160,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');