Update event callback.

This commit is contained in:
Hevin 2016-07-20 14:34:35 +08:00
parent 7da0a25db0
commit 5547d5716e
3 changed files with 15 additions and 18 deletions

View File

@ -226,7 +226,7 @@ JPush SDK 会以广播的形式发送 RegistrationID 到应用程序。
var alertContent;
if(device.platform == "Android") {
alertContent = window.plugins.jPushPlugin.openNotification.alert;
alertContent = event.alert;
} else {
alertContent = event.aps.alert;
}
@ -280,7 +280,7 @@ ps点击通知后传递的 json object 保存在 window.plugins.jPushPlugin.o
var alertContent;
if(device.platform == "Android") {
alertContent = window.plugins.jPushPlugin.receiveNotification.alert;
alertContent = event.alert;
} else {
alertContent = event.aps.alert;
}
@ -339,7 +339,7 @@ ps点击通知后传递的 json object 保存在 window.plugins.jPushPlugin.r
try{
var message
if(device.platform == "Android") {
message = window.plugins.jPushPlugin.receiveMessage.message;
message = event.message;
} else {
message = event.content;
}

View File

@ -47,7 +47,7 @@
try {
var alertContent;
if (device.platform == "Android") {
alertContent = window.plugins.jPushPlugin.openNotification.alert;
alertContent = event.alert;
} else {
alertContent = event.aps.alert;
}
@ -61,7 +61,7 @@
try {
var alertContent;
if (device.platform == "Android") {
alertContent = window.plugins.jPushPlugin.receiveNotification.alert;
alertContent = event.alert;
} else {
alertContent = event.aps.alert;
}
@ -75,7 +75,7 @@
try {
var message;
if (device.platform == "Android") {
message = window.plugins.jPushPlugin.receiveMessage.message;
message = event.message;
} else {
message = event.content;
}

View File

@ -245,11 +245,10 @@ JPushPlugin.prototype.setCustomPushNotificationBuilder = function () {
JPushPlugin.prototype.receiveMessageInAndroidCallback = function (data) {
try {
console.log('JPushPlugin:receiveMessageInAndroidCallback')
data = JSON.stringify(data)
var bToObj = JSON.parse(data)
this.receiveMessage = bToObj
cordova.fireDocumentEvent('jpush.receiveMessage', null)
console.log('JPushPlugin:receiveMessageInAndroidCallback: ' + data)
this.receiveMessage = JSON.parse(data)
cordova.fireDocumentEvent('jpush.receiveMessage', this.receiveMessage)
} catch(exception) {
console.log('JPushPlugin:pushCallback ' + exception)
}
@ -257,11 +256,10 @@ JPushPlugin.prototype.receiveMessageInAndroidCallback = function (data) {
JPushPlugin.prototype.openNotificationInAndroidCallback = function (data) {
try {
console.log('JPushPlugin:openNotificationInAndroidCallback')
data = JSON.stringify(data)
var bToObj = JSON.parse(data)
this.openNotification = bToObj
cordova.fireDocumentEvent('jpush.openNotification', null)
console.log('JPushPlugin:openNotificationInAndroidCallback: ' + data)
this.openNotification = JSON.parse(data)
cordova.fireDocumentEvent('jpush.openNotification', this.openNotification)
} catch(exception) {
console.log(exception)
}
@ -269,11 +267,10 @@ JPushPlugin.prototype.openNotificationInAndroidCallback = function (data) {
JPushPlugin.prototype.receiveNotificationInAndroidCallback = function (data) {
try {
console.log('JPushPlugin:receiveNotificationInAndroidCallback')
data = JSON.stringify(data)
var bToObj = JSON.parse(data)
this.receiveNotification = bToObj
cordova.fireDocumentEvent('jpush.receiveNotification', null)
console.log('JPushPlugin:receiveNotificationInAndroidCallback: ' + data)
this.receiveNotification = JSON.parse(data)
cordova.fireDocumentEvent('jpush.receiveNotification', this.receiveNotification)
} catch(exception) {
console.log(exception)
}