新增开箱子五级礼物SVGA横幅

This commit is contained in:
huangjian
2020-12-10 15:26:02 +08:00
parent e302e0a007
commit 991263da91
13 changed files with 243 additions and 266 deletions

View File

@@ -231,6 +231,7 @@ 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_QUEUING_MIC;
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_KTV_ADD;
@@ -312,40 +313,39 @@ public final class IMNetEaseManager {
/**
* 注册消息过滤器
*
*/
private void registerMessageFilter() {
NIMClient.getService(MsgService.class)
.registerIMMessageFilter(message -> {
if (message.getMsgType() == MsgTypeEnum.custom) {
CustomAttachment customAttachment = (CustomAttachment) message.getAttachment();
if (customAttachment != null){
switch (customAttachment.getFirst()) {
case CustomAttachment.CUSTOM_MSG_HEADER_TYPE_LUCKY_MONEY:
switch (customAttachment.getSecond()) {
case CustomAttachment.CUSTOM_MSG_SUB_TYPE_RECEIVE_LUCKY_MONEY:
LuckyMoneyTipsAttachment luckyMoneyAttachment = (LuckyMoneyTipsAttachment) message.getAttachment();
LuckyMoneyInfo luckyMoneyInfo = luckyMoneyAttachment.getLuckyMoneyInfo();
String uid = String.valueOf(AuthModel.get().getCurrentUid());
// 你领取了某人的红包 || 某人领取了你的红包
if (!(Objects.equals(uid, String.valueOf(luckyMoneyInfo.getReceiveUid())) ||
Objects.equals(uid, String.valueOf(luckyMoneyInfo.getSenderUid())))) {
Log.e(TAG, "registerMessageFilter: CUSTOM_MSG_SUB_TYPE_RECEIVE_LUCKY_MONEY");
return true;
}
break;
}
break;
if (customAttachment != null) {
switch (customAttachment.getFirst()) {
case CustomAttachment.CUSTOM_MSG_HEADER_TYPE_LUCKY_MONEY:
switch (customAttachment.getSecond()) {
case CustomAttachment.CUSTOM_MSG_SUB_TYPE_RECEIVE_LUCKY_MONEY:
LuckyMoneyTipsAttachment luckyMoneyAttachment = (LuckyMoneyTipsAttachment) message.getAttachment();
LuckyMoneyInfo luckyMoneyInfo = luckyMoneyAttachment.getLuckyMoneyInfo();
String uid = String.valueOf(AuthModel.get().getCurrentUid());
// 你领取了某人的红包 || 某人领取了你的红包
if (!(Objects.equals(uid, String.valueOf(luckyMoneyInfo.getReceiveUid())) ||
Objects.equals(uid, String.valueOf(luckyMoneyInfo.getSenderUid())))) {
Log.e(TAG, "registerMessageFilter: CUSTOM_MSG_SUB_TYPE_RECEIVE_LUCKY_MONEY");
return true;
}
break;
}
break;
//邀请粉丝
case CustomAttachment.CUSTOM_MSG_PUSH_NOTIFIFICATION:
switch (customAttachment.getSecond()){
case CustomAttachment.CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_ROOM:
Log.e(TAG, "registerMessageFilter: CUSTOM_MSG_PUSH_NOTIFIFICATION");
return true;
}
break;
}
//邀请粉丝
case CustomAttachment.CUSTOM_MSG_PUSH_NOTIFIFICATION:
switch (customAttachment.getSecond()) {
case CustomAttachment.CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_ROOM:
Log.e(TAG, "registerMessageFilter: CUSTOM_MSG_PUSH_NOTIFIFICATION");
return true;
}
break;
}
}
} else if (message.getMsgType() == MsgTypeEnum.notification) {
NotificationAttachment notificationAttachment = (NotificationAttachment) message.getAttachment();
@@ -421,7 +421,7 @@ public final class IMNetEaseManager {
}
public Map<String, Object> toMap(Map<String, Object> map, String namePlateWord,String namePlatePic) {
public Map<String, Object> toMap(Map<String, Object> map, String namePlateWord, String namePlatePic) {
if (map == null) {
map = new HashMap<>();
}
@@ -467,7 +467,7 @@ public final class IMNetEaseManager {
valueMap = headWearInfo.toMap(valueMap);
}
valueMap = toMap(valueMap,userInfo.getNameplateWord(),userInfo.getNameplatePic());
valueMap = toMap(valueMap, userInfo.getNameplateWord(), userInfo.getNameplatePic());
if (valueMap != null && valueMap.size() > 0) {
map.put(String.valueOf(userInfo.getUid()), valueMap);
@@ -670,7 +670,7 @@ public final class IMNetEaseManager {
if (ListUtils.isListEmpty(targets)) {
return;
}
chatRoomMemberIn(targets.get(0),msg);
chatRoomMemberIn(targets.get(0), msg);
//如果是自己进房,立即刷新一次超管缓存
if (UserModel.get().isMyseft(targets.get(0))) {
SuperAdminDataMrg.get().firstInitList();
@@ -817,7 +817,7 @@ public final class IMNetEaseManager {
face = true;
break;
case CUSTOM_MSG_HEADER_TYPE_GIFT:
if (customAttachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_GIFT){
if (customAttachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_GIFT) {
GiftAttachment giftAttachment = (GiftAttachment) attachment;
GiftInfo giftInfo = giftAttachment.getGiftReceiveInfo().getGift();
// 兼容旧版发过来的giftAttachment没有发送giftInfo的问题
@@ -827,7 +827,7 @@ public final class IMNetEaseManager {
GiftModel.get().addNewGift(giftInfo);
messages.add(msg);
gift = true;
}else if (customAttachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_LUCKY_GIFT){
} else if (customAttachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_LUCKY_GIFT) {
MultiLuckyGiftAttachment luckyGiftAttachment = (MultiLuckyGiftAttachment) attachment;
GiftModel.get().addNewGift(luckyGiftAttachment.getMultiLuckyGiftReceiveInfo().getDisplayGift().get(0));
messages.add(msg);
@@ -850,12 +850,12 @@ public final class IMNetEaseManager {
GiftModel.get().addNewGift(giftBatchAttachment.getGiftMultiReceiverInfo().getGift());
messages.add(msg);
gift = true;
} else if (customAttachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_ALL_MIC_LUCKY_GIFT){
} else if (customAttachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_ALL_MIC_LUCKY_GIFT) {
MultiLuckyGiftAttachment luckyGiftAttachment = (MultiLuckyGiftAttachment) attachment;
GiftModel.get().addNewGift(luckyGiftAttachment.getMultiLuckyGiftReceiveInfo().getDisplayGift().get(0));
messages.add(msg);
gift = true;
} else if (customAttachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_MULTI_LUCK_GIFT){
} else if (customAttachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_MULTI_LUCK_GIFT) {
MultiLuckyGiftAttachment luckyGiftAttachment = (MultiLuckyGiftAttachment) attachment;
GiftModel.get().addNewGift(luckyGiftAttachment.getMultiLuckyGiftReceiveInfo().getDisplayGift().get(0));
messages.add(msg);
@@ -985,6 +985,7 @@ public final class IMNetEaseManager {
}
break;
case CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY:
case CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA:
if (AvRoomDataManager.get().isOpenPureMode()) {
// 纯净模式打开后,仅能看跟自己相关的砸蛋消息
RoomBoxPrizeAttachment roomBoxPrizeAttachment = (RoomBoxPrizeAttachment) msg.getAttachment();
@@ -993,7 +994,7 @@ public final class IMNetEaseManager {
}
} else {
addMessages(msg);
noticeBox(msg);
noticeBox(msg, second);
}
break;
}
@@ -1265,7 +1266,7 @@ public final class IMNetEaseManager {
break;
case CustomAttachment.CUSTOM_MSG_LEVEL_UP:
switch (second){
switch (second) {
case CUSTOM_MSG_EXPER_LEVEL_UP_NOTICE:
noticeExperLevelUpNotice(msg);
break;
@@ -1433,7 +1434,7 @@ public final class IMNetEaseManager {
chatRoomMember.setAvatar((String) extensionDataMap.get("avatar"));
}
int experLevelSeq = 0;
int experLevelSeq = 0;
if (extensionDataMap.containsKey("experLevelSeq")) {
experLevelSeq = (int) extensionDataMap.get("experLevelSeq");
}
@@ -1726,7 +1727,6 @@ public final class IMNetEaseManager {
}
/**
* 添加消息到公屏
*
@@ -1758,7 +1758,7 @@ public final class IMNetEaseManager {
noticeReceiverMessage(msg);
}
public void addOpenRedPackageSwitch(ChatRoomMessage msg){
public void addOpenRedPackageSwitch(ChatRoomMessage msg) {
noticeReceiverMessage(msg);
}
@@ -2597,7 +2597,6 @@ public final class IMNetEaseManager {
}
/************************云信聊天室 房主/管理员操作 end******************************/
/**
@@ -3119,7 +3118,7 @@ public final class IMNetEaseManager {
/**
* 更新系统消息到本地数据库
*
* @param uuid 消息 UUID
* @param uuid 消息 UUID
* @param sysMsgV2Info 系统消息实体
*/
public void updateErbanSysMsgV2InfoMessage(String uuid, ErbanSysMsgV2Info sysMsgV2Info) {
@@ -3345,10 +3344,11 @@ public final class IMNetEaseManager {
.setChatRoomMessage(msg));
}
private void noticeBox(ChatRoomMessage msg) {
private void noticeBox(ChatRoomMessage msg, int second) {
int event = second == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY ? RoomEvent.BOX_NOTIFY : RoomEvent.BOX_NOTIFY_SVGA;
getChatRoomEventObservable()
.onNext(new RoomEvent()
.setEvent(RoomEvent.BOX_NOTIFY)
.setEvent(event)
.setChatRoomMessage(msg));
}

View File

@@ -156,6 +156,7 @@ public class CustomAttachment implements MsgAttachment {
public static final int CUSTOM_MSG_SUB_BOX_IN_ROOM = 262;//当前房间可见
public static final int CUSTOM_MSG_SUB_BOX_ALL_ROOM = 263;//所有房间可见
public static final int CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY = 264;//所有房间可见+小秘书
public static final int CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA = 265;//所有房间可见+小秘书+高大上的SVGA
//KTV
public static final int CUSTOM_MSG_KTV = 27;

View File

@@ -203,6 +203,9 @@ public class RoomEvent {
/** */
public static final int RECEIVE_EXPER_LEVEL_UP_NOTICE = 68;
//开宝箱横幅,SVGA背景的
public static final int BOX_NOTIFY_SVGA = 69;
private int event = NONE;
private int micPosition = Integer.MIN_VALUE;
private int posState = -1;