11package com .xiaomi .push .service ;
22
3- import androidx .annotation .NonNull ;
4-
5- import com .xiaomi .channel .commonutils .reflect .JavaCalls ;
6- import com .xiaomi .mipush .sdk .PushContainerHelper ;
7- import com .xiaomi .xmpush .thrift .ActionType ;
3+ import com .nihility .XMPushUtils ;
84import com .xiaomi .xmpush .thrift .XmPushActionContainer ;
9- import com .xiaomi .xmpush .thrift .XmPushActionNotification ;
10- import com .xiaomi .xmpush .thrift .XmPushThriftSerializeUtils ;
11-
12- import org .apache .thrift .TBase ;
13-
14- import top .trumeet .common .utils .Utils ;
155
166public class XmPushActionOperator {
177 private final XMPushService xmPushService ;
@@ -21,22 +11,8 @@ public XmPushActionOperator(XMPushService xmPushService) {
2111 }
2212
2313 public void sendMessage (XmPushActionContainer sendMsgContainer , String packageName ) {
24- byte [] msgBytes = XmPushActionOperator .packToBytes (sendMsgContainer );
14+ byte [] msgBytes = XMPushUtils .packToBytes (sendMsgContainer );
2515 xmPushService .sendMessage (packageName , msgBytes , false );
2616 }
2717
28- public static XmPushActionContainer packToContainer (byte [] payload ) {
29- return MIPushEventProcessor .buildContainer (payload );
30- }
31-
32- public static @ NonNull XmPushActionContainer packToContainer (XmPushActionNotification action , String packageName ) {
33- return JavaCalls .callStaticMethod (
34- PushContainerHelper .class .getName (), "generateRequestContainer" ,
35- Utils .getApplication (), action , ActionType .Notification ,
36- false , packageName , action .appId );
37- }
38-
39- public static <T extends TBase <T , ?>> byte [] packToBytes (T container ) {
40- return XmPushThriftSerializeUtils .convertThriftObjectToBytes (container );
41- }
4218}
0 commit comments