Merge branch 'dev'

This commit is contained in:
hevin 2017-05-24 14:46:02 +08:00
commit 3c88e87b17
4 changed files with 37 additions and 34 deletions

View File

@ -2,7 +2,7 @@
[![Build Status](https://travis-ci.org/jpush/jpush-phonegap-plugin.svg?branch=master)](https://travis-ci.org/jpush/jpush-phonegap-plugin)
[![QQ Group](https://img.shields.io/badge/QQ%20Group-413602425-red.svg)]()
[![release](https://img.shields.io/badge/release-3.1.6-blue.svg)](https://github.com/jpush/jpush-phonegap-plugin/releases)
[![release](https://img.shields.io/badge/release-3.1.7-blue.svg)](https://github.com/jpush/jpush-phonegap-plugin/releases)
[![platforms](https://img.shields.io/badge/platforms-iOS%7CAndroid-lightgrey.svg)](https://github.com/jpush/jpush-phonegap-plugin)
[![weibo](https://img.shields.io/badge/weibo-JPush-blue.svg)](http://weibo.com/jpush?refer_flag=1001030101_&is_all=1)

View File

@ -1,6 +1,6 @@
{
"name": "jpush-phonegap-plugin",
"version": "3.1.6",
"version": "3.1.7",
"description": "JPush for cordova plugin",
"cordova": {
"id": "jpush-phonegap-plugin",

View File

@ -2,7 +2,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="jpush-phonegap-plugin"
version="3.1.6">
version="3.1.7">
<name>JPush</name>
<description>JPush for cordova plugin</description>
@ -62,7 +62,7 @@
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="JPushPlugin">
<param name="android-package" value="cn.jpush.phonegap.JPushPlugin" />
<param name="android-package" value="cn.jiguang.cordova.push.JPushPlugin" />
</feature>
</config-file>
@ -188,14 +188,18 @@
<source-file src="src/android/libs/jpush-android_v3.0.6.jar" target-dir="libs" />
<source-file src="src/android/MyReceiver.java" target-dir="src/cn/jpush/phonegap" />
<source-file src="src/android/JPushPlugin.java" target-dir="src/cn/jpush/phonegap" />
<source-file src="src/android/MyReceiver.java" target-dir="src/cn/jiguang/cordova/push" />
<source-file src="src/android/JPushPlugin.java" target-dir="src/cn/jiguang/cordova/push" />
<source-file src="src/android/res/drawable-hdpi/jpush_richpush_btn_selector.xml" target-dir="res/drawable" />
<source-file src="src/android/res/drawable-hdpi/jpush_richpush_progressbar.xml" target-dir="res/drawable" />
<source-file src="src/android/res/drawable-hdpi/jpush_richpush_btn_selector.xml"
target-dir="res/drawable" />
<source-file src="src/android/res/drawable-hdpi/jpush_richpush_progressbar.xml"
target-dir="res/drawable" />
<source-file src="src/android/res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png" target-dir="res/drawable-hdpi" />
<source-file src="src/android/res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png" target-dir="res/drawable-hdpi" />
<source-file src="src/android/res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png"
target-dir="res/drawable-hdpi" />
<source-file src="src/android/res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png"
target-dir="res/drawable-hdpi" />
<source-file src="src/android/res/layout/jpush_popwin_layout.xml" target-dir="res/layout" />
<source-file src="src/android/res/layout/jpush_webview_layout.xml" target-dir="res/layout" />

View File

@ -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)
}
}