From b3b2af1520cb43fdd08c23f04da8e0011878e519 Mon Sep 17 00:00:00 2001 From: hevin Date: Wed, 24 May 2017 14:43:22 +0800 Subject: [PATCH] Change package name --- plugin.xml | 16 ++++++++++------ www/JPushPlugin.js | 47 +++++++++++++++++++++++----------------------- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/plugin.xml b/plugin.xml index e036468..d427576 100644 --- a/plugin.xml +++ b/plugin.xml @@ -188,14 +188,18 @@ - - + + - - + + - - + + diff --git a/www/JPushPlugin.js b/www/JPushPlugin.js index ecc80eb..321da1e 100644 --- a/www/JPushPlugin.js +++ b/www/JPushPlugin.js @@ -7,15 +7,14 @@ JPushPlugin.prototype.openNotification = {} JPushPlugin.prototype.receiveNotification = {} JPushPlugin.prototype.isPlatformIOS = function () { - var isPlatformIOS = (device.platform == 'iPhone' || - device.platform == 'iPad' || - device.platform == 'iPod touch' || - device.platform == 'iOS') - return isPlatformIOS + return (device.platform === 'iPhone' || + device.platform === 'iPad' || + device.platform === 'iPod touch' || + device.platform === 'iOS') } JPushPlugin.prototype.errorCallback = function (msg) { - console.log('Javascript Callback Error: ' + msg) + console.log('JPush Callback Error: ' + msg) } JPushPlugin.prototype.callNative = function (name, args, successCallback) { @@ -91,16 +90,16 @@ JPushPlugin.prototype.setAlias = function (alias) { // 判断系统设置中是否对本应用启用通知。 // iOS: 返回值如果大于 0,代表通知开启;0: 通知关闭。 -// UIRemoteNotificationTypeNone = 0, -// UIRemoteNotificationTypeBadge = 1 << 0, -// UIRemoteNotificationTypeSound = 1 << 1, -// UIRemoteNotificationTypeAlert = 1 << 2, -// UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3, -// Android: 返回值 1 代表通知启用、0: 通知关闭。 +// UIRemoteNotificationTypeNone = 0, +// UIRemoteNotificationTypeBadge = 1 << 0, +// UIRemoteNotificationTypeSound = 1 << 1, +// UIRemoteNotificationTypeAlert = 1 << 2, +// UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3, +// Android: 返回值 1 代表通知启用;0: 通知关闭。 JPushPlugin.prototype.getUserNotificationSettings = function (successCallback) { if (this.isPlatformIOS()) { this.callNative('getUserNotificationSettings', [], successCallback) - } else if (device.platform == 'Android') { + } else if (device.platform === 'Android') { this.callNative('areNotificationEnabled', [], successCallback) } } @@ -108,7 +107,7 @@ JPushPlugin.prototype.getUserNotificationSettings = function (successCallback) { // iOS methods JPushPlugin.prototype.startJPushSDK = function () { - this.callNative('startJPushSDK', [] , null) + this.callNative('startJPushSDK', [], null) } JPushPlugin.prototype.setBadge = function (value) { @@ -218,12 +217,12 @@ JPushPlugin.prototype.setCustomPushNotificationBuilder = function () { } JPushPlugin.prototype.receiveRegistrationIdInAndroidCallback = function (data) { - if (device.platform === 'Android') { - data = JSON.stringify(data) - var event = JSON.parse(data) - cordova.fireDocumentEvent('jpush.receiveRegistrationId', event); - } - } + if (device.platform === 'Android') { + data = JSON.stringify(data) + var event = JSON.parse(data) + cordova.fireDocumentEvent('jpush.receiveRegistrationId', event) + } +} JPushPlugin.prototype.receiveMessageInAndroidCallback = function (data) { data = JSON.stringify(data) @@ -289,7 +288,7 @@ JPushPlugin.prototype.reportNotificationOpened = function (msgID) { *在 Portal 上展示给开发者。 */ JPushPlugin.prototype.setStatisticsOpen = function (mode) { - if (device.platform == 'Android') { + if (device.platform === 'Android') { this.callNative('setStatisticsOpen', [mode], null) } } @@ -299,19 +298,19 @@ JPushPlugin.prototype.setStatisticsOpen = function (mode) { * 具体可看:http://docs.jpush.io/client/android_api/#android-60 */ JPushPlugin.prototype.requestPermission = function () { - if (device.platform == 'Android') { + if (device.platform === 'Android') { this.callNative('requestPermission', [], null) } } JPushPlugin.prototype.setSilenceTime = function (startHour, startMinute, endHour, endMinute) { - if (device.platform == 'Android') { + if (device.platform === 'Android') { this.callNative('setSilenceTime', [startHour, startMinute, endHour, endMinute], null) } } JPushPlugin.prototype.setPushTime = function (weekdays, startHour, endHour) { - if (device.platform == 'Android') { + if (device.platform === 'Android') { this.callNative('setPushTime', [weekdays, startHour, endHour], null) } }