@@ -12,19 +12,23 @@ public class Options implements PushModel {
1212 private static final String OVERRIDE_MSG_ID = "override_msg_id" ;
1313 private static final String TIME_TO_LIVE = "time_to_live" ;
1414 private static final String APNS_PRODUCTION = "apns_production" ;
15+ private static final String BIG_PUSH_DURATION = "big_push_duration" ;
1516
1617 private static final long NONE_TIME_TO_LIVE = -1 ;
1718
1819 private final int sendno ;
1920 private final long overrideMsgId ;
2021 private long timeToLive ;
2122 private boolean apnsProduction ;
23+ private int bigPushDuration ; // minutes
2224
23- private Options (int sendno , long overrideMsgId , long timeToLive , boolean apnsProduction ) {
25+ private Options (int sendno , long overrideMsgId , long timeToLive , boolean apnsProduction ,
26+ int bigPushDuration ) {
2427 this .sendno = sendno ;
2528 this .overrideMsgId = overrideMsgId ;
2629 this .timeToLive = timeToLive ;
2730 this .apnsProduction = apnsProduction ;
31+ this .bigPushDuration = bigPushDuration ;
2832 }
2933
3034 public static Builder newBuilder () {
@@ -47,6 +51,10 @@ public void setTimeToLive(long timeToLive) {
4751 this .timeToLive = timeToLive ;
4852 }
4953
54+ public void setBigPushDuration (int bigPushDuration ) {
55+ this .bigPushDuration = bigPushDuration ;
56+ }
57+
5058 public int getSendno () {
5159 return this .sendno ;
5260 }
@@ -66,6 +74,10 @@ public JsonElement toJSON() {
6674
6775 json .add (APNS_PRODUCTION , new JsonPrimitive (apnsProduction ));
6876
77+ if (bigPushDuration > 0 ) {
78+ json .add (BIG_PUSH_DURATION , new JsonPrimitive (bigPushDuration ));
79+ }
80+
6981 return json ;
7082 }
7183
@@ -74,6 +86,7 @@ public static class Builder {
7486 private long overrideMsgId = 0 ;
7587 private long timeToLive = NONE_TIME_TO_LIVE ;
7688 private boolean apnsProduction = false ;
89+ private int bigPushDuration = 0 ;
7790
7891 public Builder setSendno (int sendno ) {
7992 this .sendno = sendno ;
@@ -95,15 +108,21 @@ public Builder setApnsProduction(boolean apnsProduction) {
95108 return this ;
96109 }
97110
111+ public Builder setBigPushDuration (int bigPushDuration ) {
112+ this .bigPushDuration = bigPushDuration ;
113+ return this ;
114+ }
115+
98116 public Options build () {
99117 Preconditions .checkArgument (sendno >= 0 , "sendno should be greater than 0." );
100118 Preconditions .checkArgument (overrideMsgId >= 0 , "override_msg_id should be greater than 0." );
101119 Preconditions .checkArgument (timeToLive >= NONE_TIME_TO_LIVE , "time_to_live should be greater than 0." );
120+ Preconditions .checkArgument (bigPushDuration >= 0 , "bigPushDuration should be greater than 0." );
102121 if (sendno <= 0 ) {
103122 sendno = ServiceHelper .generateSendno ();
104123 }
105124
106- return new Options (sendno , overrideMsgId , timeToLive , apnsProduction );
125+ return new Options (sendno , overrideMsgId , timeToLive , apnsProduction , bigPushDuration );
107126 }
108127 }
109128
0 commit comments