用户断网重连处理逻辑优化

This commit is contained in:
huangjian
2021-01-26 10:49:23 +08:00
parent e225881602
commit d7087a1779

View File

@@ -30,6 +30,7 @@ import com.netease.nimlib.sdk.chatroom.model.ChatRoomMemberUpdate;
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessageExtension;
import com.netease.nimlib.sdk.chatroom.model.ChatRoomNotificationAttachment;
import com.netease.nimlib.sdk.chatroom.model.ChatRoomPartClearAttachment;
import com.netease.nimlib.sdk.chatroom.model.ChatRoomQueueChangeAttachment;
import com.netease.nimlib.sdk.chatroom.model.ChatRoomStatusChangeData;
import com.netease.nimlib.sdk.chatroom.model.MemberOption;
@@ -671,6 +672,8 @@ public final class IMNetEaseManager {
if (attachment == null) continue;
if (attachment.getType() == NotificationType.ChatRoomQueueChange) {
chatRoomQueueChangeNotice(msg);
} else if (attachment.getType() == NotificationType.ChatRoomQueueBatchChange) {
chatRoomQueueBatchChange(msg);
} else if (attachment.getType() == NotificationType.ChatRoomInfoUpdated) {
//房间信息更新
chatRoomInfoUpdate(msg);
@@ -1510,26 +1513,11 @@ public final class IMNetEaseManager {
noticeRoomMemberChange(false, account);
RoomInfo mCurrentRoomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
if (mCurrentRoomInfo == null) return;
if (AvRoomDataManager.get().isOnMic(Long.valueOf(account))) {
//在麦上的要退出麦,这里云信已经在队列上清理了,这边不需要调用,改别人的麦信息
SparseArray<RoomQueueInfo> mMicQueueMemberMap = AvRoomDataManager.get().mMicQueueMemberMap;
int size = mMicQueueMemberMap.size();
for (int i = 0; i < size; i++) {
RoomQueueInfo roomQueueInfo = mMicQueueMemberMap.valueAt(i);
if (roomQueueInfo.mChatRoomMember != null
&& Objects.equals(roomQueueInfo.mChatRoomMember.getAccount(), account)) {
roomQueueInfo.mChatRoomMember = null;
noticeDownMic(String.valueOf(mMicQueueMemberMap.keyAt(i)), account);
break;
}
}
}
ChatRoomMember removeChatMember = null;
boolean isAdmin = false;
ListIterator<ChatRoomMember> iterator = AvRoomDataManager.get().mRoomAllMemberList.listIterator();
for (; iterator.hasNext(); ) {
while (iterator.hasNext()) {
removeChatMember = iterator.next();
if (Objects.equals(removeChatMember.getAccount(), account)) {
if (removeChatMember.getMemberType() == MemberType.ADMIN) {
@@ -1544,7 +1532,6 @@ public final class IMNetEaseManager {
// 这里要清理调退出房间的PK 队员
PkModel.get().onTeamMemberExitRoom(account);
noticePKInfo();
}
/**
@@ -1679,6 +1666,24 @@ public final class IMNetEaseManager {
}
}
/**
* 在麦位的用户退出房间处理退出房间
* 标题:关于聊天室队列变更通知的特别说明
* 链接https://faq.yunxin.163.com/#KB0361
*/
private void chatRoomQueueBatchChange(ChatRoomMessage msg) {
if (msg.getAttachment() instanceof ChatRoomPartClearAttachment) {
ChatRoomPartClearAttachment clearAttachment = (ChatRoomPartClearAttachment) msg.getAttachment();
Map<String, String> contentMap = clearAttachment.getContentMap();
if (contentMap != null) {
//LogUtils.d(Arrays.toString(clearAttachment.getContentMap().entrySet().toArray()));
for (String key : contentMap.keySet()) {
downMicroQueue(key);
}
}
}
}
/**
* 进入聊天室
*/