Skip to content

Commit c6f980e

Browse files
author
Javen
committed
Refine comments;
maven repo now have 3.0.1 ready
1 parent a3c86be commit c6f980e

File tree

4 files changed

+28
-9
lines changed

4 files changed

+28
-9
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313

1414
## 安装
1515

16-
### maven 方式(3.0.0 版本 maven 库里还没有,请直接用 jar 的方式)
16+
### maven 方式
1717
将下边的依赖条件放到你项目的 maven pom.xml 文件里。
1818

1919
```
2020
<dependency>
2121
<groupId>cn.jpush.api</groupId>
2222
<artifactId>jpush-client</artifactId>
23-
<version>2.3.1</version>
23+
<version>3.0.1</version>
2424
</dependency>
2525
```
2626
### jar 包方式
@@ -209,5 +209,3 @@ if (receivedsResult.isResultOK()) {
209209
}
210210
}
211211
```
212-
213-

src/cn/jpush/api/JPushClient.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ public JPushClient(String masterSecret, String appKey) {
2525
}
2626

2727
/**
28-
* Create a JPush Client with overall settings.
28+
* Create a JPush Client with global settings.
29+
*
30+
* If you want different settings from default globally, this constructor is what you needed.
2931
*
3032
* @param masterSecret API access secret of the appKey.
3133
* @param appKey The KEY of one application on JPush.
32-
* @param apnsProduction Overall APNs environment setting. It will override PushPayload Optional.
33-
* @param timeToLive Overall time_to_live setting. It will override PushPayload Optional.
34+
* @param apnsProduction Global APNs environment setting. It will override PushPayload Options.
35+
* @param timeToLive Global time_to_live setting. It will override PushPayload Options.
3436
*/
3537
public JPushClient(String masterSecret, String appKey, boolean apnsProduction, long timeToLive) {
3638
_pushClient = new PushClient(masterSecret, appKey, apnsProduction, timeToLive);

src/cn/jpush/api/push/PushClient.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ public class PushClient {
4040
private final String _authCode;
4141
private String _baseUrl;
4242

43+
/**
44+
* Create a Push Client.
45+
*
46+
* @param masterSecret API access secret of the appKey.
47+
* @param appKey The KEY of one application on JPush.
48+
*/
4349
public PushClient(String masterSecret, String appKey) {
4450
this._masterSecret = masterSecret;
4551
this._appKey = appKey;
@@ -49,6 +55,16 @@ public PushClient(String masterSecret, String appKey) {
4955
ServiceHelper.checkBasic(appKey, masterSecret);
5056
}
5157

58+
/**
59+
* Create a Push Client with global settings.
60+
*
61+
* If you want different settings from default globally, this constructor is what you needed.
62+
*
63+
* @param masterSecret API access secret of the appKey.
64+
* @param appKey The KEY of one application on JPush.
65+
* @param apnsProduction Global APNs environment setting. It will override PushPayload Options.
66+
* @param timeToLive Global time_to_live setting. It will override PushPayload Options.
67+
*/
5268
public PushClient(String masterSecret, String appKey, boolean apnsProduction, long timeToLive) {
5369
this(masterSecret, appKey);
5470
this._apnsProduction = apnsProduction;

src/cn/jpush/api/push/model/PushPayload.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
import com.google.gson.JsonObject;
1010

1111
/**
12-
* The object you should to build for sending a push.
12+
* The object you should build for sending a push.
1313
*
1414
* Basically start with newBuilder() method to build a PushPayload object.
15+
*
1516
* alertAll() is a shortcut for quickly build payload of alert to all platform and all audience;
1617
* mesageAll() is a shortcut for quickly build payload of message to all platform and all audience.
1718
*
@@ -154,8 +155,10 @@ public Builder setOptions(Options options) {
154155
}
155156

156157
public PushPayload build() {
157-
Preconditions.checkArgument(! (null == audience || null == platform), "Audience/Platform should be set.");
158+
Preconditions.checkArgument(! (null == audience || null == platform), "audience and platform both should be set.");
158159
Preconditions.checkArgument(! (null == notification && null == message), "notification or message should be set at least one.");
160+
161+
// if options is not set, a sendno will be generated for tracing easily
159162
if (null == options) {
160163
options = Options.sendno();
161164
}

0 commit comments

Comments
 (0)