Browse Source

添加自定义消息注册流程

Pq 1 năm trước cách đây
mục cha
commit
8762b991c9

+ 15 - 0
chatModule/src/main/java/com/cooleshow/chatmodule/utils/helper/IMThemManager.java

@@ -3,9 +3,16 @@ package com.cooleshow.chatmodule.utils.helper;
 import android.content.Context;
 
 import com.cooleshow.chatmodule.R;
+import com.cooleshow.chatmodule.constants.TCMessageConstants;
+import com.cooleshow.chatmodule.message.bean.TUIChatShareLiveMessageBean;
+import com.cooleshow.chatmodule.message.bean.TUIChatShareMusicMessageBean;
+import com.cooleshow.chatmodule.message.holder.TUIChatShareLiveMessageHolder;
+import com.cooleshow.chatmodule.message.holder.TUIChatShareMusicMessageHolder;
 import com.tencent.qcloud.tuicore.TUIConfig;
 import com.tencent.qcloud.tuikit.timcommon.component.MessageProperties;
 import com.tencent.qcloud.tuikit.timcommon.util.ScreenUtil;
+import com.tencent.qcloud.tuikit.tuichat.TUIChatService;
+import com.tencent.qcloud.tuikit.tuichat.classicui.ClassicUIService;
 import com.tencent.qcloud.tuikit.tuichat.config.TUIChatConfigs;
 
 /**
@@ -24,6 +31,14 @@ public class IMThemManager {
     }
 
     public void init(Context context){
+        //自定义消息
+        TUIChatService.getInstance().addCustomMessageType(TCMessageConstants.TC_CHAT_SHARE_LIVE_MSG_TAG, TUIChatShareLiveMessageBean.class);
+        TUIChatService.getInstance().addCustomMessageType(TCMessageConstants.TC_CHAT_SHARE_MUSIC_MSG_TAG, TUIChatShareMusicMessageBean.class);
+        ClassicUIService.getInstance().addMessageType(TUIChatShareLiveMessageBean.class, TUIChatShareLiveMessageHolder.class);
+        ClassicUIService.getInstance().addMessageType(TUIChatShareMusicMessageBean.class, TUIChatShareMusicMessageHolder.class);
+
+        
+
         MessageProperties instance = MessageProperties.getInstance();
         instance.setAvatarRadius(ScreenUtil.dip2px(20));
         instance.setRightBubble(context.getResources().getDrawable(R.drawable.tc_rc_ic_message_bubble_right_));