use of ingage.ingage20.handlers.ChatRoomHandler in project iNGAGE by davis123123.
the class ChatActivity method leaveRoom.
private void leaveRoom() {
HashMap<String, String> chat_user = chatRoomManager.getUserDetails();
String side = chat_user.get(ChatRoomManager.SIDE);
String thread_id = chat_user.get(ChatRoomManager.THREAD_ID);
String spectator = chat_user.get(ChatRoomManager.SPECTATOR);
if (spectator.equals("true")) {
String type = "leave_spectate";
String result = null;
HashMap<String, String> user = session.getUserDetails();
String username = user.get(SessionManager.KEY_NAME);
SpectateRoomHandler spectateRoomHandler = new SpectateRoomHandler(getApplicationContext());
try {
result = spectateRoomHandler.execute(type, thread_id, username, side).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
Log.d("SPECTATORSTATE", "text: " + result);
} else {
String type = "leave";
String result = null;
HashMap<String, String> user = session.getUserDetails();
String username = user.get(SessionManager.KEY_NAME);
ChatRoomHandler chatRoomHandler = new ChatRoomHandler(getApplicationContext());
try {
result = chatRoomHandler.execute(type, thread_id, username, side).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
}
// leave user's session on cache
chatRoomManager.updateUserRoomSession("", "", "");
}
Aggregations