增加粉丝团云信消息处理

This commit is contained in:
huangjian
2022-04-08 14:27:20 +08:00
parent d698dce10d
commit 7c2f587557
10 changed files with 279 additions and 185 deletions

View File

@@ -39,6 +39,7 @@ import com.yizhuan.erban.utils.RegexUtil;
import com.yizhuan.xchat_android_constants.XChatConstants;
import com.yizhuan.xchat_android_core.Constants;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
import com.yizhuan.xchat_android_core.gift.bean.GiftMultiReceiverInfo;
import com.yizhuan.xchat_android_core.gift.bean.GiftReceiveInfo;
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagGifts;
@@ -48,6 +49,7 @@ import com.yizhuan.xchat_android_core.home.event.FollowRoomEvent;
import com.yizhuan.xchat_android_core.home.event.ShareRoomEvent;
import com.yizhuan.xchat_android_core.home.model.CollectionRoomModel;
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.FansTeamMsgAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomInfoAttachment;
import com.yizhuan.xchat_android_core.magic.bean.MagicReceivedInfo;
import com.yizhuan.xchat_android_core.magic.bean.MultiMagicReceivedInfo;
@@ -334,6 +336,9 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
case RoomEvent.RECEIVED_ALL_MIC_MAGIC:
onReceiveMultiMagicMsg(roomEvent.getMultiMagicReceivedInfo());
break;
case RoomEvent.FANS_TEAM_JOIN:
onReceiveFansTeamJoinMsg(roomEvent.getChatRoomMessage());
break;
default:
break;
}
@@ -762,6 +767,15 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
giftView.onReceiveMultiMagicMsg(multiMagicReceivedInfo);
}
private void onReceiveFansTeamJoinMsg(ChatRoomMessage message) {
if (message == null || !isResumed())
return;
if (giftView == null) {
giftView = (GiftV2View) mVsGift2View.inflate();
}
giftView.onReceiveFansTeamOpenMsg(message);
}
private void updateOnlineNumberView(int onlineNumber) {
if (!SuperAdminUtil.isSuperAdmin()) {
if (onlineNumber < 1) {

View File

@@ -25,7 +25,9 @@ import com.yizhuan.erban.ui.webview.DialogWebViewActivity
import com.yizhuan.xchat_android_core.Constants
import com.yizhuan.xchat_android_core.UriProvider
import com.yizhuan.xchat_android_core.auth.AuthModel
import com.yizhuan.xchat_android_core.fansteam.FansTeamInitInfo
import com.yizhuan.xchat_android_core.home.bean.BannerInfo
import com.yizhuan.xchat_android_core.im.custom.bean.FansTeamMsgAttachment
import com.yizhuan.xchat_android_core.im.custom.bean.RequestUpmicAttachment
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
import com.yizhuan.xchat_android_core.manager.RoomEvent
@@ -106,53 +108,56 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
fansTeamViewModel.fansTeamInitInfoLiveData.observe(viewLifecycleOwner) {
it?.let {
var clickListener: View.OnClickListener? = null
if (!AvRoomDataManager.get().isRoomOwner && !it.isAnchorFans && it.hasFansTeamCurrentRoom) {
gameBinding.flFansTeamJoinTip.isVisible = true
gameBinding.tvFansTeamOpt.isVisible = false
} else {
gameBinding.flFansTeamJoinTip.isVisible = false
gameBinding.tvFansTeamOpt.isVisible = true
}
if (it.hasFansTeamCurrentRoom) {
if (AvRoomDataManager.get().isRoomOwner) {
gameBinding.tvFansTeamOpt.text = "粉丝团(${it.anchorFansNum})"
clickListener = View.OnClickListener {
CommonWebViewActivity.start(
requireContext(),
UriProvider.getFansTeamRankUrl(AvRoomDataManager.get().roomUid)
)
}
} else {
if (it.isAnchorFans) {
gameBinding.tvFansTeamOpt.text = "粉丝LV.(${it.fansLevelSeq})"
clickListener = View.OnClickListener {
FansTeamJoinedActivity.start(requireContext())
}
} else {
clickListener = View.OnClickListener {
FansTeamJoinActivity.start(requireContext())
}
}
}
} else {
if (AvRoomDataManager.get().isRoomOwner) {
gameBinding.tvFansTeamOpt.text = "开通粉丝团"
clickListener = View.OnClickListener {
CommonWebViewActivity.start(
requireContext(),
UriProvider.getFansTeamOpenUrl(AvRoomDataManager.get().roomUid)
)
}
} else {
gameBinding.tvFansTeamOpt.text = "该主播暂未开通粉丝团"
}
}
gameBinding.flFansTeam.setOnClickListener(clickListener)
updateFansTeamInfo(it)
}
}
}
private fun updateFansTeamInfo(initInfo: FansTeamInitInfo) {
var clickListener: View.OnClickListener? = null
if (!AvRoomDataManager.get().isRoomOwner && !initInfo.isAnchorFans && initInfo.hasFansTeamCurrentRoom) {
gameBinding.flFansTeamJoinTip.isVisible = true
gameBinding.tvFansTeamOpt.isVisible = false
} else {
gameBinding.flFansTeamJoinTip.isVisible = false
gameBinding.tvFansTeamOpt.isVisible = true
}
if (initInfo.hasFansTeamCurrentRoom) {
if (AvRoomDataManager.get().isRoomOwner) {
gameBinding.tvFansTeamOpt.text = "粉丝团(${initInfo.anchorFansNum})"
clickListener = View.OnClickListener {
CommonWebViewActivity.start(
requireContext(),
UriProvider.getFansTeamRankUrl(AvRoomDataManager.get().roomUid)
)
}
} else {
if (initInfo.isAnchorFans) {
gameBinding.tvFansTeamOpt.text = "粉丝LV.(${initInfo.fansLevelSeq})"
clickListener = View.OnClickListener {
FansTeamJoinedActivity.start(requireContext())
}
} else {
clickListener = View.OnClickListener {
FansTeamJoinActivity.start(requireContext())
}
}
}
} else {
if (AvRoomDataManager.get().isRoomOwner) {
gameBinding.tvFansTeamOpt.text = "开通粉丝团"
clickListener = View.OnClickListener {
CommonWebViewActivity.start(
requireContext(),
UriProvider.getFansTeamOpenUrl(AvRoomDataManager.get().roomUid)
)
}
} else {
gameBinding.tvFansTeamOpt.text = "该主播暂未开通粉丝团"
}
}
gameBinding.flFansTeam.setOnClickListener(clickListener)
}
override fun onReceiveRoomEvent(roomEvent: RoomEvent?) {
@@ -175,6 +180,28 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
showInviteDialog(it)
}
}
RoomEvent.FANS_TEAM_OPEN_SUCCESS,
RoomEvent.FANS_TEAM_OPEN_FAILED,
RoomEvent.FANS_TEAM_JOIN,
RoomEvent.FANS_TEAM_EXIT -> {
(roomEvent.chatRoomMessage?.attachment as? FansTeamMsgAttachment)?.fansTeamMsgInfo?.let {
val currFansTeamInitInfo = fansTeamViewModel.fansTeamInitInfoLiveData.value
updateFansTeamInfo(
FansTeamInitInfo(
it.count,
currFansTeamInitInfo?.fansLevelSeq ?: 0,
roomEvent.event != RoomEvent.FANS_TEAM_OPEN_FAILED,
if (AuthModel.get().currentUid == it.uid) {
roomEvent.event == RoomEvent.FANS_TEAM_JOIN
} else {
currFansTeamInitInfo?.isAnchorFans ?: false
},
AvRoomDataManager.get().isRoomOwner,
roomEvent.event == RoomEvent.FANS_TEAM_OPEN_FAILED
)
)
}
}
}
}

View File

@@ -26,6 +26,7 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import com.netease.nim.uikit.common.util.log.LogUtil;
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
import com.opensource.svgaplayer.SVGACallback;
import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView;
@@ -36,6 +37,7 @@ import com.yizhuan.erban.common.svga.SimpleSvgaParseCompletion;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.fansteam.FansTeamMsgInfo;
import com.yizhuan.xchat_android_core.gift.GiftModel;
import com.yizhuan.xchat_android_core.gift.bean.GiftEffectInfo;
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
@@ -44,6 +46,7 @@ import com.yizhuan.xchat_android_core.gift.bean.GiftReceiveInfo;
import com.yizhuan.xchat_android_core.gift.bean.GiftReceiver;
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagGifts;
import com.yizhuan.xchat_android_core.gift.bean.MultiGiftReceiveInfo;
import com.yizhuan.xchat_android_core.im.custom.bean.FansTeamMsgAttachment;
import com.yizhuan.xchat_android_core.magic.MagicModel;
import com.yizhuan.xchat_android_core.magic.ObjectPool;
import com.yizhuan.xchat_android_core.magic.bean.MagicInfo;
@@ -526,6 +529,42 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
}
}
public void onReceiveFansTeamOpenMsg(ChatRoomMessage message) {
if (message.getAttachment() instanceof FansTeamMsgAttachment) {
FansTeamMsgInfo msgInfo = ((FansTeamMsgAttachment) message.getAttachment()).getFansTeamMsgInfo();
if (msgInfo == null) return;
GiftInfo giftInfo = msgInfo.getGiftVo();
if (giftInfo == null) return;
SparseArray<Point> micViewPoint = AvRoomDataManager.get().mMicPointMap;
// 算出发送者和接受者的位置
int senderPosition = AvRoomDataManager.get().getMicPosition(msgInfo.getUid());
int receivePosition = AvRoomDataManager.get().getMicPosition(AvRoomDataManager.get().getRoomUid());
// 离开模式给房主送礼
if ((AvRoomDataManager.get().isLeaveMode() || AvRoomDataManager.get().isSingleRoom())) {
receivePosition = -1;
}
if (micViewPoint == null) {
//产生空的原因是麦位坐标初始化有500ms延迟
LogUtil.print("gift micViewPoint is null");
return;
}
Point senderPoint = micViewPoint.get(senderPosition);
Point receivePoint = micViewPoint.get(receivePosition);
if (receivePoint == null) {
//礼物送到上面中间的位置
receivePoint = new Point(UIUtil.getScreenWidth(context) / 2,
UIUtil.dip2px(context, 35));
}
drawGiftView(senderPoint, receivePoint, giftInfo);
}
}
private void drawGiftEffect(GiftEffectInfo giftEffectInfo) {
giftEffectInfoList.add(giftEffectInfo);
if (!giftEffectView.isAnim()) {
@@ -672,10 +711,6 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
}
private void drawGiftView(Point senderPoint, Point receivePoint, GiftReceiveInfo giftReceiveInfo) {
if (!AvRoomDataManager.get().mIsNeedGiftEffect ||
AvRoomDataManager.get().isSelfGamePlaying()) {
return;
}
if (giftReceiveInfo == null) {
return;
}
@@ -683,6 +718,17 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
if (giftInfo == null) {
return;
}
drawGiftView(senderPoint, receivePoint, giftInfo);
}
private void drawGiftView(Point senderPoint, Point receivePoint, GiftInfo giftInfo) {
if (!AvRoomDataManager.get().mIsNeedGiftEffect ||
AvRoomDataManager.get().isSelfGamePlaying()) {
return;
}
if (giftInfo == null) {
return;
}
final Point center = new Point();
center.x = context.getResources().getDisplayMetrics().widthPixels / 2;
center.y = context.getResources().getDisplayMetrics().heightPixels / 2;
@@ -715,6 +761,7 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
});
}
private Path getBezierCurvePath(Point sendPoint, Point receivePoint, boolean center) {
Point endPoint = new Point(receivePoint.x - sendPoint.x, receivePoint.y - sendPoint.y);
Point control = new Point(endPoint.x / 2, -(sendPoint.y + receivePoint.y) / 2 - new Random().nextInt(200));
@@ -762,6 +809,7 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
mSVGAVideoEntityMap.put(url, videoEntity);
}
private static class UiHandler extends Handler {
private WeakReference<GiftV2View> mReference;

View File

@@ -67,6 +67,7 @@ import com.yizhuan.xchat_android_constants.XChatConstants;
import com.yizhuan.xchat_android_core.Constants;
import com.yizhuan.xchat_android_core.bean.attachmsg.RoomQueueMsgAttachment;
import com.yizhuan.xchat_android_core.decoration.car.bean.CarInfo;
import com.yizhuan.xchat_android_core.fansteam.FansTeamMsgInfo;
import com.yizhuan.xchat_android_core.gift.GiftModel;
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
import com.yizhuan.xchat_android_core.gift.bean.GiftList;
@@ -81,6 +82,7 @@ import com.yizhuan.xchat_android_core.im.custom.bean.CarveUpGoldAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.DatingAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.FaceAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.FansTeamMsgAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.GiftAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.GiftBatchAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.JoinMiniWorldAttachment;
@@ -869,6 +871,8 @@ public class MessageView extends FrameLayout {
setTarotMsg(chatRoomMessage, tvContent);
} else if (first == CustomAttachment.CUSTOM_MSG_VIP) {
setVipMsg(chatRoomMessage, tvContent);
} else if (first == CustomAttachment.CUSTOM_MSG_FANS_TEAM) {
setFansTeamMsg(chatRoomMessage, tvContent);
} else {
tvContent.setTextColor(Color.WHITE);
tvContent.setText(tvContent.getResources().getText(R.string.not_support_message_tip));
@@ -881,6 +885,33 @@ public class MessageView extends FrameLayout {
}
}
@SuppressLint("CheckResult")
private void setFansTeamMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) {
if (chatRoomMessage.getAttachment() instanceof FansTeamMsgAttachment) {
FansTeamMsgAttachment fansTeamMsgAttachment = (FansTeamMsgAttachment) chatRoomMessage.getAttachment();
FansTeamMsgInfo msgInfo = fansTeamMsgAttachment.getFansTeamMsgInfo();
SpannableBuilder text = new SpannableBuilder(tvContent);
text.append("欢迎", new ForegroundColorSpan(whiteColor))
.append(msgInfo.getNickname(), new ForegroundColorSpan(roomTipNickColor),
new OriginalDrawStatusClickSpan() {
@Override
public void onClick(@NonNull View widget) {
if (clickConsumer != null) {
Single.just(String.valueOf(msgInfo.getUid())).subscribe(clickConsumer);
}
}
})
.append("加入粉丝团", new ForegroundColorSpan(whiteColor));
tvContent.setText(text.build());
tvContent.setOnClickListener(null);
tvContent.setMovementMethod(new LinkMovementMethod());
} else {
tvContent.setTextColor(Color.WHITE);
tvContent.setText(tvContent.getResources().getText(R.string.not_support_message_tip));
}
}
@SuppressLint("CheckResult")
private void setVipMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) {
if (chatRoomMessage.getAttachment() instanceof VipMessageAttachment) {

View File

@@ -195,104 +195,8 @@ import io.reactivex.schedulers.Schedulers;
import io.reactivex.subjects.PublishSubject;
import static com.yizhuan.xchat_android_constants.XChatConstants.SELECT_ANIM_DURATION;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.ANCHOR_ROOM_AUDIENCE_UPMIC;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_HEAD_CAR;
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_HEAD_ROOM_PK;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_CAR_ENTER_ROOM;
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_MESS_SUB_ROOM_PK_EMPTY;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_ROOM_PK_INVITE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_ROOM_PK_MODE_CLOSE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_ROOM_PK_MODE_OPEN;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_ROOM_PK_MODE_START;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_ROOM_PK_NON_EMPTY;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_ROOM_PK_RESULT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_ROOM_PK_RE_START;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_ROOM_WELCOME;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ASSISTANT_COMMON_MSG;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ASSISTANT_MSG;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_BOX;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_DATING;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_DATING_All;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_DRAGON_BAR;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_DRAGON_BAR_CANCEL;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_DRAGON_BAR_END;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_DRAGON_BAR_RUNAWAY;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_DRAGON_BAR_START;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_EXPER_LEVEL_UP_NOTICE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GAME;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_AUCTION;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_FACE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_GIFT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_KICK_MIC;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_MONSTER_HUNTING;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_MULTI_GIFT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_QUEUE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_QUEUE_INVITE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_QUEUE_KICK;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_SEND_MAGIC;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_KTV;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_ROOM_NOTIFY;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_QUEUING_MIC;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ROOM_PK;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_IN_ROOM;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ME;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_DATING_Al_NOTIFY;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_DATING_PUBLISH_HEART;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_DATING_PUBLISH_LIKE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_DATING_PUBLISH_RESULT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_DATING_SELECT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_KTV_ADD;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_KTV_CLOSE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_KTV_CONTINUE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_KTV_DELETE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_KTV_DELETE_USER_ALL;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_KTV_END;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_KTV_FINISH;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_KTV_OPEN;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_KTV_STOP;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_KTV_SWITCH;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_KTV_SWITCH_NO_SEND;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_KTV_TOP;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_QUEUING_MIC_EMPTY;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_QUEUING_MIC_FREE_MIC_CLOSE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_QUEUING_MIC_FREE_MIC_OPEN;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_QUEUING_MIC_MODE_CLOSE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_QUEUING_MIC_MODE_OPEN;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_QUEUING_MIC_NON_EMPTY;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ROOM_DIAMOND;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ROOM_MSG;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_ROOM_PK_ACCEPT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_ROOM_PK_FINISH;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_ROOM_PK_INVITE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_ROOM_PK_NOTIFY;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_ROOM_PK_REFUSE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_ROOM_PK_UPDATE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_MONSTER_HUNTING;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_ADD_BLACK;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_KICK_ROOM;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_MULTI_MAGIC;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_SINGLE_MAGIC;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO_AUDIO;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO_CLOSE_REDPACKAGE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO_CLOSE_SCREEN;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO_GIFT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_UPDATE_ROOM_INFO_NOTICE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP_ROOM_BROADCAST;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP_ROOM_OPEN;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP_ROOM_UPGRADE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP_ROOM_ALL_UPGRADE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_NOTI_SUB_GAME_ATTACK;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_NOTI_SUB_GAME_END;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_NOTI_SUB_GAME_RESULT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.*;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_FANS_TEAM_EXIT;
/**
* <p>云信聊天室管理一个全局的Model </p>
@@ -1340,15 +1244,34 @@ public final class IMNetEaseManager {
second == CUSTOM_MSG_VIP_ROOM_ALL_UPGRADE ||
second == CUSTOM_MSG_VIP_ROOM_OPEN) {
addMessages(msg);
}else if (second == CUSTOM_MSG_VIP_ROOM_BROADCAST){
} else if (second == CUSTOM_MSG_VIP_ROOM_BROADCAST) {
EventBus.getDefault().post(new VipBroadcastMsgEvent(msg));
}
break;
case ANCHOR_ROOM_AUDIENCE_UPMIC:
if(AvRoomDataManager.get().isRoomOwner()) {
if (AvRoomDataManager.get().isRoomOwner()) {
msg.setAttachment(attachment);
}
break;
case CUSTOM_MSG_FANS_TEAM:
switch (second) {
case CUSTOM_MSG_SUB_FANS_TEAM_OPEN:
noticeRoomEvent(msg, RoomEvent.FANS_TEAM_OPEN_SUCCESS);
break;
case CUSTOM_MSG_SUB_FANS_TEAM_OPEN_FAILED:
noticeRoomEvent(msg, RoomEvent.FANS_TEAM_OPEN_FAILED);
break;
case CUSTOM_MSG_SUB_FANS_TEAM_JOIN:
noticeRoomEvent(msg, RoomEvent.FANS_TEAM_JOIN);
addMessages(msg);
break;
case CUSTOM_MSG_SUB_FANS_TEAM_EXIT:
noticeRoomEvent(msg, RoomEvent.FANS_TEAM_EXIT);
break;
default:
break;
}
break;
default:
break;
}

View File

@@ -0,0 +1,10 @@
package com.yizhuan.xchat_android_core.fansteam
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo
data class FansTeamMsgInfo(
val uid: Long = 0,
val nickname: String = "",
val count: Int = 0,
val giftVo: GiftInfo? = null
)

View File

@@ -1,37 +1,5 @@
package com.yizhuan.xchat_android_core.im.custom.bean;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.netease.nimlib.sdk.msg.attachment.MsgAttachment;
import com.netease.nimlib.sdk.msg.attachment.MsgAttachmentParser;
import com.yizhuan.xchat_android_core.bean.attachmsg.RoomQueueMsgAttachment;
import com.yizhuan.xchat_android_core.community.attachment.DynamicSysAttachment;
import com.yizhuan.xchat_android_core.community.attachment.UnReadCountAttachment;
import com.yizhuan.xchat_android_core.community.im.WorldDynamicAttachment;
import com.yizhuan.xchat_android_core.im.custom.AttachManager;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringApprenticeMissionFourAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringApprenticeMissionOneAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringApprenticeMissionThreeAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringApprenticeMissionTwoAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringMasterMissionFourAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringMasterMissionOneAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringMasterMissionThreeAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringMasterMissionTwoAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringMissionTipsAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringSharingRoomAttachment;
import com.yizhuan.xchat_android_core.miniworld.bean.MWChatMemberCountAttachment;
import com.yizhuan.xchat_android_core.miniworld.bean.MWChatTopicAttachment;
import com.yizhuan.xchat_android_core.miniworld.bean.OpenAudioPartyAttachment;
import com.yizhuan.xchat_android_core.public_chat_hall.attachment.AitFriendsAttachment;
import com.yizhuan.xchat_android_core.public_chat_hall.attachment.AitMeAttachment;
import com.yizhuan.xchat_android_core.relation.cp.CpInviteInfo;
import com.yizhuan.xchat_android_core.room.bean.LeaveModeAttachment;
import com.yizhuan.xchat_android_core.room.pk.attachment.RoomPkAttachment;
import com.yizhuan.xchat_android_core.room.queuing_mic.attachment.QueuingMicAttachment;
import com.yizhuan.xchat_android_core.super_admin.attachment.SuperAdminOpAttachment;
import com.yizhuan.xchat_android_core.super_admin.util.SaMsgUtil;
import com.yizhuan.xchat_android_library.utils.log.MLog;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_DYNAMTC_BAN_DELETE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_DYNAMTC_PASS;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_DYNAMTC_UNREADCOUNT;
@@ -48,8 +16,6 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_DRAGON_BAR;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_EXPER_LEVEL_UP;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_EXPER_LEVEL_UP_NOTICE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GAME;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GAME_RESPOND;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GROUP_CHAT_MEMBER_COUNT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GROUP_CHAT_ROOM_NOTIFY;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GROUP_CHAT_TOPIC;
@@ -60,7 +26,6 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_SEND_MAGIC;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_SHARE_IN_APP;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEAD_SHIFT_OUT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_IM_GAME;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_IM_TIP;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_KTV;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LEAVE_MODE;
@@ -110,7 +75,37 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_NOTI_SUB_GAME_ATTACK;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_NOTI_SUB_GAME_RESULT;
import org.greenrobot.eventbus.EventBus;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.netease.nimlib.sdk.msg.attachment.MsgAttachment;
import com.netease.nimlib.sdk.msg.attachment.MsgAttachmentParser;
import com.yizhuan.xchat_android_core.bean.attachmsg.RoomQueueMsgAttachment;
import com.yizhuan.xchat_android_core.community.attachment.DynamicSysAttachment;
import com.yizhuan.xchat_android_core.community.attachment.UnReadCountAttachment;
import com.yizhuan.xchat_android_core.community.im.WorldDynamicAttachment;
import com.yizhuan.xchat_android_core.im.custom.AttachManager;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringApprenticeMissionFourAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringApprenticeMissionOneAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringApprenticeMissionThreeAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringApprenticeMissionTwoAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringMasterMissionFourAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringMasterMissionOneAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringMasterMissionThreeAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringMasterMissionTwoAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringMissionTipsAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringSharingRoomAttachment;
import com.yizhuan.xchat_android_core.miniworld.bean.MWChatMemberCountAttachment;
import com.yizhuan.xchat_android_core.miniworld.bean.MWChatTopicAttachment;
import com.yizhuan.xchat_android_core.miniworld.bean.OpenAudioPartyAttachment;
import com.yizhuan.xchat_android_core.public_chat_hall.attachment.AitFriendsAttachment;
import com.yizhuan.xchat_android_core.public_chat_hall.attachment.AitMeAttachment;
import com.yizhuan.xchat_android_core.room.bean.LeaveModeAttachment;
import com.yizhuan.xchat_android_core.room.pk.attachment.RoomPkAttachment;
import com.yizhuan.xchat_android_core.room.queuing_mic.attachment.QueuingMicAttachment;
import com.yizhuan.xchat_android_core.super_admin.attachment.SuperAdminOpAttachment;
import com.yizhuan.xchat_android_core.super_admin.util.SaMsgUtil;
import com.yizhuan.xchat_android_core.utils.LogUtils;
import com.yizhuan.xchat_android_library.utils.log.MLog;
/**
* 云信自定义消息解析器
@@ -562,11 +557,14 @@ public class CustomAttachParser implements MsgAttachmentParser {
case CustomAttachment.SKILL_MSG_AUDIO:
attachment = new SkillMsgAttachment(second);
break;
case CustomAttachment.CP_INVITE_MESSAGE:
attachment = new CpInviteAttachment(CustomAttachment.CP_INVITE_MESSAGE_TOP_NOTICE);
break;
case CustomAttachment.CUSTOM_MSG_FANS_TEAM:
attachment = new FansTeamMsgAttachment(second);
break;
default:
LogUtils.e("未定义的first,请现在CustomAttachParser中解析");
break;
}
JSONObject data = object.getJSONObject("data");

View File

@@ -433,6 +433,12 @@ public class CustomAttachment implements MsgAttachment {
public static final int CP_INVITE_MESSAGE = 88;
public static final int CP_INVITE_MESSAGE_TOP_NOTICE = 881;
public static final int CUSTOM_MSG_FANS_TEAM = 90;
public static final int CUSTOM_MSG_SUB_FANS_TEAM_OPEN = 901; //开通粉丝团
public static final int CUSTOM_MSG_SUB_FANS_TEAM_OPEN_FAILED = 902; // 开通粉丝团失败
public static final int CUSTOM_MSG_SUB_FANS_TEAM_JOIN = 903; // 加入粉丝团
public static final int CUSTOM_MSG_SUB_FANS_TEAM_EXIT = 904; // 退出粉丝团
public CustomAttachment() {
}

View File

@@ -0,0 +1,32 @@
package com.yizhuan.xchat_android_core.im.custom.bean;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.yizhuan.xchat_android_core.fansteam.FansTeamMsgInfo;
public class FansTeamMsgAttachment extends CustomAttachment {
private FansTeamMsgInfo fansTeamMsgInfo;
public FansTeamMsgAttachment(int second) {
super(CUSTOM_MSG_FANS_TEAM, second);
}
public FansTeamMsgInfo getFansTeamMsgInfo() {
return fansTeamMsgInfo;
}
public void setFansTeamMsgInfo(FansTeamMsgInfo fansTeamMsgInfo) {
this.fansTeamMsgInfo = fansTeamMsgInfo;
}
@Override
protected void parseData(JSONObject data) {
fansTeamMsgInfo = new Gson().fromJson(data.toJSONString(), FansTeamMsgInfo.class);
}
@Override
protected JSONObject packData() {
return null;
}
}

View File

@@ -221,6 +221,11 @@ public class RoomEvent {
*/
public static final int REQUEST_UP_MIC = 83;
public static final int FANS_TEAM_OPEN_SUCCESS = 84;
public static final int FANS_TEAM_OPEN_FAILED = 85;
public static final int FANS_TEAM_JOIN = 86;
public static final int FANS_TEAM_EXIT = 87;
private int event = NONE;
private int micPosition = Integer.MIN_VALUE;
private int posState = -1;