ios平台也可能使用个推

This commit is contained in:
heavyrian2012
2023-10-08 10:47:22 +08:00
parent 7251995cea
commit 2f31ff1fe0
3 changed files with 15 additions and 3 deletions

View File

@@ -89,7 +89,7 @@ public class AndroidPushServiceImpl implements AndroidPushService {
fcmPush.push(pushMessage);
break;
case AndroidPushType.ANDROID_PUSH_TYPE_GETUI:
getuiPush.push(pushMessage);
getuiPush.push(pushMessage, true);
break;
default:
LOG.info("unknown push type");

View File

@@ -61,7 +61,7 @@ public class GetuiPush {
}
public void push(PushMessage pushMessage) {
public void push(PushMessage pushMessage, boolean isAndroid) {
if (pushMessage.pushMessageType == PushMessageType.PUSH_MESSAGE_TYPE_RECALLED || pushMessage.pushMessageType == PushMessageType.PUSH_MESSAGE_TYPE_DELETED) {
//Todo not implement
//撤回或者删除消息,需要更新远程通知,暂未实现

View File

@@ -3,6 +3,8 @@ package cn.wildfirechat.push.ios;
import cn.wildfirechat.push.PushMessage;
import cn.wildfirechat.push.PushMessageType;
import cn.wildfirechat.push.Utility;
import cn.wildfirechat.push.android.AndroidPushType;
import cn.wildfirechat.push.android.getui.GetuiPush;
import com.google.gson.Gson;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -20,6 +22,9 @@ public class IOSPushServiceImpl implements IOSPushService {
@Autowired
public ApnsServer apnsServer;
@Autowired
private GetuiPush getuiPush;
private ExecutorService executorService = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), Runtime.getRuntime().availableProcessors() * 100,
60L, TimeUnit.SECONDS,
new SynchronousQueue<Runnable>());
@@ -38,7 +43,14 @@ public class IOSPushServiceImpl implements IOSPushService {
LOG.error("等待太久,消息抛弃");
return;
}
apnsServer.pushMessage(pushMessage);
if(pushMessage.pushType < 3) {
apnsServer.pushMessage(pushMessage);
} else if(pushMessage.pushType == AndroidPushType.ANDROID_PUSH_TYPE_GETUI) {
getuiPush.push(pushMessage, false);
} else {
LOG.error("Unknown ios push type: {}", pushMessage.pushType);
}
});
return "OK";
}