1:修改在线用户展示
2:修改最小化进入房间更新数据
This commit is contained in:
@@ -94,20 +94,23 @@ public class RoomManager {
|
||||
if (CommonAppContext.getInstance().playId == null) {
|
||||
fetchAndJoinRoom(context, roomId, password, taskId);
|
||||
} else {
|
||||
if (!CommonAppContext.getInstance().playId.equals(roomId)) {
|
||||
if (!CommonAppContext.getInstance().playId.equals(roomId)) {//这是判断点击的和存储的roomId是否相同,不相同就退出记录的id,然后加入新的roomId
|
||||
MessageListenerSingleton.getInstance().joinGroup(roomId);
|
||||
exitRoom(CommonAppContext.getInstance().playId);
|
||||
CommonAppContext.getInstance().isShow = false;
|
||||
CommonAppContext.getInstance().isPlaying = false;
|
||||
CommonAppContext.getInstance().isRoomJoininj = false;
|
||||
EventBus.getDefault().post(new RoomOutEvent());
|
||||
|
||||
//2025年12月9日17:39:21 修改,将获取在线用户判断是否在房间进行关闭,原因是:服务端不在踢人了,所以点击最小化的时候,就直接走room_info接口
|
||||
upInfo(context, roomId, password, false, roomInfo, true, taskId);
|
||||
return;
|
||||
// fetchAndJoinRoom(context, roomId, password, taskId);
|
||||
// return;
|
||||
} else if (CommonAppContext.getInstance().lable_id.equals("6")) {
|
||||
} else if (CommonAppContext.getInstance().lable_id.equals("6")) {//这是判断是否是小黑屋,是小黑屋进行更新,走room_info接口
|
||||
upInfo(context, roomId, password, true, roomInfo, true, taskId);
|
||||
return;
|
||||
}
|
||||
//这里是点击的roomId和存错的id是同一个的时候,就走的是更新,roomInfo接口
|
||||
isUserOnline(context, roomId, password, roomInfo, taskId);
|
||||
}
|
||||
}
|
||||
@@ -293,47 +296,48 @@ public class RoomManager {
|
||||
// 可以通过检查Agora是否还在房间中,或者通过服务端接口查询用户状态等方式实现
|
||||
// 目前返回false,需要根据实际需求实现具体逻辑
|
||||
|
||||
final boolean[] isOnline = {false};
|
||||
RetrofitClient.getInstance().getRoomOnline(roomId, "1", "50", new BaseObserver<RoomOnline>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(RoomOnline roomOnline) {
|
||||
try {
|
||||
if (roomOnline != null) {
|
||||
if (roomOnline.getOn_pit() != null) {
|
||||
for (RoomOnlineBean roomOnlineBean : roomOnline.getOn_pit()) {
|
||||
if (roomOnlineBean.getUser_id() == SpUtil.getUserId()) {
|
||||
isOnline[0] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (roomOnline.getOff_pit() != null) {
|
||||
for (RoomOnlineBean roomOnlineBean : roomOnline.getOff_pit()) {
|
||||
if (roomOnlineBean.getUser_id() == SpUtil.getUserId()) {
|
||||
isOnline[0] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
upInfo(context, roomId, password, isOnline[0], roomInfo, true, taskId);
|
||||
|
||||
} else {
|
||||
isOnline[0] = false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 捕获所有可能的异常,避免崩溃
|
||||
e.printStackTrace();
|
||||
isOnline[0] = false;
|
||||
// 即使出现异常也继续执行
|
||||
upInfo(context, roomId, password, isOnline[0], roomInfo, true, taskId);
|
||||
}
|
||||
}
|
||||
});
|
||||
// final boolean[] isOnline = {false};
|
||||
// RetrofitClient.getInstance().getRoomOnline(roomId, "1", "50", new BaseObserver<RoomOnline>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(RoomOnline roomOnline) {
|
||||
// try {
|
||||
// if (roomOnline != null) {
|
||||
// if (roomOnline.getOn_pit() != null) {
|
||||
// for (RoomOnlineBean roomOnlineBean : roomOnline.getOn_pit()) {
|
||||
// if (roomOnlineBean.getUser_id() == SpUtil.getUserId()) {
|
||||
// isOnline[0] = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (roomOnline.getOff_pit() != null) {
|
||||
// for (RoomOnlineBean roomOnlineBean : roomOnline.getOff_pit()) {
|
||||
// if (roomOnlineBean.getUser_id() == SpUtil.getUserId()) {
|
||||
// isOnline[0] = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// upInfo(context, roomId, password, isOnline[0], roomInfo, true, taskId);
|
||||
//
|
||||
// } else {
|
||||
// isOnline[0] = false;
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// // 捕获所有可能的异常,避免崩溃
|
||||
// e.printStackTrace();
|
||||
// isOnline[0] = false;
|
||||
// // 即使出现异常也继续执行
|
||||
// upInfo(context, roomId, password, isOnline[0], roomInfo, true, taskId);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
upInfo(context, roomId, password, true, roomInfo, true, taskId);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user