Compare commits

..

5 Commits

Author SHA1 Message Date
huangminlinux
07c9b2b945 fix iOS10 remove local notification fail bug 2017-10-20 11:28:51 +08:00
huangminlinux
8811dfc002 update docs 2017-10-19 13:51:19 +08:00
Hevin
0ee5f8b1a0 Update iOS SDK to v3.0.7 2017-10-13 13:10:47 +08:00
Hevin
259ec0a03a Update API doc 2017-10-13 13:09:19 +08:00
Hevin
6283cb26f6 Remove deprecated method
setTagsWithAlias
2017-10-13 10:12:16 +08:00
13 changed files with 583 additions and 585 deletions

View File

@@ -1,7 +1,7 @@
# JPush PhoneGap / Cordova Plugin
[![Build Status](https://travis-ci.org/jpush/jpush-phonegap-plugin.svg?branch=master)](https://travis-ci.org/jpush/jpush-phonegap-plugin)
[![release](https://img.shields.io/badge/release-3.2.7-blue.svg)](https://github.com/jpush/jpush-phonegap-plugin/releases)
[![release](https://img.shields.io/badge/release-3.2.8-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

@@ -9,19 +9,6 @@
- [设置保留最近通知条数](#设置保留最近通知条数)
- [本地通知](#本地通知)
## 注册成功事件
### jpush.receiveRegistrationId
集成了 JPush SDK 的应用程序在第一次成功注册到 JPush 服务器时JPush 服务器会给客户端返回一个唯一的该设备的标识 - RegistrationID。
就会触发这个事件(注意只有第一次会触发该事件,之后如果想要取到 registrationId可以直接调用 *getRegistrationID* 方法)。
#### 代码示例
```js
document.addEventListener('jpush.receiveRegistrationId', function (event) {
console.log(event.registrationId)
}, false)
```
## 获取集成日志(同时适用于 iOS
### API - setDebugMode
@@ -103,7 +90,7 @@ window.JPush.setPushTime(days, startHour, endHour)
#### 参数说明
- days: 数组0 表示星期天1 表示星期一以此类推7天制数组中值的范围为 0 到 6 )。
数组的值为 null, 表示任何时间都可以收到消息和通知,数组的 size 为 0则表示任何时间都收不到消息和通知。
数组的值为 null, 表示任何时间都可以收到消息和通知,数组的 size 为 0则表示任何时间都收不到消息和通知。
- startHour: 整形,允许推送的开始时间 24 小时制startHour 的范围为 0 到 23
- endHour: 整形,允许推送的结束时间 24 小时制endHour 的范围为 0 到 23

View File

@@ -1,5 +1,6 @@
# 通用 API 说明(同时适用于 Android 和 iOS 系统)
- [注册成功事件](#注册成功事件)
- [停止与恢复推送服务](#停止与恢复推送服务)
- [获取 RegistrationID](#获取-registrationid)
- [设置别名与标签](#设置别名与标签)
@@ -8,7 +9,23 @@
- [获取自定义消息推送内容](#获取自定义消息推送内容)
- [判断系统设置中是否允许当前应用推送](#判断系统设置中是否允许当前应用推送)
## 注册成功事件
### jpush.receiveRegistrationId
集成了 JPush SDK 的应用程序在第一次成功注册到 JPush 服务器时JPush 服务器会给客户端返回一个唯一的该设备的标识 - RegistrationID。
就会触发这个事件(注意只有第一次会触发该事件,之后如果想要取到 registrationId可以直接调用 *getRegistrationID* 方法)。
#### 代码示例
```js
document.addEventListener('jpush.receiveRegistrationId', function (event) {
console.log(event.registrationId)
}, false)
```
## 停止与恢复推送服务
### API - init
调用此 API用来开启 JPush SDK 提供的推送服务。
@@ -545,4 +562,4 @@ window.JPush.getUserNotificationSettings(function(result) {
} else if(result > 0) {
// 系统设置中打开了应用推送。
})
```
```

View File

@@ -716,10 +716,6 @@ window.JPush.getUserNotificationSettings(callback)
[iOS 7 以后后台收到远程通知](#后台收到推送)
### jpush.setTagsWithAlias
[设置标签别名回调](#返回值说明)
### jpush.receiveMessage
[获取自定义消息内容](#获取自定义消息内容)

View File

@@ -1,6 +1,6 @@
{
"name": "jpush-phonegap-plugin",
"version": "3.2.7",
"version": "3.2.8",
"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.2.7">
version="3.2.8">
<name>JPush</name>
<description>JPush for cordova plugin</description>
@@ -38,7 +38,7 @@
<source-file src="src/ios/Plugins/AppDelegate+JPush.m" />
<header-file src="src/ios/lib/JPUSHService.h" />
<source-file src="src/ios/lib/jpush-ios-3.0.6.a" framework="true" />
<source-file src="src/ios/lib/jpush-ios-3.0.7.a" framework="true" />
<resource-file src="src/ios/JPushConfig.plist" />
<framework src="CFNetwork.framework" weak="true" />

View File

@@ -527,24 +527,6 @@ public class JPushPlugin extends CordovaPlugin {
eventCallbackMap.put(sequence, callbackContext);
}
void setTagsWithAlias(JSONArray data, CallbackContext callbackContext) {
HashSet<String> tags = new HashSet<String>();
String alias;
try {
alias = data.getString(0);
JSONArray tagsArray = data.getJSONArray(1);
for (int i = 0; i < tagsArray.length(); i++) {
tags.add(tagsArray.getString(i));
}
JPushInterface.setAliasAndTags(mContext,
alias, tags, mTagWithAliasCallback);
callbackContext.success();
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("Error reading tagAlias JSON");
}
}
void getConnectionState(JSONArray data, CallbackContext callback) {
boolean isConnected = JPushInterface.getConnectionState(cordovaActivity.getApplicationContext());
callback.success(String.valueOf(isConnected));
@@ -553,8 +535,7 @@ public class JPushPlugin extends CordovaPlugin {
/**
* 自定义通知行为,声音、震动、呼吸灯等。
*/
void setBasicPushNotificationBuilder(JSONArray data,
CallbackContext callbackContext) {
void setBasicPushNotificationBuilder(JSONArray data, CallbackContext callbackContext) {
BasicPushNotificationBuilder builder = new BasicPushNotificationBuilder(
this.cordova.getActivity());
builder.developerArg0 = "Basic builder 1";

View File

@@ -155,7 +155,12 @@ NSDictionary *_launchOptions;
}
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
[[NSNotificationCenter defaultCenter] postNotificationName:JPushDocumentEvent_ReceiveLocalNotification object:notification.userInfo];
NSDictionary* localNotificationEvent = @{@"content":notification.alertBody,
@"badge": @(notification.applicationIconBadgeNumber),
@"extras":notification.userInfo,
};
[[NSNotificationCenter defaultCenter] postNotificationName:JPushDocumentEvent_ReceiveLocalNotification object:localNotificationEvent];
}
- (void)applicationWillEnterForeground:(UIApplication *)application {

View File

@@ -17,8 +17,6 @@
//以下为js中可调用接口
//设置标签、别名
-(void)setTagsWithAlias:(CDVInvokedUrlCommand*)command;
-(void)setTags:(CDVInvokedUrlCommand*)command;
-(void)addTags:(CDVInvokedUrlCommand*)command;
-(void)deleteTags:(CDVInvokedUrlCommand*)command;
@@ -76,7 +74,6 @@
/*
* 以下为js中可监听到的事件
* jpush.openNotification 点击推送消息启动或唤醒app
* jpush.setTagsWithAlias 设置标签、别名完成
* jpush.receiveMessage 收到自定义消息
* jpush.receiveNotification 前台收到推送
* jpush.backgroundNotification 后台收到推送

File diff suppressed because it is too large Load Diff

View File

@@ -9,7 +9,7 @@
* Copyright (c) 2011 ~ 2017 Shenzhen HXHG. All rights reserved.
*/
#define JPUSH_VERSION_NUMBER 3.0.6
#define JPUSH_VERSION_NUMBER 3.0.7
#import <Foundation/Foundation.h>

View File

@@ -70,20 +70,6 @@ JPushPlugin.prototype.clearLocalNotifications = function () {
}
}
JPushPlugin.prototype.setTagsWithAlias = function (tags, alias, successCallback, errorCallback) {
if (tags == null) {
this.setAlias(alias)
return
}
if (alias == null) {
this.setTags(tags)
return
}
var arrayTagWithAlias = [tags]
arrayTagWithAlias.unshift(alias)
this.callNative('setTagsWithAlias', arrayTagWithAlias, successCallback, errorCallback)
}
/**
* 设置标签。
* 注意:该接口是覆盖逻辑,而不是增量逻辑。即新的调用会覆盖之前的设置。