Search in sources :

Example 1 with ResultCurrentUserRoles

use of com.fanap.podchat.chat.user.user_roles.model.ResultCurrentUserRoles in project pod-chat-android-sdk by FanapSoft.

the class UserRoles method handleOnGetUserRolesFromCache.

public static ChatResponse<ResultCurrentUserRoles> handleOnGetUserRolesFromCache(String uniqueId, RequestGetUserRoles request, CacheUserRoles cacheUserRole) {
    ArrayList<String> roles = new ArrayList<>(cacheUserRole.getRole());
    ResultCurrentUserRoles result = new ResultCurrentUserRoles();
    result.setRoles(roles);
    ChatResponse<ResultCurrentUserRoles> response = new ChatResponse<>();
    response.setResult(result);
    response.setUniqueId(uniqueId);
    response.setSubjectId(request.getThreadId());
    response.setCache(true);
    return response;
}
Also used : ChatResponse(com.fanap.podchat.model.ChatResponse) ArrayList(java.util.ArrayList) ResultCurrentUserRoles(com.fanap.podchat.chat.user.user_roles.model.ResultCurrentUserRoles)

Example 2 with ResultCurrentUserRoles

use of com.fanap.podchat.chat.user.user_roles.model.ResultCurrentUserRoles in project pod-chat-android-sdk by FanapSoft.

the class UserRoles method handleOnGetUserRoles.

public static ChatResponse<ResultCurrentUserRoles> handleOnGetUserRoles(ChatMessage chatMessage) {
    String jsonContent = chatMessage.getContent();
    ArrayList<String> roles = App.getGson().fromJson(jsonContent, new TypeToken<ArrayList<String>>() {
    }.getType());
    ResultCurrentUserRoles result = new ResultCurrentUserRoles();
    result.setRoles(roles);
    ChatResponse<ResultCurrentUserRoles> response = new ChatResponse<>();
    response.setResult(result);
    response.setUniqueId(chatMessage.getUniqueId());
    response.setSubjectId(chatMessage.getSubjectId());
    return response;
}
Also used : TypeToken(com.google.gson.reflect.TypeToken) ChatResponse(com.fanap.podchat.model.ChatResponse) ResultCurrentUserRoles(com.fanap.podchat.chat.user.user_roles.model.ResultCurrentUserRoles)

Aggregations

ResultCurrentUserRoles (com.fanap.podchat.chat.user.user_roles.model.ResultCurrentUserRoles)2 ChatResponse (com.fanap.podchat.model.ChatResponse)2 TypeToken (com.google.gson.reflect.TypeToken)1 ArrayList (java.util.ArrayList)1