Commit 181ebe40 by Lee Munkyeong

ルーム情報更新前にデータクリア

parent ca1b03fd
......@@ -50,16 +50,21 @@ public class RoomListJSON extends AcmsCommonJSON {
chatRoomDto.chatRoomId = roomListJsonArray.getJSONObject(listCount).getInt(RoomId);
chatRoomDto.chatRoomName = roomListJsonArray.getJSONObject(listCount).getString(RoomName);
chatRoomDto.type = roomListJsonArray.getJSONObject(listCount).getInt(RoomType);
chatRoomDto.unreadCount = roomListJsonArray.getJSONObject(listCount).getInt(UnreadCount);
chatRoomDto.unreadCount = roomListJsonArray.getJSONObject(listCount).has(UnreadCount) ? roomListJsonArray.getJSONObject(listCount).getInt(UnreadCount) : 0;
chatRoomDto.userCount = roomListJsonArray.getJSONObject(listCount).getJSONArray(AttendUsers).length();
//最後メッセージ情報がある場合の処理
JSONObject lastMessageInfoJSON = roomListJsonArray.getJSONObject(listCount).getJSONObject(LastMessageInfo);
JSONObject lastMessageInfoJSON = roomListJsonArray.getJSONObject(listCount).has(LastMessageInfo) ? roomListJsonArray.getJSONObject(listCount).getJSONObject(LastMessageInfo) : null;
if (lastMessageInfoJSON != null) {
chatMessageDto.chatRoomId = chatRoomDto.chatRoomId;
chatMessageDto.message = lastMessageInfoJSON.getString(Message);
chatMessageDto.messageType = lastMessageInfoJSON.getInt(MessageType);
lastMessageInfoJSON.getJSONObject(MessageInsertDate);
//TODO Change InsertDate Type
chatMessageDto.insertDate = lastMessageInfoJSON.getString(MessageInsertDate);
chatMessageDto.shopMemberId = lastMessageInfoJSON.getInt(ShopMemberId);
chatMessageDto.chatMessageId = lastMessageInfoJSON.getInt(MessageId);
chatRoomDto.lastMessageInfo = chatMessageDto;
......
......@@ -105,6 +105,8 @@ public class ChatRoomDao extends AbstractDao {
try {
beginTransaction();
delete("t_chat_room", null, null);
delete("r_chat_room_shop_member", null, null);
delete("t_chat_message", null, null);
commit();
} catch (Exception e) {
rollback();
......
......@@ -91,4 +91,9 @@ public class CommunicationLogic extends AbstractLogic {
chatMessageDao.insertChatMessage(chatRoomDto.lastMessageInfo);
}
}
public void deleteChatRoomList() {
chatRoomDao.deleteChatRoom();
}
}
......@@ -695,6 +695,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
public void updateRoomList() throws NetworkDisconnectedException, AcmsException {
Map<String, Object> chatRoomList;
RoomListJSON resultJson = AcmsClient.getInstance(ABVEnvironment.getInstance().networkAdapter).getRoomList(sid);
communicationLogic.deleteChatRoomList();
communicationLogic.insertChatRoomList(resultJson.roomList);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment