mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Pushnotification added
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
///<reference path="../../../plugins/cordova-plugin-mfp/typings/worklight.d.ts" />
|
||||
///<reference path="../../../plugins/cordova-plugin-mfp-push/typings/mfppush.d.ts" />
|
||||
import { Component, OnInit, NgZone } from '@angular/core';
|
||||
import { EventsService } from '../services/events.service';
|
||||
import { formatDate } from '@angular/common';
|
||||
@@ -34,6 +36,7 @@ export class HomePage implements OnInit {
|
||||
constructor(private zone: NgZone,private eventService: EventsService, private processesbackend: ProcessesService, private router: Router, private modalController: ModalController,) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.mobileFirstTest()
|
||||
/* //Initialize profile as mdgpr
|
||||
|
||||
let date = new Date();
|
||||
@@ -111,7 +114,7 @@ export class HomePage implements OnInit {
|
||||
); */
|
||||
}
|
||||
|
||||
/* mobileFirstTest() {
|
||||
mobileFirstTest() {
|
||||
this.zone.run(() => {
|
||||
alert("Hello MobileFirst");
|
||||
alert("Connecting to Server...");
|
||||
@@ -132,20 +135,58 @@ export class HomePage implements OnInit {
|
||||
(response) => {
|
||||
// Will display "Hello world" in an alert dialog.
|
||||
alert("Success: " + response.responseText);
|
||||
this.MFPushNotification()
|
||||
},
|
||||
(error) => {
|
||||
alert("Failure: " + JSON.stringify(error));
|
||||
}
|
||||
);
|
||||
}, (error) => {
|
||||
console.log('--> pingMFP(): failure ', error.responseText);
|
||||
alert(JSON.stringify(error))
|
||||
this.zone.run(() => {
|
||||
alert("Bummer...");
|
||||
alert("Failed to connect to MobileFirst Server");
|
||||
});
|
||||
}
|
||||
);
|
||||
} */
|
||||
}
|
||||
|
||||
MFPushNotification() {
|
||||
|
||||
var pushNotificationReceived = function (message) {
|
||||
alert(JSON.stringify(message));
|
||||
}
|
||||
|
||||
MFPPush.initialize (
|
||||
function(successResponse) {
|
||||
//alert("Successfully intialized");
|
||||
MFPPush.registerNotificationsCallback(notificationReceived);
|
||||
},
|
||||
function(failureResponse) {
|
||||
console.log("Failed to initialize");
|
||||
}
|
||||
);
|
||||
MFPPush.isPushSupported (
|
||||
function(successResponse) {
|
||||
//alert("Push Supported: " + successResponse);
|
||||
},
|
||||
function(failureResponse) {
|
||||
console.log("Failed to get push support status");
|
||||
}
|
||||
);
|
||||
MFPPush.registerDevice(
|
||||
null,function(successResponse) {
|
||||
alert("Successfully registered: "+ successResponse);
|
||||
},
|
||||
function(failureResponse) {
|
||||
alert("Successfully registered: "+ failureResponse);
|
||||
}
|
||||
);
|
||||
function notificationReceived(message) {
|
||||
alert(JSON.stringify(message.alert));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async openApproveModal(eventSerialNumber){
|
||||
const modal = await this.modalController.create({
|
||||
|
||||
Reference in New Issue
Block a user