use of com.fanap.podchat.model.ResultSetAdmin in project pod-chat-android-sdk by FanapSoft.
the class ChatCore method handleRemoveRole.
private void handleRemoveRole(ChatMessage chatMessage) {
ChatResponse<ResultSetAdmin> chatResponse = new ChatResponse<>();
ResultSetAdmin resultSetAdmin = new ResultSetAdmin();
ArrayList<Admin> admins = gson.fromJson(chatMessage.getContent(), new TypeToken<ArrayList<Admin>>() {
}.getType());
resultSetAdmin.setAdmins(admins);
chatResponse.setResult(resultSetAdmin);
chatResponse.setUniqueId(chatMessage.getUniqueId());
chatResponse.setSubjectId(chatMessage.getSubjectId());
String responseJson = gson.toJson(chatResponse);
OutputSetRoleToUser output = new OutputSetRoleToUser();
output.setResultSetAdmin(resultSetAdmin);
long threadId = chatMessage.getSubjectId();
if (cache) {
dataSource.updateParticipantRoles(admins, threadId);
}
if (sentryResponseLog) {
showLog("RECEIVE_REMOVE_ROLE", responseJson);
} else {
showLog("RECEIVE_REMOVE_ROLE");
}
listenerManager.callOnRemoveRoleFromUser(responseJson, chatResponse);
}
use of com.fanap.podchat.model.ResultSetAdmin in project pod-chat-android-sdk by FanapSoft.
the class ChatCore method handleSetRole.
private void handleSetRole(ChatMessage chatMessage) {
ChatResponse<ResultSetAdmin> chatResponse = new ChatResponse<>();
ResultSetAdmin resultSetAdmin = new ResultSetAdmin();
ArrayList<Admin> admins = gson.fromJson(chatMessage.getContent(), new TypeToken<ArrayList<Admin>>() {
}.getType());
resultSetAdmin.setAdmins(admins);
chatResponse.setResult(resultSetAdmin);
chatResponse.setUniqueId(chatMessage.getUniqueId());
chatResponse.setSubjectId(chatMessage.getSubjectId());
String responseJson = gson.toJson(chatResponse);
OutputSetRoleToUser output = new OutputSetRoleToUser();
output.setResultSetAdmin(resultSetAdmin);
long threadId = chatMessage.getSubjectId();
if (ThreadManager.hasSetAdminSubscriber(chatResponse)) {
if (sentryResponseLog) {
showLog("RECEIVE_SET_ROLE_FOR_SAFE_LEAVE", responseJson);
} else {
showLog("RECEIVE_SET_ROLE_FOR_SAFE_LEAVE");
}
return;
}
if (cache) {
dataSource.updateParticipantRoles(admins, threadId);
}
showLog("RECEIVE_SET_ROLE", responseJson);
listenerManager.callOnSetRoleToUser(responseJson, chatResponse);
}
Aggregations