过滤邀请粉丝推送消息,优化推送点击逻辑
This commit is contained in:
@@ -9,6 +9,7 @@ import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.LongSparseArray;
|
||||
@@ -24,6 +25,7 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.coorchice.library.utils.LogUtils;
|
||||
import com.microquation.linkedme.android.LinkedME;
|
||||
import com.netease.nim.uikit.api.NimUIKit;
|
||||
import com.netease.nim.uikit.api.model.contact.ContactEventListener;
|
||||
@@ -46,6 +48,7 @@ import com.netease.nimlib.sdk.team.model.Team;
|
||||
import com.netease.nimlib.sdk.uinfo.model.NimUserInfo;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.qiyukf.unicorn.api.Unicorn;
|
||||
import com.squareup.haha.perflib.Main;
|
||||
import com.tencent.bugly.crashreport.CrashReport;
|
||||
import com.tongdaxing.erban.upgrade.AppUpgradeHelper;
|
||||
import com.trello.rxlifecycle3.android.ActivityEvent;
|
||||
@@ -168,6 +171,7 @@ import com.yizhuan.xchat_android_core.recall.bean.CheckLostUserInfo;
|
||||
import com.yizhuan.xchat_android_core.recall.event.CheckLostUserEvent;
|
||||
import com.yizhuan.xchat_android_core.redPacket.bean.RedPacketInfoV2;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.giftvalue.helper.GiftValueMrg;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
@@ -736,7 +740,7 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
||||
intent.putExtra("url", url);
|
||||
startActivity(intent);
|
||||
} else if (type == 2) {
|
||||
AVRoomActivity.start(context, Long.valueOf(url));
|
||||
AVRoomActivity.start(context, Long.parseLong(url));
|
||||
}
|
||||
})
|
||||
.subscribe();
|
||||
@@ -1195,7 +1199,14 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
||||
}
|
||||
if (NimMiddleActivity.openCommunity) {
|
||||
NimMiddleActivity.openCommunity = false;
|
||||
CommunityNoticeAct.start(this);
|
||||
LogUtils.e("NimMiddleActivity"+NimMiddleActivity.payloadUid);
|
||||
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
AVRoomActivity.start(MainActivity.this,NimMiddleActivity.payloadUid);
|
||||
}
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -7,7 +7,9 @@ import android.util.Log;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.coorchice.library.utils.LogUtils;
|
||||
import com.netease.nimlib.sdk.NIMClient;
|
||||
import com.netease.nimlib.sdk.NimIntent;
|
||||
import com.netease.nimlib.sdk.mixpush.MixPushService;
|
||||
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum;
|
||||
import com.netease.nimlib.sdk.msg.model.IMMessage;
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||
@@ -21,7 +23,6 @@ import com.yizhuan.xchat_android_core.im.custom.bean.OpenRoomNotiAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.OpenSignInAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RedPackageAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomInviteFansAttachment;
|
||||
import com.yizhuan.xchat_android_library.utils.LogUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.UIUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -55,6 +56,7 @@ public class NimMiddleActivity extends BaseActivity {
|
||||
*/
|
||||
public static boolean openCommunity = false;
|
||||
public static boolean delayOpenCommunity = false;
|
||||
public static long payloadUid;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -74,6 +76,10 @@ public class NimMiddleActivity extends BaseActivity {
|
||||
} else {
|
||||
parseNormalIntent(null);
|
||||
}
|
||||
|
||||
if (NIMClient.getService(MixPushService.class).isFCMIntent(intent)){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,29 +99,32 @@ public class NimMiddleActivity extends BaseActivity {
|
||||
LogUtils.i( "getMsgType:"+imMessage.getMsgType() );
|
||||
if (imMessage.getMsgType() == MsgTypeEnum.custom) {
|
||||
CustomAttachment attachment = (CustomAttachment) imMessage.getAttachment();
|
||||
if (attachment.getFirst() == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_OPEN_ROOM_NOTI) {
|
||||
OpenRoomNotiAttachment noticeAttachment = (OpenRoomNotiAttachment) attachment;
|
||||
if (noticeAttachment.getUid() > 0) {
|
||||
AVRoomActivity.start(this, noticeAttachment.getUid());
|
||||
}
|
||||
} else if (attachment instanceof OpenSignInAttachment) {
|
||||
if (AuthModel.get().isImLogin()
|
||||
&& !UIUtils.isTopActivity(this, SignInActivity.class.getSimpleName())) {
|
||||
SignInActivity.start(this);
|
||||
}
|
||||
} else if (attachment.getFirst() == CustomAttachment.CUSTOM_MSG_RED_PACKAGE){
|
||||
if (attachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ALL_DIAMOND){
|
||||
RedPackageAttachment redPackageAttachment = (RedPackageAttachment) attachment;
|
||||
AVRoomActivity.start(this, redPackageAttachment.getRedPackageNotifyInfo().getRoomUid());
|
||||
}
|
||||
} else if (attachment.getFirst() == CustomAttachment.CUSTOM_MSG_PUSH_NOTIFIFICATION){
|
||||
if (attachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_ROOM){
|
||||
RoomInviteFansAttachment noticeAttachment = (RoomInviteFansAttachment) attachment;
|
||||
if (noticeAttachment.getRoomInviteFansInfo() == null){
|
||||
return;
|
||||
if (attachment != null){
|
||||
if (attachment.getFirst() == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_OPEN_ROOM_NOTI) {
|
||||
OpenRoomNotiAttachment noticeAttachment = (OpenRoomNotiAttachment) attachment;
|
||||
if (noticeAttachment.getUid() > 0) {
|
||||
AVRoomActivity.start(this, noticeAttachment.getUid());
|
||||
}
|
||||
} else if (attachment instanceof OpenSignInAttachment) {
|
||||
if (AuthModel.get().isImLogin()
|
||||
&& !UIUtils.isTopActivity(this, SignInActivity.class.getSimpleName())) {
|
||||
SignInActivity.start(this);
|
||||
}
|
||||
} else if (attachment.getFirst() == CustomAttachment.CUSTOM_MSG_RED_PACKAGE){
|
||||
if (attachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ALL_DIAMOND){
|
||||
RedPackageAttachment redPackageAttachment = (RedPackageAttachment) attachment;
|
||||
AVRoomActivity.start(this, redPackageAttachment.getRedPackageNotifyInfo().getRoomUid());
|
||||
}
|
||||
} else if (attachment.getFirst() == CustomAttachment.CUSTOM_MSG_PUSH_NOTIFIFICATION){
|
||||
if (attachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_ROOM){
|
||||
RoomInviteFansAttachment noticeAttachment = (RoomInviteFansAttachment) attachment;
|
||||
if (noticeAttachment.getRoomInviteFansInfo() == null){
|
||||
return;
|
||||
}
|
||||
AVRoomActivity.start(this, noticeAttachment.getRoomInviteFansInfo().getData().getData().getRoomUid());
|
||||
}
|
||||
AVRoomActivity.start(this, noticeAttachment.getRoomInviteFansInfo().getData().getRoomUid());
|
||||
}
|
||||
|
||||
}
|
||||
}else if (imMessage.getMsgType() == MsgTypeEnum.notification){
|
||||
LogUtils.i( "MsgTypeEnum.notification");
|
||||
@@ -132,18 +141,20 @@ public class NimMiddleActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
private void parsePayloadData(Map<String, String> payload) {
|
||||
Log.i(TAG, "rev pushMessage payload true");
|
||||
String data = payload.get("data");
|
||||
|
||||
String skiptype = payload.get(PushMessageHandler.PAYLOAD_SKIPTYPE);
|
||||
String push_title = payload.get(PushMessageHandler.PAYLOAD_PUSH_TITLE);
|
||||
String payloadData = payload.get(PushMessageHandler.PAYLOAD_DATA);
|
||||
try {
|
||||
JSONObject object = JSON.parseObject(data);
|
||||
int first = object.getInteger("first");
|
||||
int second = object.getInteger("second");
|
||||
JSONObject object = JSON.parseObject(payloadData);
|
||||
long uid = object.getLong("uid");
|
||||
payloadUid = uid;
|
||||
|
||||
if (second == CustomAttachment.CUSTOM_DYNAMTC_UNREADCOUNT && AuthModel.get().getCurrentUid() > 0) {
|
||||
if (AuthModel.get().getCurrentUid() > 0) {
|
||||
|
||||
if (!firstEnter) {
|
||||
CommunityNoticeAct.start(this);
|
||||
LogUtils.e("rev pushMessage payload true:"+uid);
|
||||
AVRoomActivity.start(this,uid);
|
||||
// CommunityNoticeAct.start(this);
|
||||
finish();
|
||||
} else {
|
||||
openCommunity = true;
|
||||
|
@@ -37,8 +37,6 @@ import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.yizhuan.xchat_android_core.redpackage.RedPackageModel;
|
||||
import com.yizhuan.xchat_android_core.redpackage.RedPackageNotifyInfo;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.avroom.fragment.AbsRoomFragment;
|
||||
import com.yizhuan.erban.avroom.fragment.HomePartyFragment;
|
||||
@@ -73,7 +71,6 @@ import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.auth.event.LogoutEvent;
|
||||
import com.yizhuan.xchat_android_core.bean.BaseProtocol;
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RedPackageAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.game.ImGameMode;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
@@ -91,6 +88,8 @@ import com.yizhuan.xchat_android_core.patriarch.event.CloseMinRoomEvent;
|
||||
import com.yizhuan.xchat_android_core.patriarch.event.ImPushMsgPmLimitTimeEvent;
|
||||
import com.yizhuan.xchat_android_core.patriarch.event.PmDismissAllLimitDialogEvent;
|
||||
import com.yizhuan.xchat_android_core.patriarch.exception.PmRoomLimitException;
|
||||
import com.yizhuan.xchat_android_core.redpackage.RedPackageModel;
|
||||
import com.yizhuan.xchat_android_core.redpackage.RedPackageNotifyInfo;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.bean.SimplePartyRoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.dragonball.DragonBallModel;
|
||||
|
@@ -92,11 +92,11 @@ import static com.yizhuan.xchat_android_core.Constants.DEBUG_MAX_UID;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_HEAD_NOBLE;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_OPENNOBLE;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_RENEWNOBLE;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_PUSH_NOTIFIFICATION;
|
||||
//import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_PUSH_NOTIFIFICATION;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_RED_PACKAGE;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_CHAT_ROOM;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_DYNAMIC_MSG;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_ROOM;
|
||||
//import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_CHAT_ROOM;
|
||||
//import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_DYNAMIC_MSG;
|
||||
//import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_ROOM;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ALL_DIAMOND;
|
||||
|
||||
|
||||
|
@@ -7,30 +7,32 @@ import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.coorchice.library.utils.LogUtils;
|
||||
import com.netease.nimlib.sdk.StatusBarNotificationConfig;
|
||||
import com.netease.nimlib.sdk.mixpush.MixPushMessageHandler;
|
||||
import com.yizhuan.xchat_android_core.DemoCache;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||
import com.yizhuan.xchat_android_library.utils.LogUtil;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
public class PushMessageHandler implements MixPushMessageHandler {
|
||||
private static final String TAG = "mix_push";
|
||||
public static final String PAYLOAD_SESSION_ID = "sessionID";
|
||||
public static final String PAYLOAD_SESSION_TYPE = "sessionType";
|
||||
public static final String PAYLOAD_DATA = "payload_data";
|
||||
public static final String PAYLOAD_SKIPTYPE = "skiptype";
|
||||
public static final String PAYLOAD_PUSH_TITLE = "pushTitle";
|
||||
public static final String PAYLOAD_DATA = "data";
|
||||
|
||||
@Override
|
||||
public boolean onNotificationClicked(Context context, Map<String, String> payload) {
|
||||
Log.i(TAG, "rev pushMessage payload " + payload);
|
||||
LogUtils.e( "rev pushMessage payload " + payload);
|
||||
|
||||
String sessionId = payload.get(PAYLOAD_SESSION_ID);
|
||||
String type = payload.get(PAYLOAD_SESSION_TYPE);
|
||||
String skiptype = payload.get(PAYLOAD_SKIPTYPE);
|
||||
// String push_title = payload.get(PAYLOAD_PUSH_TITLE);
|
||||
// String payloadData = payload.get(PAYLOAD_DATA);
|
||||
|
||||
String skiptype = payload.get("skiptype");
|
||||
if (!TextUtils.isEmpty(skiptype) && CustomAttachment.CUSTOM_MSG_HEADER_TYPE_WORLD_DYNAMIC == Integer.valueOf(skiptype)) {
|
||||
Log.i(TAG, "second");
|
||||
if (!TextUtils.isEmpty(skiptype)) {
|
||||
Intent notifyIntent = new Intent();
|
||||
notifyIntent.setComponent(initLaunchComponent(context));
|
||||
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
@@ -42,7 +44,7 @@ public class PushMessageHandler implements MixPushMessageHandler {
|
||||
return true;
|
||||
|
||||
} else {
|
||||
Log.i(TAG, "rev pushMessage payload false");
|
||||
LogUtils.e("rev pushMessage payload false");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -63,4 +65,7 @@ public class PushMessageHandler implements MixPushMessageHandler {
|
||||
public boolean cleanMixPushNotifications(int pushType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -311,13 +311,15 @@ public final class IMNetEaseManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送通知,无论在前台后台都能收到
|
||||
* 注册消息过滤器
|
||||
*
|
||||
*/
|
||||
private void registerMessageFilter() {
|
||||
NIMClient.getService(MsgService.class)
|
||||
.registerIMMessageFilter(message -> {
|
||||
if (message.getMsgType() == MsgTypeEnum.custom) {
|
||||
CustomAttachment customAttachment = (CustomAttachment) message.getAttachment();
|
||||
if (customAttachment != null){
|
||||
switch (customAttachment.getFirst()) {
|
||||
case CustomAttachment.CUSTOM_MSG_HEADER_TYPE_LUCKY_MONEY:
|
||||
switch (customAttachment.getSecond()) {
|
||||
@@ -328,22 +330,22 @@ public final class IMNetEaseManager {
|
||||
// 你领取了某人的红包 || 某人领取了你的红包
|
||||
if (!(Objects.equals(uid, String.valueOf(luckyMoneyInfo.getReceiveUid())) ||
|
||||
Objects.equals(uid, String.valueOf(luckyMoneyInfo.getSenderUid())))) {
|
||||
Log.e(TAG, "registerMessageFilter: ");
|
||||
Log.e(TAG, "registerMessageFilter: CUSTOM_MSG_SUB_TYPE_RECEIVE_LUCKY_MONEY");
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
//邀请粉丝
|
||||
// case CustomAttachment.CUSTOM_MSG_PUSH_NOTIFIFICATION:
|
||||
// switch (customAttachment.getSecond()){
|
||||
// case CustomAttachment.CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_ROOM:
|
||||
// RoomInviteFansAttachment roomInviteFansAttachment = (RoomInviteFansAttachment) message.getAttachment();
|
||||
// RoomInviteFansInfo inviteFansInfo = roomInviteFansAttachment.getRoomInviteFansInfo();
|
||||
// return true;
|
||||
// }
|
||||
// break;
|
||||
//邀请粉丝
|
||||
case CustomAttachment.CUSTOM_MSG_PUSH_NOTIFIFICATION:
|
||||
switch (customAttachment.getSecond()){
|
||||
case CustomAttachment.CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_ROOM:
|
||||
Log.e(TAG, "registerMessageFilter: CUSTOM_MSG_PUSH_NOTIFIFICATION");
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (message.getMsgType() == MsgTypeEnum.notification) {
|
||||
NotificationAttachment notificationAttachment = (NotificationAttachment) message.getAttachment();
|
||||
|
@@ -352,8 +352,8 @@ public class CustomAttachment implements MsgAttachment {
|
||||
//推送消息
|
||||
public static final int CUSTOM_MSG_PUSH_NOTIFIFICATION = 70;
|
||||
public static final int CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_ROOM = 701;// 推送进入房间
|
||||
public static final int CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_CHAT_ROOM = 702;// 推送进入聊天页
|
||||
public static final int CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_DYNAMIC_MSG = 703;// 推送进入动态消息
|
||||
// public static final int CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_CHAT_ROOM = 702;// 推送进入聊天页
|
||||
// public static final int CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_DYNAMIC_MSG = 703;// 推送进入动态消息
|
||||
|
||||
public CustomAttachment() {
|
||||
|
||||
|
@@ -7,14 +7,19 @@ import lombok.Data;
|
||||
@Data
|
||||
public class RoomInviteFansInfo implements Serializable {
|
||||
|
||||
private JumpValue data;
|
||||
private DataInfo data;
|
||||
|
||||
private int skiptype;
|
||||
|
||||
private String pushTitle;
|
||||
|
||||
@Data
|
||||
public class JumpValue implements Serializable{
|
||||
public static class DataInfo implements Serializable{
|
||||
private PayloadData data;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class PayloadData implements Serializable{
|
||||
private long roomUid;
|
||||
private String content;
|
||||
}
|
||||
|
@@ -158,6 +158,11 @@ public class IMMessageManager {
|
||||
.observeReceiveMessage(incomingMessageObserver, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤推送消息
|
||||
* @param messageList
|
||||
* @return
|
||||
*/
|
||||
public static List<IMMessage> filterMessage(List<IMMessage> messageList) {
|
||||
if (messageList != null) {
|
||||
Iterator<IMMessage> iterator = messageList.iterator();
|
||||
@@ -168,21 +173,26 @@ public class IMMessageManager {
|
||||
if (customAttachment == null){
|
||||
continue;
|
||||
}
|
||||
int second = customAttachment.getSecond();
|
||||
|
||||
switch (customAttachment.getFirst()) {
|
||||
case CustomAttachment.CUSTOM_MSG_HEADER_TYPE_LUCKY_MONEY:
|
||||
switch (second) {
|
||||
case CustomAttachment.CUSTOM_MSG_SUB_TYPE_RECEIVE_LUCKY_MONEY:
|
||||
LuckyMoneyTipsAttachment luckyMoneyAttachment = (LuckyMoneyTipsAttachment) message.getAttachment();
|
||||
LuckyMoneyInfo luckyMoneyInfo = luckyMoneyAttachment.getLuckyMoneyInfo();
|
||||
String uid = String.valueOf(AuthModel.get().getCurrentUid());
|
||||
// 你领取了某人的红包 || 某人领取了你的红包
|
||||
if (!(Objects.equals(uid, String.valueOf(luckyMoneyInfo.getReceiveUid())) ||
|
||||
Objects.equals(uid, String.valueOf(luckyMoneyInfo.getSenderUid())))) {
|
||||
NIMClient.getService(MsgService.class).deleteChattingHistory(message);
|
||||
iterator.remove();
|
||||
}
|
||||
break;
|
||||
if (customAttachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_RECEIVE_LUCKY_MONEY) {
|
||||
LuckyMoneyTipsAttachment luckyMoneyAttachment = (LuckyMoneyTipsAttachment) message.getAttachment();
|
||||
LuckyMoneyInfo luckyMoneyInfo = luckyMoneyAttachment.getLuckyMoneyInfo();
|
||||
String uid = String.valueOf(AuthModel.get().getCurrentUid());
|
||||
// 你领取了某人的红包 || 某人领取了你的红包
|
||||
if (!(Objects.equals(uid, String.valueOf(luckyMoneyInfo.getReceiveUid())) ||
|
||||
Objects.equals(uid, String.valueOf(luckyMoneyInfo.getSenderUid())))) {
|
||||
NIMClient.getService(MsgService.class).deleteChattingHistory(message);
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CustomAttachment.CUSTOM_MSG_PUSH_NOTIFIFICATION:
|
||||
if (customAttachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_ROOM){
|
||||
NIMClient.getService(MsgService.class).deleteChattingHistory(message);
|
||||
iterator.remove();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -192,6 +202,11 @@ public class IMMessageManager {
|
||||
return messageList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤消息列表
|
||||
* @param recentContacts
|
||||
* @return
|
||||
*/
|
||||
public static List<RecentContact> filterRecentContact(List<RecentContact> recentContacts) {
|
||||
if (recentContacts != null) {
|
||||
Iterator<RecentContact> iterator = recentContacts.iterator();
|
||||
@@ -214,21 +229,25 @@ public class IMMessageManager {
|
||||
if (customAttachment == null) {
|
||||
continue;
|
||||
}
|
||||
int second = customAttachment.getSecond();
|
||||
switch (customAttachment.getFirst()) {
|
||||
case CustomAttachment.CUSTOM_MSG_HEADER_TYPE_LUCKY_MONEY:
|
||||
switch (second) {
|
||||
case CustomAttachment.CUSTOM_MSG_SUB_TYPE_RECEIVE_LUCKY_MONEY:
|
||||
LuckyMoneyTipsAttachment luckyMoneyAttachment = (LuckyMoneyTipsAttachment) message.getAttachment();
|
||||
LuckyMoneyInfo luckyMoneyInfo = luckyMoneyAttachment.getLuckyMoneyInfo();
|
||||
String uid = String.valueOf(AuthModel.get().getCurrentUid());
|
||||
// 你领取了某人的红包 || 某人领取了你的红包
|
||||
if (!Objects.equals(uid, String.valueOf(luckyMoneyInfo.getReceiveUid())) &&
|
||||
!Objects.equals(uid, String.valueOf(luckyMoneyInfo.getSenderUid()))) {
|
||||
NIMClient.getService(MsgService.class).clearUnreadCount(recentContact.getContactId(), SessionTypeEnum.Team);
|
||||
iterator.remove();
|
||||
}
|
||||
break;
|
||||
if (customAttachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_RECEIVE_LUCKY_MONEY) {
|
||||
LuckyMoneyTipsAttachment luckyMoneyAttachment = (LuckyMoneyTipsAttachment) message.getAttachment();
|
||||
LuckyMoneyInfo luckyMoneyInfo = luckyMoneyAttachment.getLuckyMoneyInfo();
|
||||
String uid = String.valueOf(AuthModel.get().getCurrentUid());
|
||||
// 你领取了某人的红包 || 某人领取了你的红包
|
||||
if (!Objects.equals(uid, String.valueOf(luckyMoneyInfo.getReceiveUid())) &&
|
||||
!Objects.equals(uid, String.valueOf(luckyMoneyInfo.getSenderUid()))) {
|
||||
NIMClient.getService(MsgService.class).clearUnreadCount(recentContact.getContactId(), SessionTypeEnum.Team);
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CustomAttachment.CUSTOM_MSG_PUSH_NOTIFIFICATION:
|
||||
if (customAttachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_ROOM){
|
||||
NIMClient.getService(MsgService.class).deleteChattingHistory(message);
|
||||
iterator.remove();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user