From eb499f50a7f204b3ea2a25fb9ca5422bfe7f6a72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Fri, 25 Jun 2021 15:03:10 +0100 Subject: [PATCH 01/14] Ibm web packge added --- package-lock.json | 22 ++++++++++++++++++++++ package.json | 1 + src/app/home/home.page.ts | 20 +++++++++++++++++++- src/index.html | 2 ++ 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 3f903fda6..82c669436 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11254,6 +11254,28 @@ "sjcl": "^1.0.8" } }, + "ibm-mfp-web-sdk": { + "version": "8.0.2021021706", + "resolved": "https://registry.npmjs.org/ibm-mfp-web-sdk/-/ibm-mfp-web-sdk-8.0.2021021706.tgz", + "integrity": "sha512-lk87kZzmBow7Ie+wll5zXsQo0Dok3sj7DeltHUl3rOJ0ia+5sqYOfDGJAyky8pYagGfkAEHUAoleuv8S/GwPpw==", + "requires": { + "jssha": "2.2.0", + "promiz": "1.0.5", + "sjcl": "1.0.3" + }, + "dependencies": { + "jssha": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/jssha/-/jssha-2.2.0.tgz", + "integrity": "sha1-h9z2CCHcO+xZPzhVu+vM0naqzBw=" + }, + "sjcl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sjcl/-/sjcl-1.0.3.tgz", + "integrity": "sha1-TtSGSY7Wt0K11KIZAiaBFvBUpwk=" + } + } + }, "ical.js": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/ical.js/-/ical.js-1.4.0.tgz", diff --git a/package.json b/package.json index 982a4ff18..79937898a 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "date-fns": "^2.17.0", "depd": "^2.0.0", "ibm-mfp-web-push": "^8.0.2020052213", + "ibm-mfp-web-sdk": "^8.0.2021021706", "ionic-angular": "^3.9.10", "ionic-selectable": "^4.7.1", "ionic2-alpha-scroll": "^2.0.1", diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 841a86ff0..ed31cbc98 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -8,6 +8,7 @@ import { NotificationsService } from '../services/notifications.service'; import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular'; import { NavigationExtras,Router } from '@angular/router'; import { ToastService } from '../services/toast.service'; +import MFPPush from 'ibm-mfp-web-push'; @Component({ selector: 'app-home', @@ -67,7 +68,14 @@ export class HomePage implements OnInit { ngOnInit() { if(this.platform.is('desktop') || this.platform.is('mobileweb')) { - console.log('Notifications not supported') + WL.Client.init(this.wlInitOptions) + + /* var pushInitOptions = { + appId: "com.gpr.gabinetedigital", + serverUrl:"https://mfp-server-url.com", + safariWebsitePushId:"web.com.mfp-server-url" + }; + MFPPush.initialize(pushInitOptions); */ } else { this.mobilefirstConnect(); this.notificatinsservice.onReceviNotification(); @@ -133,4 +141,14 @@ export class HomePage implements OnInit { ); } + + + wlInitOptions = { + mfpContextRoot : '/mfp', // "mfp" is the default context root in the Mobile Foundation + applicationId : 'com.gpr.gabinetedigital', // Replace with your own value. + sessionMode : true //This is an optional paramter. Setting this to true ensures that MFP related data is stored in the session rather than in the local storage. If this option is set to false or not set at all, default is local storage. +}; + + + } diff --git a/src/index.html b/src/index.html index c85c54d3d..553bfaa3f 100644 --- a/src/index.html +++ b/src/index.html @@ -7,6 +7,8 @@ + + - + + - - --> From 6d907aa7deb3c7a72784512ac6296bd7eda9a90e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Wed, 30 Jun 2021 11:51:29 +0100 Subject: [PATCH 05/14] Bug connectiong with mobilefirst fixid --- src/app/home/home.page.ts | 24 ++++------------------- src/app/services/notifications.service.ts | 2 +- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 65daad313..841a86ff0 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -5,12 +5,10 @@ import { EventsService } from '../services/events.service'; import { Event } from '../models/event.model'; import { ProcessesService } from '../services/processes.service'; import { NotificationsService } from '../services/notifications.service'; -import { WebNotificationsService } from '../services/webnotifications.service'; import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular'; import { NavigationExtras,Router } from '@angular/router'; import { ToastService } from '../services/toast.service'; - @Component({ selector: 'app-home', templateUrl: './home.page.html', @@ -55,7 +53,6 @@ export class HomePage implements OnInit { private toastService: ToastService, private animationController: AnimationController, private notificatinsservice: NotificationsService, - private webnotificatinsservice: WebNotificationsService, private platform: Platform) { router.events.subscribe((val) => { @@ -69,15 +66,11 @@ export class HomePage implements OnInit { } ngOnInit() { - console.log('Home'); - if(this.platform.is('desktop') /* || this.platform.is('mobileweb') */) { - /* this.webnotificatinsservice.webconnection(); - this.webnotificatinsservice.onReceviNotificationWeb(); */ - console.log('desktop'); + if(this.platform.is('desktop') || this.platform.is('mobileweb')) { + console.log('Notifications not supported') } else { - /* this.mobilefirstConnect(); - this.notificatinsservice.onReceviNotification(); */ - console.log('mobile'); + this.mobilefirstConnect(); + this.notificatinsservice.onReceviNotification(); } this.count(); @@ -110,7 +103,6 @@ export class HomePage implements OnInit { } mobilefirstConnect() { - console.log('MobileFirst Connect') WLAuthorizationManager.obtainAccessToken("").then( (token) => { console.log('MobileFirst Server connect: Success ' + token); @@ -141,12 +133,4 @@ export class HomePage implements OnInit { ); } - - - - - - - - } diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index bf7396d88..b4e5df8bf 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -136,7 +136,7 @@ export class NotificationsService { }else if (data.Service === "gabinete-digital" && data.Object === "despachos") { let navigationExtras: NavigationExtras = { queryParams: { - "serialNumber": data.IdObject, + serialNumber: data.IdObject, } }; this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos/despacho'], navigationExtras)); From 89afc95c326f2c38fd318c0fbcc91979f3ff8fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Wed, 30 Jun 2021 15:33:12 +0100 Subject: [PATCH 06/14] Edit websnotification file --- src/app/home/home.page.ts | 6 ++++- src/app/services/webnotifications.service.ts | 24 ++++++++++---------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 841a86ff0..3b9c99341 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -9,6 +9,8 @@ import { ModalController, AlertController, AnimationController, Platform } from import { NavigationExtras,Router } from '@angular/router'; import { ToastService } from '../services/toast.service'; +import { WebNotificationsService } from '../services/webnotifications.service'; + @Component({ selector: 'app-home', templateUrl: './home.page.html', @@ -53,6 +55,7 @@ export class HomePage implements OnInit { private toastService: ToastService, private animationController: AnimationController, private notificatinsservice: NotificationsService, + private webnotificatinsservice: WebNotificationsService, private platform: Platform) { router.events.subscribe((val) => { @@ -67,7 +70,8 @@ export class HomePage implements OnInit { ngOnInit() { if(this.platform.is('desktop') || this.platform.is('mobileweb')) { - console.log('Notifications not supported') + this.webnotificatinsservice.webconnection(); + this.webnotificatinsservice.onReceviNotificationWeb(); } else { this.mobilefirstConnect(); this.notificatinsservice.onReceviNotification(); diff --git a/src/app/services/webnotifications.service.ts b/src/app/services/webnotifications.service.ts index 265e88ef6..b3d84427b 100644 --- a/src/app/services/webnotifications.service.ts +++ b/src/app/services/webnotifications.service.ts @@ -30,22 +30,22 @@ export class WebNotificationsService { webconnection() { - WL.Client.init(this.wlInitOptions) - var pushInitOptions = { + + MFPPush.initialize({ appId: "com.gpr.gabinetedigital", - serverUrl:"http://gpr-dev-10.gabinetedigital.local:9080/", - //safariWebsitePushId:"web.com.mfp-server-url" - }; - MFPPush.initialize(pushInitOptions); + mfpContextRoot: "/mfp", + }); + + MFPPush.registerDevice() + .then((res) => { + alert("WEB Successfully Registered Device..."); + }) + .catch((err) => { + console.log("WEB Registration Failed" + err); + }); } - wlInitOptions = { - mfpContextRoot : '/mfp', // "mfp" is the default context root in the Mobile Foundation - applicationId : 'com.gpr.gabinetedigital', // Replace with your own value. - sessionMode : true //This is an optional paramter. Setting this to true ensures that MFP related data is stored in the session rather than in the local storage. If this option is set to false or not set at all, default is local storage. -}; - async onReceviNotificationWeb() { WLAuthorizationManager.obtainAccessToken("push.mobileclient").then( (token) => { From bdbf30802b7a295cd38ff5730ad13a85e879738d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Fri, 2 Jul 2021 11:07:46 +0100 Subject: [PATCH 07/14] Bug fixed --- src/app/home/home.page.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 3b9c99341..841a86ff0 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -9,8 +9,6 @@ import { ModalController, AlertController, AnimationController, Platform } from import { NavigationExtras,Router } from '@angular/router'; import { ToastService } from '../services/toast.service'; -import { WebNotificationsService } from '../services/webnotifications.service'; - @Component({ selector: 'app-home', templateUrl: './home.page.html', @@ -55,7 +53,6 @@ export class HomePage implements OnInit { private toastService: ToastService, private animationController: AnimationController, private notificatinsservice: NotificationsService, - private webnotificatinsservice: WebNotificationsService, private platform: Platform) { router.events.subscribe((val) => { @@ -70,8 +67,7 @@ export class HomePage implements OnInit { ngOnInit() { if(this.platform.is('desktop') || this.platform.is('mobileweb')) { - this.webnotificatinsservice.webconnection(); - this.webnotificatinsservice.onReceviNotificationWeb(); + console.log('Notifications not supported') } else { this.mobilefirstConnect(); this.notificatinsservice.onReceviNotification(); From b68c29366e80257d9b78299ed304eaa43d306478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Fri, 2 Jul 2021 14:40:24 +0100 Subject: [PATCH 08/14] Despachos route notification changed --- .../pages/gabinete-digital/despachos/despachos.page.ts | 1 + src/app/services/notifications.service.ts | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/app/pages/gabinete-digital/despachos/despachos.page.ts b/src/app/pages/gabinete-digital/despachos/despachos.page.ts index 73962cf15..b64833626 100644 --- a/src/app/pages/gabinete-digital/despachos/despachos.page.ts +++ b/src/app/pages/gabinete-digital/despachos/despachos.page.ts @@ -147,6 +147,7 @@ export class DespachosPage implements OnInit { } async GoToDespacho(serialNumber:any) { + console.log('Despachos serial',serialNumber) this.router.navigate(['/home/gabinete-digital/despachos',serialNumber,'gabinete-digital']); } diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index b4e5df8bf..7ff735300 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -134,12 +134,8 @@ export class NotificationsService { else if (data.Service === "gabinete-digital" && data.Object === "event-list") { this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',data.IdObject, 'gabinete-digital'])); }else if (data.Service === "gabinete-digital" && data.Object === "despachos") { - let navigationExtras: NavigationExtras = { - queryParams: { - serialNumber: data.IdObject, - } - }; - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos/despacho'], navigationExtras)); + + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos',data.IdObject,'gabinete-digital'])); } else if (data.Service === "gabinete-digital" && data.Object === "parecer") { let navigationExtras: NavigationExtras = { From d63717970397f5fa18ec94d77c31c9ab0a6e1d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Tue, 6 Jul 2021 09:02:24 +0100 Subject: [PATCH 09/14] Despachos pr route added --- src/app/services/notifications.service.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index 7ff735300..c72ff8bb8 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -155,6 +155,15 @@ export class NotificationsService { }; this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos/pedido'], navigationExtras)); } + else if (data.Service === "gabinete-digital" && data.Object === "despachos-pr") { + + let navigationExtras: NavigationExtras = { + queryParams: { + "serialNumber": data.IdObject, + } + }; + this.router.navigate(['/home/gabinete-digital/despachos-pr/despacho-pr'], navigationExtras); + } else if (data.Service === "accoes" && data.Object === "accao") { this.zone.run(() => this.router.navigate(['/home/publications',data.IdObject])); } From 50eb5b55c0bff99db9fe4ab2e9b456170084e6dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Tue, 6 Jul 2021 16:17:03 +0100 Subject: [PATCH 10/14] Route added --- src/app/services/notifications.service.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index c72ff8bb8..718a0aaa6 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -162,7 +162,7 @@ export class NotificationsService { "serialNumber": data.IdObject, } }; - this.router.navigate(['/home/gabinete-digital/despachos-pr/despacho-pr'], navigationExtras); + this.zone.run(() =>this.router.navigate(['/home/gabinete-digital/despachos-pr/despacho-pr'], navigationExtras)); } else if (data.Service === "accoes" && data.Object === "accao") { this.zone.run(() => this.router.navigate(['/home/publications',data.IdObject])); @@ -170,6 +170,20 @@ export class NotificationsService { else if (data.Service === "accoes" && data.Object === "publicacao") { this.zone.run(() => this.router.navigate(['/home/publications/view-publications',data.FolderId,data.IdObject])); } + else if (data.Service === "gabinete-digital" && data.Object === "diplomas") { + this.zone.run(() =>this.router.navigate(['/home/gabinete-digital/diplomas', data.IdObject, 'gabinete-digital'])); + } + else if (data.Service === "gabinete-digital" && data.Object === "diplomas-assinar") { + let navigationExtras: NavigationExtras = { + queryParams: { + "serialNumber": data.IdObject, + } + }; + this.zone.run(() =>this.router.navigate(['/home/gabinete-digital/diplomas-assinar/diploma-assinar'], navigationExtras)); + } + else if (data.Service === "gabinete-digital" && data.Object === "expedientes-pr") { + this.zone.run(() =>this.router.navigate(['/home/gabinete-digital/expedientes-pr',data.IdObject,'gabinete-digital'])); + } } platformVerify() { From ded3c2f033073f1e24991b4f61e9ed46a4dd4f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Wed, 7 Jul 2021 15:28:29 +0100 Subject: [PATCH 11/14] Bug solved on pedidos route --- src/app/home/home.page.ts | 6 +++-- .../pedidos/pedidos.page.html | 2 +- src/app/services/notifications.service.ts | 24 +++++++------------ 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 841a86ff0..af4ebd150 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -6,7 +6,7 @@ import { Event } from '../models/event.model'; import { ProcessesService } from '../services/processes.service'; import { NotificationsService } from '../services/notifications.service'; import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular'; -import { NavigationExtras,Router } from '@angular/router'; +import { NavigationExtras,Router,ActivatedRoute } from '@angular/router'; import { ToastService } from '../services/toast.service'; @Component({ @@ -53,7 +53,8 @@ export class HomePage implements OnInit { private toastService: ToastService, private animationController: AnimationController, private notificatinsservice: NotificationsService, - private platform: Platform) { + private platform: Platform, + private activeroute: ActivatedRoute) { router.events.subscribe((val) => { document.querySelectorAll('ion-modal').forEach((e) => e.remove()) @@ -66,6 +67,7 @@ export class HomePage implements OnInit { } ngOnInit() { + console.log('Active route ',this.router.url) if(this.platform.is('desktop') || this.platform.is('mobileweb')) { console.log('Notifications not supported') } else { diff --git a/src/app/pages/gabinete-digital/pedidos/pedidos.page.html b/src/app/pages/gabinete-digital/pedidos/pedidos.page.html index 4bdf3d3bd..586f92eed 100644 --- a/src/app/pages/gabinete-digital/pedidos/pedidos.page.html +++ b/src/app/pages/gabinete-digital/pedidos/pedidos.page.html @@ -77,7 +77,7 @@ diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index 718a0aaa6..9d7bb32a2 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -1,5 +1,6 @@ /// import { Injectable, NgZone } from '@angular/core'; +import { ActivatedRoute } from '@angular/router' import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; import { environment } from 'src/environments/environment'; import { StorageService } from 'src/app/services/storage.service'; @@ -26,7 +27,8 @@ export class NotificationsService { private platform: Platform, private router: Router, private toastService: ToastService, - private zone: NgZone) { } + private zone: NgZone, + private activeroute: ActivatedRoute) { } getTokenByUserIdAndId(user, userID) { const geturl = environment.apiURL + 'notifications/user/' + userID; @@ -135,25 +137,15 @@ export class NotificationsService { this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',data.IdObject, 'gabinete-digital'])); }else if (data.Service === "gabinete-digital" && data.Object === "despachos") { - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos',data.IdObject,'gabinete-digital'])); + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos',data.IdObject,'gabinete-digital'],{replaceUrl: true})); } else if (data.Service === "gabinete-digital" && data.Object === "parecer") { - let navigationExtras: NavigationExtras = { - queryParams: { - enterAnimation: "", - serialNumber: data.IdObject, - } - }; - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos/pedido'], navigationExtras)); + + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos',data.IdObject,'gabinete-digital'])); } else if (data.Service === "gabinete-digital" && data.Object === "deferimento") { - let navigationExtras: NavigationExtras = { - queryParams: { - enterAnimation: "", - serialNumber: data.IdObject, - } - }; - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos/pedido'], navigationExtras)); + + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos',data.IdObject,'gabinete-digital'])); } else if (data.Service === "gabinete-digital" && data.Object === "despachos-pr") { From b9c201f8dc33f73572c2cbcb5f7622911fb633a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Wed, 7 Jul 2021 16:36:49 +0100 Subject: [PATCH 12/14] Uncoment directupdate on index file --- src/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.html b/src/index.html index dc03b9fb1..f1e90bcc6 100644 --- a/src/index.html +++ b/src/index.html @@ -10,7 +10,7 @@ - + - @@ -79,7 +79,7 @@ --> - { if( window.innerWidth < 801) { this.hideRefreshBtn = false; + this.showSlidingOptions = false; } else{ this.hideRefreshBtn = true; + this.showSlidingOptions = true; } } if(window.innerWidth < 801){ - console.log('YASS'); this.hideRefreshBtn = false; + this.showSlidingOptions = false; + } + else{ + this.hideRefreshBtn = true; + this.showSlidingOptions = true; } } From e91adc07fe94670b7fc6d20060b52f634a735267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Thu, 8 Jul 2021 10:48:26 +0100 Subject: [PATCH 14/14] Pipeline bug on ibm packge solved --- src/app/home/home.page.ts | 2 +- src/app/services/notifications.service.ts | 12 ++++++------ src/app/services/webnotifications.service.ts | 6 +++--- src/assets/js/index.js | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index af4ebd150..dbc8cebc6 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -105,7 +105,7 @@ export class HomePage implements OnInit { } mobilefirstConnect() { - WLAuthorizationManager.obtainAccessToken("").then( + window['WLAuthorizationManager'].obtainAccessToken("").then( (token) => { console.log('MobileFirst Server connect: Success ' + token); diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index 9d7bb32a2..1d301f801 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -43,11 +43,11 @@ export class NotificationsService { const geturl = environment.apiURL + 'notifications/token'; - WLAuthorizationManager.obtainAccessToken("push.mobileclient").then( + window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then( (token) => { console.log('Push Notification: Success ' + token); - MFPPush.initialize( + window['MFPPush'].initialize( function (successResponse) { console.log("Push notification Successfully Service intialized: " + successResponse); }, @@ -56,7 +56,7 @@ export class NotificationsService { } ); - MFPPush.registerDevice(null, (successResponse) => { + window['MFPPush'].registerDevice(null, (successResponse) => { console.log("Successfully registered: " + JSON.stringify(successResponse)); console.log('token: ', successResponse.deviceId) this.storageService.store(username, successResponse.deviceId); @@ -92,14 +92,14 @@ export class NotificationsService { } async onReceviNotification() { - WLAuthorizationManager.obtainAccessToken("push.mobileclient").then( + window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then( (token) => { console.log('Push Notification: Success ' + token); - MFPPush.initialize( + window['MFPPush'].initialize( function (successResponse) { console.log("Push notification Successfully intialized: " + successResponse); - MFPPush.registerNotificationsCallback(notificationReceived); + window['MFPPush'].registerNotificationsCallback(notificationReceived); }, function (failureResponse) { console.log("Push notification failure intialized: " + failureResponse); diff --git a/src/app/services/webnotifications.service.ts b/src/app/services/webnotifications.service.ts index b3d84427b..62b85d74d 100644 --- a/src/app/services/webnotifications.service.ts +++ b/src/app/services/webnotifications.service.ts @@ -47,7 +47,7 @@ export class WebNotificationsService { } async onReceviNotificationWeb() { - WLAuthorizationManager.obtainAccessToken("push.mobileclient").then( + window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then( (token) => { console.log('Push Notification: Success ' + token); @@ -94,7 +94,7 @@ async onReceviNotificationWeb() { const geturl = environment.apiURL + 'notifications/token'; */ /* - WLAuthorizationManager.obtainAccessToken("push.mobileclient").then( + window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then( (token) => { console.log('Push Notification: Success ' + token); @@ -143,7 +143,7 @@ async onReceviNotificationWeb() { } */ /* async onReceviNotification() { - WLAuthorizationManager.obtainAccessToken("push.mobileclient").then( + window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then( (token) => { console.log('Push Notification: Success ' + token); diff --git a/src/assets/js/index.js b/src/assets/js/index.js index 7eade3555..d99341323 100644 --- a/src/assets/js/index.js +++ b/src/assets/js/index.js @@ -1,6 +1,6 @@ function wlCommonInit() { - WLAuthorizationManager.obtainAccessToken("").then( + window['WLAuthorizationManager'].obtainAccessToken("").then( (token) => { console.log('MobileFirst Server connect: Success ' + token);