踢出房间限制进房bugfix
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -307,7 +307,7 @@ public class DemoCache {
|
||||
|
||||
@Nullable
|
||||
public static Map<String, Long> readKickOutRoom() {
|
||||
String string = SettingsPref.instance().getString(KEY_KICK_OUT_ROOM, null);
|
||||
String string = SettingsPref.instance().getString(KEY_KICK_OUT_ROOM + AuthModel.get().getCurrentUid(), null);
|
||||
if (TextUtils.isEmpty(string)) return null;
|
||||
return new Gson().fromJson(string,
|
||||
new TypeToken<Map<String, Long>>() {
|
||||
@@ -323,7 +323,7 @@ public class DemoCache {
|
||||
}
|
||||
}
|
||||
map.put(roomUid, CurrentTimeUtils.getCurrentTime());
|
||||
SettingsPref.instance().putString(KEY_KICK_OUT_ROOM, new Gson().toJson(map));
|
||||
SettingsPref.instance().putString(KEY_KICK_OUT_ROOM + AuthModel.get().getCurrentUid(), new Gson().toJson(map));
|
||||
}
|
||||
|
||||
|
||||
|
@@ -229,8 +229,6 @@ public final class AvRoomDataManager {
|
||||
dragons = new ArrayList<>();
|
||||
mHeadWearMap = new HashMap<>();
|
||||
observerChatRoomMessage();
|
||||
kickOutRoomUids = DemoCache.readKickOutRoom();
|
||||
if (kickOutRoomUids == null) kickOutRoomUids = new HashMap<>();
|
||||
}
|
||||
|
||||
public static AvRoomDataManager get() {
|
||||
@@ -248,6 +246,10 @@ public final class AvRoomDataManager {
|
||||
if (UserModel.get().getCacheLoginUserInfo() != null) {
|
||||
UserModel.get().getCacheLoginUserInfo().setGameStatus(GameStatus.STATUS_NOT_JOIN);
|
||||
}
|
||||
if (kickOutRoomUids != null) {
|
||||
kickOutRoomUids.clear();
|
||||
kickOutRoomUids = null;
|
||||
}
|
||||
LogUtils.d("---------清除AvRoomDataManager数据完成---------");
|
||||
}
|
||||
|
||||
@@ -1303,17 +1305,28 @@ public final class AvRoomDataManager {
|
||||
}
|
||||
|
||||
public boolean isLimitEnterRoom(String roomUid) {
|
||||
initKickOutRoomUids();
|
||||
Long limitTime = kickOutRoomUids.get(roomUid);
|
||||
return limitTime != null && CurrentTimeUtils.getCurrentTime() - limitTime < XChatConstants.KICK_OUT_ROOM_LIMIT_ENTER_TIME;
|
||||
}
|
||||
|
||||
public void addCurrentRoomLimitEnter() {
|
||||
if (mCurrentRoomInfo == null) return;
|
||||
initKickOutRoomUids();
|
||||
String roomUid = String.valueOf(getRoomUid());
|
||||
kickOutRoomUids.put(roomUid, CurrentTimeUtils.getCurrentTime());
|
||||
DemoCache.saveKickOutRoom(roomUid);
|
||||
}
|
||||
|
||||
private void initKickOutRoomUids() {
|
||||
if (kickOutRoomUids == null) {
|
||||
kickOutRoomUids = DemoCache.readKickOutRoom();
|
||||
}
|
||||
if (kickOutRoomUids == null) {
|
||||
kickOutRoomUids = new HashMap<>();
|
||||
}
|
||||
}
|
||||
|
||||
private static final class Helper {
|
||||
private static final AvRoomDataManager INSTANCE = new AvRoomDataManager();
|
||||
}
|
||||
|
Reference in New Issue
Block a user