|
@@ -3,11 +3,22 @@ package com.cooleshow.chatmodule.utils.helper;
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
import android.text.TextUtils;
|
|
import android.text.TextUtils;
|
|
|
|
|
|
|
|
+import com.cooleshow.base.utils.GsonUtils;
|
|
import com.cooleshow.base.utils.ToastUtil;
|
|
import com.cooleshow.base.utils.ToastUtil;
|
|
import com.cooleshow.base.utils.UiUtils;
|
|
import com.cooleshow.base.utils.UiUtils;
|
|
|
|
+import com.cooleshow.chatmodule.bean.MusicSheetListBean;
|
|
|
|
+import com.cooleshow.chatmodule.constants.TCMessageConstants;
|
|
|
|
+import com.cooleshow.chatmodule.manager.IMCenter;
|
|
|
|
+import com.cooleshow.chatmodule.message.bean.TUIChatShareLiveMessageBean;
|
|
|
|
+import com.cooleshow.chatmodule.message.bean.TUIChatShareMusicMessageBean;
|
|
import com.tencent.imsdk.v2.V2TIMConversation;
|
|
import com.tencent.imsdk.v2.V2TIMConversation;
|
|
|
|
+import com.tencent.imsdk.v2.V2TIMManager;
|
|
|
|
+import com.tencent.imsdk.v2.V2TIMMessage;
|
|
|
|
+import com.tencent.imsdk.v2.V2TIMSendCallback;
|
|
import com.tencent.qcloud.tuicore.TUIConstants;
|
|
import com.tencent.qcloud.tuicore.TUIConstants;
|
|
import com.tencent.qcloud.tuicore.TUICore;
|
|
import com.tencent.qcloud.tuicore.TUICore;
|
|
|
|
+import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
|
|
|
|
+import com.tencent.qcloud.tuikit.tuichat.util.ChatMessageBuilder;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Author by pq, Date on 2023/6/28.
|
|
* Author by pq, Date on 2023/6/28.
|
|
@@ -74,7 +85,28 @@ public class ChatHelper {
|
|
}
|
|
}
|
|
|
|
|
|
public void sendShareLiveMessage(String targetId, int targetConversationType, String liveRoomId, String teacherAvatar, String teacherName, String liveDes) {
|
|
public void sendShareLiveMessage(String targetId, int targetConversationType, String liveRoomId, String teacherAvatar, String teacherName, String liveDes) {
|
|
-// RCChatShareLiveMessage liveMessage = new RCChatShareLiveMessage();
|
|
|
|
|
|
+ TUIMessageBean msgBean = getMsgBean(liveRoomId, teacherAvatar, teacherName, liveDes);
|
|
|
|
+ if (msgBean != null) {
|
|
|
|
+ IMCenter.getInstance().sendMessage(msgBean.getV2TIMMessage(), targetId, ChatGroupHelper.isGroupConversation(targetConversationType), new V2TIMSendCallback<V2TIMMessage>() {
|
|
|
|
+ @Override
|
|
|
|
+ public void onProgress(int i) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onSuccess(V2TIMMessage message) {
|
|
|
|
+ ToastUtil.getInstance().showShort("分享成功");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onError(int i, String s) {
|
|
|
|
+ ToastUtil.getInstance().showShort("分享失败");
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // RCChatShareLiveMessage liveMessage = new RCChatShareLiveMessage();
|
|
//
|
|
//
|
|
// liveMessage.setTeacherAvatar(teacherAvatar);
|
|
// liveMessage.setTeacherAvatar(teacherAvatar);
|
|
// liveMessage.setRoomUID(liveRoomId);
|
|
// liveMessage.setRoomUID(liveRoomId);
|
|
@@ -105,6 +137,18 @@ public class ChatHelper {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ private TUIMessageBean getMsgBean( String liveRoomId, String teacherAvatar, String teacherName, String liveDes) {
|
|
|
|
+ TUIChatShareLiveMessageBean messageBean = new TUIChatShareLiveMessageBean();
|
|
|
|
+ messageBean.setLiveDescMessage(liveDes);
|
|
|
|
+ messageBean.setRoomUID(liveRoomId);
|
|
|
|
+ messageBean.setTeacherName(teacherName);
|
|
|
|
+ messageBean.setTeacherAvatar(teacherAvatar);
|
|
|
|
+ messageBean.setBusinessID(TCMessageConstants.TC_CHAT_SHARE_LIVE_MSG_TAG);
|
|
|
|
+ String data = GsonUtils.toJson(messageBean);
|
|
|
|
+ TUIMessageBean info = ChatMessageBuilder.buildCustomMessage(data, messageBean.onGetDisplayString(), messageBean.onGetDisplayString().getBytes());
|
|
|
|
+ return info;
|
|
|
|
+ }
|
|
|
|
+
|
|
private static class ChatHelperHolder {
|
|
private static class ChatHelperHolder {
|
|
public static ChatHelper mHelper = new ChatHelper();
|
|
public static ChatHelper mHelper = new ChatHelper();
|
|
}
|
|
}
|