17
17
* <li>badge: 支持 setBadge(int) 方法来设置;支持 incrBadge(int) 方法来增加。</li>
18
18
* <li>sound: 支持 setSound(string) 方法来设置声音文件。或者 setSound(JSON object) 对应官方payload结构 </li>
19
19
* <li>content-available: 用来支持后台推送。如果该值赋值为 1,表示开启后台推送。</li>
20
+ * <li>mutable-content: 通知扩展</li>
21
+ * <li>category: IOS 8 才支持。设置 APNs payload 中的 "category" 字段值</li>
22
+ * <li>mutable-content: 通知扩展</li>
20
23
* <li>extras: JSON object. 支持更多的自定义字段信息。</li>
21
24
* </ul>
22
25
* <br>
@@ -37,6 +40,7 @@ public class IosNotification extends PlatformNotification {
37
40
private static final String CONTENT_AVAILABLE = "content-available" ;
38
41
private static final String MUTABLE_CONTENT = "mutable-content" ;
39
42
private static final String CATEGORY = "category" ;
43
+ private static final String THREAD_ID = "thread-id" ;
40
44
41
45
private static final String ALERT_VALID_BADGE = "Badge number should be 0~99999, "
42
46
+ "and can be prefixed with + to add, - to minus" ;
@@ -49,11 +53,12 @@ public class IosNotification extends PlatformNotification {
49
53
private final boolean contentAvailable ;
50
54
private final String category ;
51
55
private final boolean mutableContent ;
56
+ private final String threadId ;
52
57
53
58
54
59
private IosNotification (Object alert , Object sound , String badge ,
55
60
boolean contentAvailable , boolean soundDisabled , boolean badgeDisabled ,
56
- String category , boolean mutableContent ,
61
+ String category , boolean mutableContent ,String threadId ,
57
62
Map <String , String > extras ,
58
63
Map <String , Number > numberExtras ,
59
64
Map <String , Boolean > booleanExtras ,
@@ -67,6 +72,7 @@ private IosNotification(Object alert, Object sound, String badge,
67
72
this .badgeDisabled = badgeDisabled ;
68
73
this .category = category ;
69
74
this .mutableContent = mutableContent ;
75
+ this .threadId = threadId ;
70
76
}
71
77
72
78
public static Builder newBuilder () {
@@ -115,6 +121,9 @@ public JsonElement toJSON() {
115
121
if (mutableContent ) {
116
122
json .add (MUTABLE_CONTENT , new JsonPrimitive (true ));
117
123
}
124
+ if (null != threadId ) {
125
+ json .add (THREAD_ID , new JsonPrimitive (threadId ));
126
+ }
118
127
119
128
return json ;
120
129
}
@@ -128,6 +137,7 @@ public static class Builder extends PlatformNotification.Builder<IosNotification
128
137
private boolean badgeDisabled = false ;
129
138
private String category ;
130
139
private boolean mutableContent ;
140
+ private String threadId ;
131
141
132
142
protected Builder getThis () {
133
143
return this ;
@@ -202,11 +212,16 @@ public Builder setMutableContent(boolean mutableContent) {
202
212
this .mutableContent = mutableContent ;
203
213
return this ;
204
214
}
215
+
216
+ public Builder setThreadId (String threadId ) {
217
+ this .threadId = threadId ;
218
+ return this ;
219
+ }
205
220
206
221
207
222
public IosNotification build () {
208
223
return new IosNotification (alert , sound , badge , contentAvailable ,
209
- soundDisabled , badgeDisabled , category , mutableContent ,
224
+ soundDisabled , badgeDisabled , category , mutableContent , threadId ,
210
225
extrasBuilder , numberExtrasBuilder , booleanExtrasBuilder , jsonExtrasBuilder );
211
226
}
212
227
}
0 commit comments