调整中英文

调整开播频道接口
This commit is contained in:
zlzw 2023-09-04 16:25:06 +08:00
parent 57bda40a82
commit e89e82483b
4 changed files with 38 additions and 13 deletions

View File

@ -185,6 +185,7 @@ public class Constants {
public static final String LIVE_PK_END = "endPK";//结束PK以这个PK获取到的参数为准 public static final String LIVE_PK_END = "endPK";//结束PK以这个PK获取到的参数为准
public static final String RED_PACKET = "RedPacket";//红包通知 public static final String RED_PACKET = "RedPacket";//红包通知
public static final String RED_PACKET_SUPER_JACKPOT = "RedPacketSuperJackpot";//超级红包通知 public static final String RED_PACKET_SUPER_JACKPOT = "RedPacketSuperJackpot";//超级红包通知
public static final String SOCKET_LIVE_MSG_TO_USER = "SendMsgToUser";//七日用户主播提示语
//游戏socket //游戏socket
public static final String SOCKET_GAME_ZJH = "startGame";//炸金花 public static final String SOCKET_GAME_ZJH = "startGame";//炸金花

View File

@ -6,6 +6,7 @@ import static com.yunbao.live.bean.LiveChatBean.LUCKY_ANGEL;
import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY; import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY;
import static com.yunbao.live.bean.LiveChatBean.STAR_CHALLENGE_UPGRADE_NOTIFY; import static com.yunbao.live.bean.LiveChatBean.STAR_CHALLENGE_UPGRADE_NOTIFY;
import static com.yunbao.live.bean.LiveChatBean.SYSTEM3_COLOR; import static com.yunbao.live.bean.LiveChatBean.SYSTEM3_COLOR;
import static com.yunbao.live.bean.LiveChatBean.TYPE_TO_USER_MSG;
import static com.yunbao.live.bean.LiveChatBean.WISH_LIST_PROGRESS; import static com.yunbao.live.bean.LiveChatBean.WISH_LIST_PROGRESS;
import static com.yunbao.live.bean.LiveChatBean.XYD_COMPLETE; import static com.yunbao.live.bean.LiveChatBean.XYD_COMPLETE;
@ -242,7 +243,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
itemView.setOnLongClickListener(new View.OnLongClickListener() { itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override @Override
public boolean onLongClick(View v) { public boolean onLongClick(View v) {
if (!TextUtils.isEmpty(bean.getId())&&!TextUtils.isEmpty(bean.getUserNiceName())){ if (!TextUtils.isEmpty(bean.getId()) && !TextUtils.isEmpty(bean.getUserNiceName())) {
Bus.get().post(new LiveAudienceEvent() Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.INPUT_DIALOG) .setType(LiveAudienceEvent.LiveAudienceType.INPUT_DIALOG)
.setOlineUserlistModel(new OlineUserlistModel().setId(bean.getId()).setUserNicename(bean.getUserNiceName()))); .setOlineUserlistModel(new OlineUserlistModel().setId(bean.getId()).setUserNicename(bean.getUserNiceName())));
@ -391,7 +392,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1); new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
mTextView.setText(bean.getContent()); mTextView.setText(bean.getContent());
} }
} else if (bean.getType() == LiveChatBean.SYSTEM2) { } else if (bean.getType() == LiveChatBean.SYSTEM2 || bean.getType()==TYPE_TO_USER_MSG) {
mTextView.setTextColor(Color.parseColor("#ffffff")); mTextView.setTextColor(Color.parseColor("#ffffff"));
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1); new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
mTextView.setText(bean.getContent()); mTextView.setText(bean.getContent());
@ -530,6 +531,10 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
if (bean == null) { if (bean == null) {
return; return;
} }
if(bean.getType()==LiveChatBean.TYPE_TO_USER_MSG
&&!CommonAppConfig.getInstance().getUid().equals(bean.getAtUserID())){
return;
}
// Log.i(TAG, "insertItem: " + bean.getContent()+" size = "+(mList.size()+1)); // Log.i(TAG, "insertItem: " + bean.getContent()+" size = "+(mList.size()+1));
int size = mList.size(); int size = mList.size();
//设置最大展示99条消息 //设置最大展示99条消息
@ -551,7 +556,9 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
Bus.get().post(new LiveAudienceEvent() Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.NEW_MESSAGE_REMINDER)); .setType(LiveAudienceEvent.LiveAudienceType.NEW_MESSAGE_REMINDER));
if (bean.getAtUserID() != null && bean.getAtUserID().contains(String.valueOf(model.getId()))) { if (bean.getType() != LiveChatBean.TYPE_TO_USER_MSG &&
bean.getAtUserID() != null
&& bean.getAtUserID().contains(String.valueOf(model.getId()))) {
Bus.get().post(new LiveAudienceEvent() Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.AT_MESSAGE)); .setType(LiveAudienceEvent.LiveAudienceType.AT_MESSAGE));
mPosition = size; mPosition = size;

View File

@ -27,6 +27,7 @@ public class LiveChatBean {
public static final int XYD_COMPLETE = 207;//心愿单完成通知 public static final int XYD_COMPLETE = 207;//心愿单完成通知
public static final int WISH_LIST_PROGRESS = 307;//心愿单进度通知 public static final int WISH_LIST_PROGRESS = 307;//心愿单进度通知
public static final int BLIND_BOX = 409;//盲盒礼物消息 public static final int BLIND_BOX = 409;//盲盒礼物消息
public static final int TYPE_TO_USER_MSG=500;//指定信息
private String id; private String id;

View File

@ -2,6 +2,7 @@ package com.yunbao.live.socket;
import static com.blankj.utilcode.util.SnackbarUtils.dismiss; import static com.blankj.utilcode.util.SnackbarUtils.dismiss;
import static com.blankj.utilcode.util.ViewUtils.runOnUiThread; import static com.blankj.utilcode.util.ViewUtils.runOnUiThread;
import static com.yunbao.common.Constants.SOCKET_LIVE_MSG_TO_USER;
import static com.yunbao.live.activity.LiveRyAnchorActivity.isDRPK; import static com.yunbao.live.activity.LiveRyAnchorActivity.isDRPK;
import static com.yunbao.live.views.LiveRoomViewHolder.getIsHot; import static com.yunbao.live.views.LiveRoomViewHolder.getIsHot;
@ -101,9 +102,9 @@ public class SocketRyClient {
@Override @Override
public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) { public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) {
Log.i("tx", "加入" + "失败" + coreErrorCode); Log.i("tx", "加入" + "失败" + coreErrorCode);
if(WordUtil.isNewZh()) { if (WordUtil.isNewZh()) {
ToastUtil.show("網絡不佳無法連接,請重新進入"); ToastUtil.show("網絡不佳無法連接,請重新進入");
}else{ } else {
ToastUtil.show("The network is not connected, please re-enter"); ToastUtil.show("The network is not connected, please re-enter");
} }
} }
@ -199,9 +200,9 @@ public class SocketRyClient {
.setObject(JSONArray.parseArray(mic_data.getJSONArray("userlist").toString(), LinkMicUserBean.class)) .setObject(JSONArray.parseArray(mic_data.getJSONArray("userlist").toString(), LinkMicUserBean.class))
); );
} else if (actions == 6) { } else if (actions == 6) {
if(WordUtil.isNewZh()) { if (WordUtil.isNewZh()) {
ToastUtil.show("主播已關閉當前語音連麥功能"); ToastUtil.show("主播已關閉當前語音連麥功能");
}else{ } else {
ToastUtil.show("The host has disabled the voice connection function"); ToastUtil.show("The host has disabled the voice connection function");
} }
EventBus.getDefault().post("endMic"); EventBus.getDefault().post("endMic");
@ -209,9 +210,9 @@ public class SocketRyClient {
.setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_CLOSE) .setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_CLOSE)
.setObject(map.toJavaObject(LinkMicUserBean.class))); .setObject(map.toJavaObject(LinkMicUserBean.class)));
} else if (actions == 8) { } else if (actions == 8) {
if(WordUtil.isNewZh()) { if (WordUtil.isNewZh()) {
ToastUtil.show("您已被移出多人語音連麥"); ToastUtil.show("您已被移出多人語音連麥");
}else { } else {
ToastUtil.show("You have been removed from Multi-Voice Connection"); ToastUtil.show("You have been removed from Multi-Voice Connection");
} }
EventBus.getDefault().post("endMic"); EventBus.getDefault().post("endMic");
@ -729,6 +730,9 @@ public class SocketRyClient {
.setNewNumber(map.getInteger("new_number")) .setNewNumber(map.getInteger("new_number"))
.setMaxNumber(map.getInteger("max_number"))); .setMaxNumber(map.getInteger("max_number")));
break; break;
case SOCKET_LIVE_MSG_TO_USER:
sendToUserMsg(map);
break;
} }
} }
@ -830,6 +834,18 @@ public class SocketRyClient {
} }
} }
/**
* 七日留存新用户主播端弹幕显示接口
*/
private void sendToUserMsg(JSONObject map) {
LiveChatBean bean = new LiveChatBean();
bean.setId(CommonAppConfig.getInstance().getUid());
bean.setAtUserID(map.getString("toUserID"));
bean.setContent(map.getString("ct"));
bean.setType(LiveChatBean.TYPE_TO_USER_MSG);
mListener.onChat(bean, 1);
}
private void wordLightEnterRoom(JSONObject map, SocketReceiveBean received) { private void wordLightEnterRoom(JSONObject map, SocketReceiveBean received) {
String msgtype = map.getString("msgtype"); String msgtype = map.getString("msgtype");
if ("2".equals(msgtype)) {//发言点亮 if ("2".equals(msgtype)) {//发言点亮
@ -1328,9 +1344,9 @@ public class SocketRyClient {
IMRTCManager.getInstance().requestJoinOtherRoom(map.getString("uid"), true, msg1.toString(), new IRCRTCResultCallback() { IMRTCManager.getInstance().requestJoinOtherRoom(map.getString("uid"), true, msg1.toString(), new IRCRTCResultCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
if(WordUtil.isNewZh()) { if (WordUtil.isNewZh()) {
ToastUtil.show("邀请 " + map.getString("uid") + " 发送成功"); ToastUtil.show("邀请 " + map.getString("uid") + " 发送成功");
}else{ } else {
ToastUtil.show("invite " + map.getString("uid") + " successful"); ToastUtil.show("invite " + map.getString("uid") + " successful");
} }
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@ -1351,9 +1367,9 @@ public class SocketRyClient {
}); });
//todo 安卓端状态码说明文档https://docs.rongcloud.cn/v4/views/rtc/call/code/android.html //todo 安卓端状态码说明文档https://docs.rongcloud.cn/v4/views/rtc/call/code/android.html
Log.e("ry", rtcErrorCode + "aaaaaa" + CommonAppConfig.getInstance().getUid() + "VDSSSS" + map.getString("uid")); Log.e("ry", rtcErrorCode + "aaaaaa" + CommonAppConfig.getInstance().getUid() + "VDSSSS" + map.getString("uid"));
if(WordUtil.isNewZh()) { if (WordUtil.isNewZh()) {
ToastUtil.show("邀请 " + map.getString("uid") + " 发送失败 " + rtcErrorCode); ToastUtil.show("邀请 " + map.getString("uid") + " 发送失败 " + rtcErrorCode);
}else{ } else {
ToastUtil.show("invite " + map.getString("uid") + " lose " + rtcErrorCode); ToastUtil.show("invite " + map.getString("uid") + " lose " + rtcErrorCode);
} }
} }