@@ -236,6 +236,9 @@ public ResultPack<Long> getTaskId(PushType pushType, Message message) throws IOE
236236
237237 VarnishedMessageJson messageJson = new VarnishedMessageJson (noticeBarInfo , noticeExpandInfo , clickTypeInfo , pushTimeInfo , advanceInfo );
238238 addParameter (body , "messageJson" , JSON .toJSONString (messageJson ));
239+ if (message .getRestrictedPackageNames () != null ) {
240+ addParameter (body , "restrictedPackageNames" , array2Str (message .getRestrictedPackageNames ()));
241+ }
239242 }
240243
241244 HttpResult httpResult = super .post (useSSL , _url , body .toString ());
@@ -392,7 +395,9 @@ public ResultPack<Long> pushToApp(PushType pushType, Message message) throws IOE
392395
393396 VarnishedMessageJson messageJson = new VarnishedMessageJson (noticeBarInfo , noticeExpandInfo , clickTypeInfo , pushTimeInfo , advanceInfo );
394397 addParameter (body , "messageJson" , JSON .toJSONString (messageJson ));
395-
398+ if (message .getRestrictedPackageNames () != null ) {
399+ addParameter (body , "restrictedPackageNames" , array2Str (message .getRestrictedPackageNames ()));
400+ }
396401 }
397402
398403 HttpResult httpResult = super .post (useSSL , _url , body .toString ());
@@ -485,7 +490,9 @@ public ResultPack<Long> pushToTag(PushType pushType, Message message, List<Strin
485490
486491 VarnishedMessageJson messageJson = new VarnishedMessageJson (noticeBarInfo , noticeExpandInfo , clickTypeInfo , pushTimeInfo , advanceInfo );
487492 addParameter (body , "messageJson" , JSON .toJSONString (messageJson ));
488-
493+ if (message .getRestrictedPackageNames () != null ) {
494+ addParameter (body , "restrictedPackageNames" , array2Str (message .getRestrictedPackageNames ()));
495+ }
489496 }
490497
491498 HttpResult httpResult = super .post (useSSL , _url , body .toString ());
@@ -648,6 +655,9 @@ private ResultPack<PushResult> pushMessageNoRetry(UserType userType, PushType pu
648655 } else {
649656 return ResultPack .failed ("appId is empty" );
650657 }
658+ if (message .getRestrictedPackageNames () != null ) {
659+ addParameter (body , "restrictedPackageNames" , array2Str (message .getRestrictedPackageNames ()));
660+ }
651661 if (PushType .DIRECT == pushType ) {
652662 UnVarnishedMessage msgInfo = (UnVarnishedMessage ) message ;
653663
@@ -771,6 +781,16 @@ private ResultPack<PushResult> pushMessageByTaskIdNoRetry(UserType userType, Pus
771781 }
772782 }
773783
784+ private String array2Str (String [] restrictedPackageNames ) {
785+ if (restrictedPackageNames == null || restrictedPackageNames .length == 0 ) {
786+ return null ;
787+ }
788+ StringBuilder sb = new StringBuilder (restrictedPackageNames [0 ]);
789+ for (int i = 1 ; i < restrictedPackageNames .length ; ++i ) {
790+ sb .append ("," ).append (restrictedPackageNames [i ]);
791+ }
792+ return sb .toString ();
793+ }
774794
775795 enum UserType {
776796
0 commit comments