Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Release Notes

## 1.0.0.15

### update

* 支持本地消息分类
* 最稳定域名检测开关支持通过启动项配置
* 设置非个推域名时强制关闭稳定域名检测

## 1.0.0.14

### update
Expand Down Expand Up @@ -49,35 +57,49 @@
* 完善参数和注释

## 1.0.0.7

### Fix

* 修复超时重试http连接未释放问题

### update

* 移除guava依赖
* 支持设置获取连接池中http连接超时时间

## 1.0.0.6

### Fix

修复并发请求消息体异常问题

## 1.0.0.5

### Fix

修复长连接单位错误问题 由分钟改为秒

## 1.0.0.4

### Features

支持设置长连接有效期

## 1.0.0.3

### Features

1. ios支持自定义参数

### Fix

1. 修复jdk11 json反序列化报错问题: ParameterizedTypeImpl 类找不到
2. 修复jdk1.6 https证书错误问题
3. 服务端返回500支持重试
4. 修复首次鉴权失败后空指针异常

## 1.0.0.2

### Features

1. 支持设置httpclient最大连接数,解决并发大时获取连接慢问题
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<dependency>
<groupId>com.getui.push</groupId>
<artifactId>restful-sdk</artifactId>
<version>1.0.0.14</version>
<version>1.0.0.15</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.getui.push</groupId>
<artifactId>restful-sdk</artifactId>
<packaging>jar</packaging>
<version>1.0.0.14</version>
<version>1.0.0.15</version>
<url>https://github.com/GetuiLaboratory/getui-pushapi-java-client-v2</url>
<name>Getui Push API Java Client</name>
<description>Getui's officially supported Java client library for accessing Getui APIs.</description>
Expand Down
48 changes: 44 additions & 4 deletions src/main/java/com/getui/push/v2/sdk/GtApiConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
import com.getui.push.v2.sdk.common.Assert;
import org.apache.http.client.config.RequestConfig;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

/**
* 应用相关配置信息
* create by getui on 2020/6/4
Expand Down Expand Up @@ -32,7 +36,19 @@ public class GtApiConfiguration {
/**
* 是否开启最稳定域名检测,默认开启
*/
private boolean openAnalyseStableDomainSwitch = true;
public final static String ANALYSE_STABLE_DOMAIN_SWITCH_KEY = "gt.analyse.stable.domain.switch";

/**
* 个推顶级域名列表,英文逗号分割
*/
public final static String GT_TOP_LEVEL_DOMAIN_LIST_KEY = "gt.top.level.domain.list";

/**
* 个推顶级域名列表的默认值
*/
private final static String DEFAULT_GT_TOP_LEVEL_DOMAIN_LIST = "getui.com,getui.cn";

private Set<String> gtTopLevelDomainList;

/**
* 检测最稳定域名时间间隔,默认2分钟检测一次
Expand All @@ -41,7 +57,7 @@ public class GtApiConfiguration {

/**
* 如果遇到域名请求地址不断变化或需要排查网络耗时等问题,可以开启此接口(方法)功能后,联系个推技术支持
* 健康度检查动态开关,true表示开启,否则关闭,不设置则取 {@link #openAnalyseStableDomainSwitch}
* 健康度检查动态开关,true表示开启,否则关闭,不设置则取 {@link #ANALYSE_STABLE_DOMAIN_SWITCH_KEY}
*/
public final static String CHECK_HEALTH_DATA_SWITCH_KEY = "gt_healthy_switch";
/**
Expand Down Expand Up @@ -136,12 +152,36 @@ public String getDomain() {
return domain;
}

private boolean notGtDomain() {
for (String gtDomain : getGtTopLevelDomainList()) {
if (domain.contains(gtDomain)) {
return false;
}
}
return true;
}


public Set<String> getGtTopLevelDomainList() {
if (gtTopLevelDomainList == null) {
gtTopLevelDomainList = new HashSet<String>(Arrays.asList(System.getProperty(GT_TOP_LEVEL_DOMAIN_LIST_KEY, DEFAULT_GT_TOP_LEVEL_DOMAIN_LIST).split(",")));
}
return gtTopLevelDomainList;
}

public void setGtTopLevelDomainList(String list) {
System.setProperty(GT_TOP_LEVEL_DOMAIN_LIST_KEY, list);
}

public boolean isOpenAnalyseStableDomainSwitch() {
return openAnalyseStableDomainSwitch;
if (notGtDomain()) {
return false;
}
return Boolean.parseBoolean(System.getProperty(ANALYSE_STABLE_DOMAIN_SWITCH_KEY, "true"));
}

public void setOpenAnalyseStableDomainSwitch(boolean openAnalyseStableDomainSwitch) {
this.openAnalyseStableDomainSwitch = openAnalyseStableDomainSwitch;
System.setProperty(ANALYSE_STABLE_DOMAIN_SWITCH_KEY, String.valueOf(openAnalyseStableDomainSwitch));
}

public long getAnalyseStableDomainInterval() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/getui/push/v2/sdk/core/Configs.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public interface Configs {

String HEADER_DOMAIN_HASH_KEY = "domainHash";
String HEADER_OPEN_STABLE_DOMAIN = "openStableDomain";
String SDK_VERSION = "1.0.0.14";
String SDK_VERSION = "1.0.0.15";
/**
* 预置域名列表
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ public class GTNotification {
@SerializedName("redisplay_duration")
private Integer redisplayDuration;

/**
* 消息分类
*/
private String category;

public String getTitle() {
return title;
}
Expand Down Expand Up @@ -251,6 +256,14 @@ public void setRedisplayDuration(Integer redisplayDuration) {
this.redisplayDuration = redisplayDuration;
}

public String getCategory() {
return category;
}

public void setCategory(String category) {
this.category = category;
}

@Override
public String toString() {
return "GTNotification{" +
Expand All @@ -273,6 +286,7 @@ public String toString() {
", threadId='" + threadId + '\'' +
", redisplayFreq=" + redisplayFreq +
", redisplayDuration=" + redisplayDuration +
", category='" + category + '\'' +
'}';
}
}