trying migration from cordova to capacitor

This commit is contained in:
tiago.kayaya
2021-11-04 10:41:43 +01:00
parent 0cb4097c88
commit 98cb655735
12 changed files with 268 additions and 2199 deletions
+10 -11
View File
@@ -1,6 +1,5 @@
/* eslint-disable */
/* tslint:disable */
///<reference path="../../../plugins/cordova-plugin-mfp-push/typings/mfppush.d.ts" />
import { Injectable, NgZone } from '@angular/core';
import { ActivatedRoute } from '@angular/router'
import { HttpClient } from '@angular/common/http';
@@ -45,10 +44,10 @@ export class NotificationsService {
private activeroute: ActivatedRoute,
private jsonstore: JsonStore,
private eventtrigger: EventTrigger,
private backgroundservice: BackgroundService) {
private backgroundservice: BackgroundService) {
this.storageService.get("Notifications").then((value) => {
}).catch(()=>{
this.storageService.store("Notifications",[])
@@ -96,7 +95,7 @@ export class NotificationsService {
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
(token) => {
console.log('Push Notification: Success ' + token);
window['MFPPush'].initialize(
function (successResponse) {
console.log("Push notification Successfully Service intialized: " + successResponse);
@@ -105,7 +104,7 @@ export class NotificationsService {
console.log("Push notification failure Service intialized: " + failureResponse);
}
);
window['MFPPush'].registerDevice(null, async (successResponse) => {
console.log("Successfully registered: " + JSON.stringify(successResponse));
console.log('token: ', successResponse.deviceId)
@@ -127,7 +126,7 @@ export class NotificationsService {
console.log('TOKEN USER MIDLE', data);
})
});
});
},
function (failureResponse) {
@@ -157,7 +156,7 @@ export class NotificationsService {
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
(token) => {
console.log('Push Notification: Success ' + token);
window['MFPPush'].initialize(
function (successResponse) {
console.log("Push notification Successfully intialized: " + successResponse);
@@ -172,7 +171,7 @@ export class NotificationsService {
this.DataArray.push(message)
console.log("On ReceiveNotification", this.DataArray)
this.storageService.store("Notifications",this.DataArray)
console.log(message);
this.eventtrigger.publishSomeData({
notification: "recive"
@@ -180,11 +179,11 @@ export class NotificationsService {
var data = JSON.parse(message.payload);
//synchro.$send(data)
console.log('data.Service', data.Service); // module
console.log('data.IdObject', data.IdObject); // Object id
console.log('data.Object', data.Object); // details
if(message.actionName){
this.notificatinsRoutes(data);
} else {
@@ -192,7 +191,7 @@ export class NotificationsService {
//this.notificatinsRoutes(data);
console.log(data)
}
this.callbacks.forEach( e=> {
if(e.type == data.Object || e.type == "any") {
e.funx()