|
|
|
@@ -5,8 +5,16 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
|
|
|
|
|
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_MSG_ALL_SERVICE_GIFT;
|
|
|
|
|
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_FAIRY;
|
|
|
|
|
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_LUCKY_GIFT;
|
|
|
|
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL;
|
|
|
|
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_SEA;
|
|
|
|
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL;
|
|
|
|
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_RED_PACKAGE;
|
|
|
|
|
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_DRAW_GIFT_L5;
|
|
|
|
|
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ALL_DIAMOND;
|
|
|
|
|
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_USER_ALL_UPGRADE;
|
|
|
|
@@ -45,6 +53,8 @@ import com.google.gson.Gson;
|
|
|
|
|
import com.netease.nim.uikit.common.util.log.LogUtil;
|
|
|
|
|
import com.netease.nimlib.sdk.NIMSDK;
|
|
|
|
|
import com.netease.nimlib.sdk.Observer;
|
|
|
|
|
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
|
|
|
|
|
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
|
|
|
|
import com.netease.nimlib.sdk.msg.model.BroadcastMessage;
|
|
|
|
|
import com.orhanobut.logger.Logger;
|
|
|
|
|
import com.readystatesoftware.systembartint.SystemBarTintManager;
|
|
|
|
@@ -87,7 +97,15 @@ import com.yizhuan.tutu.mentoring_relationship.dialog.GrabApprenticesNoticeDialo
|
|
|
|
|
import com.yizhuan.xchat_android_constants.XChatConstants;
|
|
|
|
|
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.bean.BaseProtocol;
|
|
|
|
|
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagNoticeInfo;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.FairyMsgAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeInfo;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.RoomLuckySeaAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.RoomLuckySeaMsgBean;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.RoomReceivedLuckyGiftAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
|
|
|
|
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
|
|
|
|
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
|
|
|
@@ -102,6 +120,7 @@ import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
|
|
|
|
|
import com.yizhuan.xchat_android_core.redpackage.RedPackageNotifyInfo;
|
|
|
|
|
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
|
|
|
|
import com.yizhuan.xchat_android_core.room.model.AvRoomModel;
|
|
|
|
|
import com.yizhuan.xchat_android_core.treasurefairy.FairyMsgInfo;
|
|
|
|
|
import com.yizhuan.xchat_android_core.user.UserModel;
|
|
|
|
|
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
|
|
|
|
import com.yizhuan.xchat_android_core.vip.VipMessageInfo;
|
|
|
|
@@ -127,6 +146,7 @@ import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.LinkedList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
import io.reactivex.Observable;
|
|
|
|
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
|
@@ -937,6 +957,14 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
|
|
|
|
AllServiceGiftProtocol.DataBean data = JSON.parseObject(String.valueOf(baseProtocol.getData()), AllServiceGiftProtocol.DataBean.class);
|
|
|
|
|
if (data == null || data.getGiftUrl() == null) return;
|
|
|
|
|
giftList.add(data);
|
|
|
|
|
// Comparator<AllServiceGiftProtocol.DataBean> comparator = new Comparator<AllServiceGiftProtocol.DataBean>() {
|
|
|
|
|
// @Override
|
|
|
|
|
// public int compare(AllServiceGiftProtocol.DataBean s1, AllServiceGiftProtocol.DataBean s2) {
|
|
|
|
|
// return JavaUtil.str2int(s1.getLevelNum()) - JavaUtil.str2int(s2.getLevelNum());
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
// //这里就会自动根据规则进行排序
|
|
|
|
|
// Collections.sort(giftList, comparator);
|
|
|
|
|
if (second2 == CUSTOM_MSG_ALL_SERVICE_GIFT) {
|
|
|
|
|
if (giftDialog != null && giftDialog.isShowing()) {
|
|
|
|
|
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
|
|
|
|
@@ -951,6 +979,71 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CUSTOM_MSG_BOX://寻爱之旅
|
|
|
|
|
if (!isValid()) return;
|
|
|
|
|
if (this instanceof AddUserInfoActivity || UserUtils.getUserInfo() == null)
|
|
|
|
|
return;
|
|
|
|
|
if (baseProtocol.getSecond() == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA) {
|
|
|
|
|
RoomBoxPrizeAttachment roomBoxPrizeAttachment = new RoomBoxPrizeAttachment(CUSTOM_MSG_BOX, CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA);
|
|
|
|
|
RoomBoxPrizeInfo roomBoxPrizeBean = JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomBoxPrizeInfo.class);
|
|
|
|
|
roomBoxPrizeAttachment.setUid(roomBoxPrizeBean.getUid());
|
|
|
|
|
roomBoxPrizeAttachment.setPrizeName(roomBoxPrizeBean.getPrizeName());
|
|
|
|
|
roomBoxPrizeAttachment.setNick(roomBoxPrizeBean.getNick());
|
|
|
|
|
roomBoxPrizeAttachment.setBoxTypeStr(roomBoxPrizeBean.getBoxTypeStr());
|
|
|
|
|
roomBoxPrizeAttachment.setRoomUid(roomBoxPrizeBean.getRoomUid());
|
|
|
|
|
roomBoxPrizeAttachment.setPrizeNum(roomBoxPrizeBean.getPrizeNum());
|
|
|
|
|
roomBoxPrizeAttachment.setUserLevelLimit(roomBoxPrizeBean.getUserLevelLimit());
|
|
|
|
|
if (AvRoomDataManager.get().isOpenPureMode()) {
|
|
|
|
|
// 純凈模式打開後,僅能看跟自己相關的砸蛋消息
|
|
|
|
|
if (Objects.equals(roomBoxPrizeAttachment.getUid(), AuthModel.get().getCurrentUid())) {
|
|
|
|
|
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), roomBoxPrizeAttachment);
|
|
|
|
|
IMNetEaseManager.get().addMessages(message);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), roomBoxPrizeAttachment);
|
|
|
|
|
IMNetEaseManager.get().addMessages(message);
|
|
|
|
|
IMNetEaseManager.get().getChatRoomEventObservable()
|
|
|
|
|
.onNext(new RoomEvent()
|
|
|
|
|
.setEvent(RoomEvent.BOX_NOTIFY_SVGA)
|
|
|
|
|
.setChatRoomMessage(message));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CUSTOM_MSG_LUCKY_SEA://星级厨房
|
|
|
|
|
if (!isValid()) return;
|
|
|
|
|
if (this instanceof AddUserInfoActivity || UserUtils.getUserInfo() == null)
|
|
|
|
|
return;
|
|
|
|
|
if (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL) {
|
|
|
|
|
RoomLuckySeaAttachment attachment = new RoomLuckySeaAttachment(CUSTOM_MSG_LUCKY_SEA, CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL);
|
|
|
|
|
attachment.setRoomLuckySeaMsgBean(JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomLuckySeaMsgBean.class));
|
|
|
|
|
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), attachment);
|
|
|
|
|
IMNetEaseManager.get().addMessages(message);
|
|
|
|
|
IMNetEaseManager.get().noticeRoomEvent(message, RoomEvent.LUCKY_SEA_GIFT_SERVER_NOTIFY);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CUSTOM_MSG_LUCKY_GIFT://福袋
|
|
|
|
|
if (!isValid()) return;
|
|
|
|
|
if (this instanceof AddUserInfoActivity || UserUtils.getUserInfo() == null)
|
|
|
|
|
return;
|
|
|
|
|
if (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL) {
|
|
|
|
|
RoomReceivedLuckyGiftAttachment attachment = new RoomReceivedLuckyGiftAttachment(CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL);
|
|
|
|
|
attachment.setLuckyBagNoticeInfo(JSON.parseObject(String.valueOf(baseProtocol.getData()), LuckyBagNoticeInfo.class));
|
|
|
|
|
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), attachment);
|
|
|
|
|
IMNetEaseManager.get().noticeServiceLuckyBagNotice(message);
|
|
|
|
|
IMNetEaseManager.get().addMessages(message);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CUSTOM_MSG_FAIRY://夺宝精灵
|
|
|
|
|
if (!isValid()) return;
|
|
|
|
|
if (this instanceof AddUserInfoActivity || UserUtils.getUserInfo() == null)
|
|
|
|
|
return;
|
|
|
|
|
if (baseProtocol.getSecond() == CUSTOM_MSG_SUB_DRAW_GIFT_L5) {
|
|
|
|
|
FairyMsgAttachment attachment = new FairyMsgAttachment(CUSTOM_MSG_FAIRY, CUSTOM_MSG_SUB_DRAW_GIFT_L5);
|
|
|
|
|
attachment.setFairyMsgInfo(JSON.parseObject(String.valueOf(baseProtocol.getData()), FairyMsgInfo.class));
|
|
|
|
|
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), attachment);
|
|
|
|
|
IMNetEaseManager.get().noticeRoomEvent(message, RoomEvent.FAIRY_DRAW_GIFT_L5);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|