Commit dd734704 by YKai

feat:im消息过滤

parent 0eb6d8ea
......@@ -5,8 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import com.yidianling.im.session.extension.CustomAttachtmentFilter41;
import com.yidianling.im.session.extension.CustomAttachtmentFilter42;
import com.yidianling.im.session.extension.CustomAttachmentFilter;
import com.yidianling.nimbase.common.ToastHelper;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.NimStrings;
......@@ -105,13 +104,8 @@ public class NIMInitManager {
NIMClient.getService(MsgService.class).registerIMMessageFilter(new IMMessageFilter() {
@Override
public boolean shouldIgnore(IMMessage message) {
/*
* 因为灵犀消息,产品觉得有未知消失类型
* 后端不能区分该消息是给客户端发还是WEB前端发----
* 晚上十点写的代码---TMD---
* 所以过滤掉CustomAttachtmentFilter41和CustomAttachtmentFilter42这个消息类型
* */
if (message.getAttachment() instanceof CustomAttachtmentFilter41||message.getAttachment() instanceof CustomAttachtmentFilter42){
// 如果消息为CustomAttachmentFilter,则需要过滤掉此条消息,不显示
if (message.getAttachment() instanceof CustomAttachmentFilter){
return true;
}
if (UserPreferences.getMsgIgnore() && message.getAttachment() != null) {
......
......@@ -54,6 +54,7 @@ import com.yidianling.im.session.extension.CustomAttachTipMsg;
import com.yidianling.im.session.extension.CustomAttachment;
import com.yidianling.im.session.extension.CustomAttachmentBusinessCard;
import com.yidianling.im.session.extension.CustomAttachmentEvaluate;
import com.yidianling.im.session.extension.CustomAttachmentFilter;
import com.yidianling.im.session.extension.CustomAttachmentJumpToDaoYi;
import com.yidianling.im.session.extension.CustomAttachmentOrderStatus;
import com.yidianling.im.session.extension.CustomAttachmentPhoneCallRedPacket;
......@@ -65,8 +66,6 @@ import com.yidianling.im.session.extension.CustomAttachmentRedStatus;
import com.yidianling.im.session.extension.CustomAttachmentShareMsg;
import com.yidianling.im.session.extension.CustomAttachmentSwitchKeFuTips;
import com.yidianling.im.session.extension.CustomAttachmentTest;
import com.yidianling.im.session.extension.CustomAttachtmentFilter41;
import com.yidianling.im.session.extension.CustomAttachtmentFilter42;
import com.yidianling.im.session.extension.CustomCustomerServiceCardAttachment;
import com.yidianling.im.session.extension.CustomRecommendExpertListMsg;
import com.yidianling.im.session.extension.CustomSystemTips;
......@@ -459,8 +458,7 @@ public class SessionHelper {
NimUIKit.registerMsgItemViewHolder(CustomAttachmentBusinessCard.class, MsgViewHolderBusinessCard.class);//专家自定义名片 ,TYPE=34
NimUIKit.registerMsgItemViewHolder(CustomAttachmentJumpToDaoYi.class, MsgViewHolderJumpToDaoYi.class);//跳转导医聊天窗口触发导医分配逻辑,TYPE=35
NimUIKit.registerMsgItemViewHolder(CustomAttachmentSwitchKeFuTips.class, MsgViewHolderSwitchKeFuTips.class);//客服转介需求,TYPE=40
NimUIKit.registerMsgItemViewHolder(CustomAttachtmentFilter41.class, MsgViewHolderUnknown.class);//客服转介需求,TYPE=41过滤掉
NimUIKit.registerMsgItemViewHolder(CustomAttachtmentFilter42.class, MsgViewHolderUnknown.class);//客服转介需求,TYPE=42过滤掉
NimUIKit.registerMsgItemViewHolder(CustomAttachmentFilter.class, MsgViewHolderUnknown.class);// 注册消息过滤器
}
......
......@@ -130,13 +130,10 @@ public class CustomAttachParser implements MsgAttachmentParser {
//客服转介需求
attachment = new CustomAttachmentSwitchKeFuTips();
break;
//41 42消息过滤掉
case CustomAttachmentType.TYPE_FILTER_41:
//客服转介需求41 消息过滤掉
attachment = new CustomAttachtmentFilter41();
break;
case CustomAttachmentType.TYPE_FILTER_42:
//客服转介需求42 消息过滤掉
attachment = new CustomAttachtmentFilter42();
attachment = new CustomAttachmentFilter();
break;
default:
attachment = new DefaultCustomAttachment();
......
......@@ -9,8 +9,8 @@ import com.alibaba.fastjson.JSONObject;
* @Company 壹点灵
* @date 2021/1/27
*/
public class CustomAttachtmentFilter41 extends CustomAttachment{
public CustomAttachtmentFilter41() {
public class CustomAttachmentFilter extends CustomAttachment{
public CustomAttachmentFilter() {
super(CustomAttachmentType.TYPE_FILTER_41);
}
......
package com.yidianling.im.session.extension;
import com.alibaba.fastjson.JSONObject;
/**
* @author huozhiliang
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2021/1/27
*/
public class CustomAttachtmentFilter42 extends CustomAttachment{
public CustomAttachtmentFilter42() {
super(CustomAttachmentType.TYPE_FILTER_42);
}
@Override
protected void parseData(JSONObject data) {
}
@Override
protected JSONObject packData() {
return null;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment