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; var alertContent;
if(device.platform == "Android") { if(device.platform == "Android") {
alertContent = window.plugins.jPushPlugin.openNotification.alert; alertContent = event.alert;
} else { } else {
alertContent = event.aps.alert; alertContent = event.aps.alert;
} }
@ -280,7 +280,7 @@ ps点击通知后传递的 json object 保存在 window.plugins.jPushPlugin.o
var alertContent; var alertContent;
if(device.platform == "Android") { if(device.platform == "Android") {
alertContent = window.plugins.jPushPlugin.receiveNotification.alert; alertContent = event.alert;
} else { } else {
alertContent = event.aps.alert; alertContent = event.aps.alert;
} }
@ -339,7 +339,7 @@ ps点击通知后传递的 json object 保存在 window.plugins.jPushPlugin.r
try{ try{
var message var message
if(device.platform == "Android") { if(device.platform == "Android") {
message = window.plugins.jPushPlugin.receiveMessage.message; message = event.message;
} else { } else {
message = event.content; message = event.content;
} }

View File

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

View File

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