Skip to content

Commit efdff53

Browse files
authored
Merge pull request #41 from ZJUCJH/main
[feature] 1.支持本地消息分类;2.最稳定域名检测开关支持通过启动项配置;3.设置非个推域名时强制关闭稳定域名检测
2 parents 5f7581b + 6a61693 commit efdff53

File tree

6 files changed

+83
-7
lines changed

6 files changed

+83
-7
lines changed

CHANGES.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Release Notes
22

3+
## 1.0.0.15
4+
5+
### update
6+
7+
* 支持本地消息分类
8+
* 最稳定域名检测开关支持通过启动项配置
9+
* 设置非个推域名时强制关闭稳定域名检测
10+
311
## 1.0.0.14
412

513
### update
@@ -49,35 +57,49 @@
4957
* 完善参数和注释
5058

5159
## 1.0.0.7
60+
5261
### Fix
62+
5363
* 修复超时重试http连接未释放问题
5464

5565
### update
66+
5667
* 移除guava依赖
5768
* 支持设置获取连接池中http连接超时时间
5869

5970
## 1.0.0.6
71+
6072
### Fix
73+
6174
修复并发请求消息体异常问题
6275

6376
## 1.0.0.5
77+
6478
### Fix
79+
6580
修复长连接单位错误问题 由分钟改为秒
6681

6782
## 1.0.0.4
83+
6884
### Features
85+
6986
支持设置长连接有效期
7087

7188
## 1.0.0.3
89+
7290
### Features
91+
7392
1. ios支持自定义参数
7493

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

81101
## 1.0.0.2
102+
82103
### Features
104+
83105
1. 支持设置httpclient最大连接数,解决并发大时获取连接慢问题

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<dependency>
2323
<groupId>com.getui.push</groupId>
2424
<artifactId>restful-sdk</artifactId>
25-
<version>1.0.0.14</version>
25+
<version>1.0.0.15</version>
2626
</dependency>
2727
```
2828

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<groupId>com.getui.push</groupId>
88
<artifactId>restful-sdk</artifactId>
99
<packaging>jar</packaging>
10-
<version>1.0.0.14</version>
10+
<version>1.0.0.15</version>
1111
<url>https://github.com/GetuiLaboratory/getui-pushapi-java-client-v2</url>
1212
<name>Getui Push API Java Client</name>
1313
<description>Getui's officially supported Java client library for accessing Getui APIs.</description>

src/main/java/com/getui/push/v2/sdk/GtApiConfiguration.java

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
import com.getui.push.v2.sdk.common.Assert;
44
import org.apache.http.client.config.RequestConfig;
55

6+
import java.util.Arrays;
7+
import java.util.HashSet;
8+
import java.util.Set;
9+
610
/**
711
* 应用相关配置信息
812
* create by getui on 2020/6/4
@@ -32,7 +36,19 @@ public class GtApiConfiguration {
3236
/**
3337
* 是否开启最稳定域名检测,默认开启
3438
*/
35-
private boolean openAnalyseStableDomainSwitch = true;
39+
public final static String ANALYSE_STABLE_DOMAIN_SWITCH_KEY = "gt.analyse.stable.domain.switch";
40+
41+
/**
42+
* 个推顶级域名列表,英文逗号分割
43+
*/
44+
public final static String GT_TOP_LEVEL_DOMAIN_LIST_KEY = "gt.top.level.domain.list";
45+
46+
/**
47+
* 个推顶级域名列表的默认值
48+
*/
49+
private final static String DEFAULT_GT_TOP_LEVEL_DOMAIN_LIST = "getui.com,getui.cn";
50+
51+
private Set<String> gtTopLevelDomainList;
3652

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

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

155+
private boolean notGtDomain() {
156+
for (String gtDomain : getGtTopLevelDomainList()) {
157+
if (domain.contains(gtDomain)) {
158+
return false;
159+
}
160+
}
161+
return true;
162+
}
163+
164+
165+
public Set<String> getGtTopLevelDomainList() {
166+
if (gtTopLevelDomainList == null) {
167+
gtTopLevelDomainList = new HashSet<String>(Arrays.asList(System.getProperty(GT_TOP_LEVEL_DOMAIN_LIST_KEY, DEFAULT_GT_TOP_LEVEL_DOMAIN_LIST).split(",")));
168+
}
169+
return gtTopLevelDomainList;
170+
}
171+
172+
public void setGtTopLevelDomainList(String list) {
173+
System.setProperty(GT_TOP_LEVEL_DOMAIN_LIST_KEY, list);
174+
}
175+
139176
public boolean isOpenAnalyseStableDomainSwitch() {
140-
return openAnalyseStableDomainSwitch;
177+
if (notGtDomain()) {
178+
return false;
179+
}
180+
return Boolean.parseBoolean(System.getProperty(ANALYSE_STABLE_DOMAIN_SWITCH_KEY, "true"));
141181
}
142182

143183
public void setOpenAnalyseStableDomainSwitch(boolean openAnalyseStableDomainSwitch) {
144-
this.openAnalyseStableDomainSwitch = openAnalyseStableDomainSwitch;
184+
System.setProperty(ANALYSE_STABLE_DOMAIN_SWITCH_KEY, String.valueOf(openAnalyseStableDomainSwitch));
145185
}
146186

147187
public long getAnalyseStableDomainInterval() {

src/main/java/com/getui/push/v2/sdk/core/Configs.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public interface Configs {
1313

1414
String HEADER_DOMAIN_HASH_KEY = "domainHash";
1515
String HEADER_OPEN_STABLE_DOMAIN = "openStableDomain";
16-
String SDK_VERSION = "1.0.0.14";
16+
String SDK_VERSION = "1.0.0.15";
1717
/**
1818
* 预置域名列表
1919
*/

src/main/java/com/getui/push/v2/sdk/dto/req/message/android/GTNotification.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ public class GTNotification {
9999
@SerializedName("redisplay_duration")
100100
private Integer redisplayDuration;
101101

102+
/**
103+
* 消息分类
104+
*/
105+
private String category;
106+
102107
public String getTitle() {
103108
return title;
104109
}
@@ -251,6 +256,14 @@ public void setRedisplayDuration(Integer redisplayDuration) {
251256
this.redisplayDuration = redisplayDuration;
252257
}
253258

259+
public String getCategory() {
260+
return category;
261+
}
262+
263+
public void setCategory(String category) {
264+
this.category = category;
265+
}
266+
254267
@Override
255268
public String toString() {
256269
return "GTNotification{" +
@@ -273,6 +286,7 @@ public String toString() {
273286
", threadId='" + threadId + '\'' +
274287
", redisplayFreq=" + redisplayFreq +
275288
", redisplayDuration=" + redisplayDuration +
289+
", category='" + category + '\'' +
276290
'}';
277291
}
278292
}

0 commit comments

Comments
 (0)