Skip to content

Commit 1897811

Browse files
committed
Merge pull request #59 from jpush/dev
merge from dev
2 parents 969067d + 6b1d89e commit 1897811

File tree

5 files changed

+23
-46
lines changed

5 files changed

+23
-46
lines changed

src/main/java/cn/jpush/api/JPushClient.java

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -593,10 +593,7 @@ public PushResult sendIosNotificationWithRegistrationID(JsonObject alert, SMS sm
593593

594594

595595
// ---------------------- shortcuts - message
596-
597-
/**
598-
* Shortcut
599-
*/
596+
600597
public PushResult sendMessageAll(String msgContent) throws APIConnectionException, APIRequestException {
601598
PushPayload payload = PushPayload.messageAll(msgContent);
602599
return _pushClient.sendPush(payload);
@@ -616,10 +613,7 @@ public PushResult sendMessageAll(String msgContent, SMS sms) throws APIConnectio
616613
PushPayload payload = PushPayload.messageAll(msgContent, sms);
617614
return _pushClient.sendPush(payload);
618615
}
619-
620-
/**
621-
* Shortcut
622-
*/
616+
623617
public PushResult sendAndroidMessageWithAlias(String title, String msgContent, String... alias)
624618
throws APIConnectionException, APIRequestException {
625619
PushPayload payload = PushPayload.newBuilder()
@@ -658,10 +652,7 @@ public PushResult sendAndroidMessageWithAlias(String title, String msgContent, S
658652
.build();
659653
return _pushClient.sendPush(payload);
660654
}
661-
662-
/**
663-
* Shortcut
664-
*/
655+
665656
public PushResult sendAndroidMessageWithRegistrationID(String title, String msgContent, String... registrationID)
666657
throws APIConnectionException, APIRequestException {
667658
PushPayload payload = PushPayload.newBuilder()
@@ -700,10 +691,7 @@ public PushResult sendAndroidMessageWithRegistrationID(String title, String msgC
700691
.build();
701692
return _pushClient.sendPush(payload);
702693
}
703-
704-
/**
705-
* Shortcut
706-
*/
694+
707695
public PushResult sendIosMessageWithAlias(String title, String msgContent, String... alias)
708696
throws APIConnectionException, APIRequestException {
709697
PushPayload payload = PushPayload.newBuilder()
@@ -742,7 +730,7 @@ public PushResult sendIosMessageWithAlias(String title, String msgContent, SMS s
742730
.build();
743731
return _pushClient.sendPush(payload);
744732
}
745-
733+
746734
public PushResult sendIosMessageWithRegistrationID(String title, String msgContent, String... registrationID)
747735
throws APIConnectionException, APIRequestException {
748736
PushPayload payload = PushPayload.newBuilder()
@@ -782,9 +770,6 @@ public PushResult sendIosMessageWithRegistrationID(String title, String msgConte
782770
return _pushClient.sendPush(payload);
783771
}
784772

785-
/**
786-
* Shortcut
787-
*/
788773
public PushResult sendMessageWithRegistrationID(String title, String msgContent, String... registrationID)
789774
throws APIConnectionException, APIRequestException {
790775
PushPayload payload = PushPayload.newBuilder()

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,19 @@ private PushPayload(Platform platform, Audience audience,
5151
this.options = options;
5252
this.sms = sms;
5353
}
54-
54+
5555
/**
5656
* The entrance for building a PushPayload object.
57+
* @return PushPayload builder
5758
*/
5859
public static Builder newBuilder() {
5960
return new Builder();
6061
}
6162

6263
/**
6364
* The shortcut of building a simple alert notification object to all platforms and all audiences
65+
* @param alert The alert message.
66+
* @return PushPayload
6467
*/
6568
public static PushPayload alertAll(String alert) {
6669
return new Builder()
@@ -80,6 +83,8 @@ public static PushPayload alertAll(String alert, SMS sms) {
8083

8184
/**
8285
* The shortcut of building a simple message object to all platforms and all audiences
86+
* @param msgContent The message content.
87+
* @return PushPayload
8388
*/
8489
public static PushPayload messageAll(String msgContent) {
8590
return new Builder()

src/main/java/cn/jpush/api/push/model/SMS.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static Builder newBuilder() {
2727
*
2828
* @param content The SMS content.
2929
* @param delayTime The seconds you want to delay, should be greater than or equal to 0.
30-
* @return
30+
* @return SMS payload.
3131
*/
3232
public static SMS content(String content, int delayTime) {
3333
return new Builder()

src/main/java/cn/jpush/api/push/model/notification/IosNotification.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,20 @@
1111
* APNs 通知类
1212
* <p>
1313
* 支持 APNs 默认的几个参数:
14+
* <ul>
1415
* <li>alert: 继承自父类 PlatformNotification 的 alert 属性;本类设置则覆盖。</li>
1516
* <li>badge: 支持 setBadge(int) 方法来设置;支持 incrBadge(int) 方法来增加。</li>
1617
* <li>sound: 支持 setSound(string) 方法来设置声音文件。</li>
1718
* <li>content-available: 用来支持后台推送。如果该值赋值为 1,表示开启后台推送。</li>
1819
* <li>extras: JSON object. 支持更多的自定义字段信息。</li>
20+
* </ul>
1921
* </p>
2022
* <p>
2123
* 需要特别留意的是,JPush SDK 会对以下几个值有特别的默认设置考虑:
24+
* <ul>
2225
* <li>badge: 默认为 "+1"。如果需要取消 badge 值,需要显式地调用 disableBadge().</li>
2326
* <li>sound: 默认为 "",即默认的声音提示。如果需要取消 sound 值,即不要声音,需要显式地调用 disableSound(). </li>
27+
* </ul>
2428
* </p>
2529
*/
2630
public class IosNotification extends PlatformNotification {
@@ -152,6 +156,7 @@ public Builder setBadge(int badge) {
152156

153157
/**
154158
* equals to: +1
159+
* @return IosNotification builder
155160
*/
156161
public Builder autoBadge() {
157162
return incrBadge(1);

src/main/java/cn/jpush/api/push/model/notification/Notification.java

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ public static Builder newBuilder() {
3333
public static Notification alert(Object alert) {
3434
return newBuilder().setAlert(alert).build();
3535
}
36-
37-
/**
38-
* shortcut
39-
*/
36+
4037
public static Notification android(String alert, String title, Map<String, String> extras) {
4138
return newBuilder()
4239
.addPlatformNotification(AndroidNotification.newBuilder()
@@ -46,10 +43,7 @@ public static Notification android(String alert, String title, Map<String, Strin
4643
.build())
4744
.build();
4845
}
49-
50-
/**
51-
* shortcut
52-
*/
46+
5347
public static Notification ios(Object alert, Map<String, String> extras) {
5448
return newBuilder()
5549
.addPlatformNotification(IosNotification.newBuilder()
@@ -58,10 +52,7 @@ public static Notification ios(Object alert, Map<String, String> extras) {
5852
.build())
5953
.build();
6054
}
61-
62-
/**
63-
* shortcut
64-
*/
55+
6556
public static Notification ios_auto_badge() {
6657
return newBuilder()
6758
.addPlatformNotification(IosNotification.newBuilder()
@@ -70,10 +61,7 @@ public static Notification ios_auto_badge() {
7061
.build())
7162
.build();
7263
}
73-
74-
/**
75-
* shortcut
76-
*/
64+
7765
public static Notification ios_set_badge(int badge) {
7866
return newBuilder()
7967
.addPlatformNotification(IosNotification.newBuilder()
@@ -82,10 +70,7 @@ public static Notification ios_set_badge(int badge) {
8270
.build())
8371
.build();
8472
}
85-
86-
/**
87-
* shortcut
88-
*/
73+
8974
public static Notification ios_incr_badge(int badge) {
9075
return newBuilder()
9176
.addPlatformNotification(IosNotification.newBuilder()
@@ -94,10 +79,7 @@ public static Notification ios_incr_badge(int badge) {
9479
.build())
9580
.build();
9681
}
97-
98-
/**
99-
* shortcut
100-
*/
82+
10183
public static Notification winphone(String alert, Map<String, String> extras) {
10284
return newBuilder()
10385
.addPlatformNotification(WinphoneNotification.newBuilder()

0 commit comments

Comments
 (0)