1717 * <li>badge: 支持 setBadge(int) 方法来设置;支持 incrBadge(int) 方法来增加。</li>
1818 * <li>sound: 支持 setSound(string) 方法来设置声音文件。或者 setSound(JSON object) 对应官方payload结构 </li>
1919 * <li>content-available: 用来支持后台推送。如果该值赋值为 1,表示开启后台推送。</li>
20+ * <li>mutable-content: 通知扩展</li>
21+ * <li>category: IOS 8 才支持。设置 APNs payload 中的 "category" 字段值</li>
22+ * <li>mutable-content: 通知扩展</li>
2023 * <li>extras: JSON object. 支持更多的自定义字段信息。</li>
2124 * </ul>
2225 * <br>
@@ -37,6 +40,7 @@ public class IosNotification extends PlatformNotification {
3740 private static final String CONTENT_AVAILABLE = "content-available" ;
3841 private static final String MUTABLE_CONTENT = "mutable-content" ;
3942 private static final String CATEGORY = "category" ;
43+ private static final String THREAD_ID = "thread-id" ;
4044
4145 private static final String ALERT_VALID_BADGE = "Badge number should be 0~99999, "
4246 + "and can be prefixed with + to add, - to minus" ;
@@ -49,11 +53,12 @@ public class IosNotification extends PlatformNotification {
4953 private final boolean contentAvailable ;
5054 private final String category ;
5155 private final boolean mutableContent ;
56+ private final String threadId ;
5257
5358
5459 private IosNotification (Object alert , Object sound , String badge ,
5560 boolean contentAvailable , boolean soundDisabled , boolean badgeDisabled ,
56- String category , boolean mutableContent ,
61+ String category , boolean mutableContent ,String threadId ,
5762 Map <String , String > extras ,
5863 Map <String , Number > numberExtras ,
5964 Map <String , Boolean > booleanExtras ,
@@ -67,6 +72,7 @@ private IosNotification(Object alert, Object sound, String badge,
6772 this .badgeDisabled = badgeDisabled ;
6873 this .category = category ;
6974 this .mutableContent = mutableContent ;
75+ this .threadId = threadId ;
7076 }
7177
7278 public static Builder newBuilder () {
@@ -115,6 +121,9 @@ public JsonElement toJSON() {
115121 if (mutableContent ) {
116122 json .add (MUTABLE_CONTENT , new JsonPrimitive (true ));
117123 }
124+ if (null != threadId ) {
125+ json .add (THREAD_ID , new JsonPrimitive (threadId ));
126+ }
118127
119128 return json ;
120129 }
@@ -128,6 +137,7 @@ public static class Builder extends PlatformNotification.Builder<IosNotification
128137 private boolean badgeDisabled = false ;
129138 private String category ;
130139 private boolean mutableContent ;
140+ private String threadId ;
131141
132142 protected Builder getThis () {
133143 return this ;
@@ -202,11 +212,16 @@ public Builder setMutableContent(boolean mutableContent) {
202212 this .mutableContent = mutableContent ;
203213 return this ;
204214 }
215+
216+ public Builder setThreadId (String threadId ) {
217+ this .threadId = threadId ;
218+ return this ;
219+ }
205220
206221
207222 public IosNotification build () {
208223 return new IosNotification (alert , sound , badge , contentAvailable ,
209- soundDisabled , badgeDisabled , category , mutableContent ,
224+ soundDisabled , badgeDisabled , category , mutableContent , threadId ,
210225 extrasBuilder , numberExtrasBuilder , booleanExtrasBuilder , jsonExtrasBuilder );
211226 }
212227 }
0 commit comments