Search in sources :

Example 1 with RequestRole

use of com.fanap.podchat.requestobject.RequestRole in project pod-chat-android-sdk by FanapSoft.

the class ThreadManager method prepareSetRoleRequest.

public static String prepareSetRoleRequest(SetRuleVO request, String uniqueId, String mtypecode, String token, String TOKEN_ISSUER) {
    ArrayList<UserRoleVO> userRoleVOS = new ArrayList<>();
    for (RequestRole requestRole : request.getRoles()) {
        UserRoleVO userRoleVO = new UserRoleVO();
        userRoleVO.setUserId(requestRole.getId());
        userRoleVO.setRoles(requestRole.getRoleTypes());
        userRoleVOS.add(userRoleVO);
    }
    ChatMessage chatMessage = new ChatMessage();
    chatMessage.setContent(App.getGson().toJson(userRoleVOS));
    chatMessage.setSubjectId(request.getThreadId());
    chatMessage.setToken(token);
    chatMessage.setType(ChatMessageType.Constants.SET_ROLE_TO_USER);
    chatMessage.setTokenIssuer(TOKEN_ISSUER);
    chatMessage.setUniqueId(uniqueId);
    chatMessage.setTypeCode(mtypecode);
    return App.getGson().toJson(chatMessage);
}
Also used : RequestRole(com.fanap.podchat.requestobject.RequestRole) UserRoleVO(com.fanap.podchat.mainmodel.UserRoleVO) ChatMessage(com.fanap.podchat.mainmodel.ChatMessage) ArrayList(java.util.ArrayList)

Example 2 with RequestRole

use of com.fanap.podchat.requestobject.RequestRole in project pod-chat-android-sdk by FanapSoft.

the class ChatActivity method addAuditor.

// private void stopSignalMessage() {
// presenter.stopSignalMessage(getSignalUniq());
// }
// 
// private void startSignalMessage() {
// RequestSignalMsg requestSignalMsg = new RequestSignalMsg.Builder()
// .signalType(ChatMessageType.SignalMsg.IS_TYPING)
// .threadId(1961)
// .build();
// String uniq = presenter.startSignalMessage(requestSignalMsg);
// setSignalUniq(uniq);
// }
private void addAuditor() {
    ArrayList<String> typeRoles = new ArrayList<>();
    typeRoles.add(RoleType.Constants.READ_THREAD);
    typeRoles.add(RoleType.Constants.EDIT_THREAD);
    RequestRole requestRole = new RequestRole();
    requestRole.setId(2);
    requestRole.setRoleTypes(typeRoles);
    ArrayList<RequestRole> requestRoles = new ArrayList<>();
    requestRoles.add(requestRole);
    RequestSetAuditor requestAddAdmin = new RequestSetAuditor.Builder(TEST_THREAD_ID, requestRoles).build();
    presenter.setAuditor(requestAddAdmin);
}
Also used : RequestRole(com.fanap.podchat.requestobject.RequestRole) ArrayList(java.util.ArrayList) RequestSetAuditor(com.fanap.podchat.requestobject.RequestSetAuditor)

Example 3 with RequestRole

use of com.fanap.podchat.requestobject.RequestRole in project pod-chat-android-sdk by FanapSoft.

the class ChatActivity method setAdminRules.

private void setAdminRules() {
    // core 1507
    // thread id 1961
    ArrayList<String> typeRoles = new ArrayList<>();
    // typeRoles.add(RoleType.Constants.THREAD_ADMIN);
    // typeRoles.add(RoleType.Constants.ADD_NEW_USER);
    // typeRoles.add(RoleType.Constants.REMOVE_USER);
    // roles to set auditor
    typeRoles.add(RoleType.Constants.READ_THREAD);
    typeRoles.add(RoleType.Constants.EDIT_THREAD);
    // typeRoles.add(RoleType.Constants.ADD_RULE_TO_USER);
    // typeRoles.add(RoleType.Constants.CHANGE_THREAD_INFO);
    // typeRoles.add(RoleType.Constants.DELETE_MESSAGE_OF_OTHERS);
    // typeRoles.add(RoleType.Constants.EDIT_MESSAGE_OF_OTHERS);
    // typeRoles.add(RoleType.Constants.POST_CHANNEL_MESSAGE);
    // typeRoles.add(RoleType.Constants.REMOVE_ROLE_FROM_USER);
    // 
    // ArrayList<String> typeRoles2 = new ArrayList<>();
    // typeRoles2.add(RoleType.Constants.REMOVE_USER);
    // typeRoles2.add(RoleType.Constants.ADD_RULE_TO_USER);
    RequestRole requestRole = new RequestRole();
    requestRole.setId(2);
    requestRole.setRoleTypes(typeRoles);
    // 
    // RequestRole requestRole2 = new RequestRole();
    // //        requestRole2.setId(41);
    // //        requestRole2.setId(123);
    // requestRole2.setRoleOperation("remove");
    // requestRole2.setRoleTypes(typeRoles2);
    ArrayList<RequestRole> requestRoles = new ArrayList<>();
    requestRoles.add(requestRole);
    // requestRoles.add(requestRole2);
    RequestSetAdmin requestAddAdmin = new RequestSetAdmin.Builder(TEST_THREAD_ID, requestRoles).build();
    presenter.setAdmin(requestAddAdmin);
}
Also used : RequestRole(com.fanap.podchat.requestobject.RequestRole) ArrayList(java.util.ArrayList) RequestSetAdmin(com.fanap.podchat.requestobject.RequestSetAdmin)

Example 4 with RequestRole

use of com.fanap.podchat.requestobject.RequestRole in project pod-chat-android-sdk by FanapSoft.

the class ThreadManager method prepareRemoveRoleRequest.

public static String prepareRemoveRoleRequest(SetRuleVO request, String uniqueId, String mtypecode, String token, String TOKEN_ISSUER) {
    ArrayList<UserRoleVO> userRoleVOS = new ArrayList<>();
    for (RequestRole requestRole : request.getRoles()) {
        UserRoleVO userRoleVO = new UserRoleVO();
        userRoleVO.setUserId(requestRole.getId());
        userRoleVO.setRoles(requestRole.getRoleTypes());
        userRoleVOS.add(userRoleVO);
    }
    ChatMessage chatMessage = new ChatMessage();
    chatMessage.setContent(App.getGson().toJson(userRoleVOS));
    chatMessage.setSubjectId(request.getThreadId());
    chatMessage.setToken(token);
    chatMessage.setType(ChatMessageType.Constants.REMOVE_ROLE_FROM_USER);
    chatMessage.setTokenIssuer(TOKEN_ISSUER);
    chatMessage.setUniqueId(uniqueId);
    chatMessage.setTypeCode(mtypecode);
    return App.getGson().toJson(chatMessage);
}
Also used : RequestRole(com.fanap.podchat.requestobject.RequestRole) UserRoleVO(com.fanap.podchat.mainmodel.UserRoleVO) ChatMessage(com.fanap.podchat.mainmodel.ChatMessage) ArrayList(java.util.ArrayList)

Example 5 with RequestRole

use of com.fanap.podchat.requestobject.RequestRole in project pod-chat-android-sdk by FanapSoft.

the class ChatActivity method removeAdminRules.

private void removeAdminRules() {
    ArrayList<String> typeRoles = new ArrayList<>();
    typeRoles.add(RoleType.Constants.THREAD_ADMIN);
    // typeRoles.add(RoleType.Constants.READ_THREAD);
    // typeRoles.add(RoleType.Constants.ADD_NEW_USER);
    typeRoles.add(RoleType.Constants.REMOVE_USER);
    RequestRole requestRole = new RequestRole();
    requestRole.setId(2);
    requestRole.setRoleTypes(typeRoles);
    // RequestRole requestRole2 = new RequestRole();
    // requestRole2.setId(41);
    // requestRole2.setRoleOperation("remove");
    // requestRole2.setRoleTypes(typeRoles);
    ArrayList<RequestRole> requestRoles = new ArrayList<>();
    requestRoles.add(requestRole);
    // requestRoles.add(requestRole2);
    RequestSetAdmin requestAddAdmin = new RequestSetAdmin.Builder(TEST_THREAD_ID, requestRoles).build();
    presenter.removeAdminRules(requestAddAdmin);
}
Also used : RequestRole(com.fanap.podchat.requestobject.RequestRole) ArrayList(java.util.ArrayList) RequestSetAdmin(com.fanap.podchat.requestobject.RequestSetAdmin)

Aggregations

RequestRole (com.fanap.podchat.requestobject.RequestRole)6 ArrayList (java.util.ArrayList)6 ChatMessage (com.fanap.podchat.mainmodel.ChatMessage)2 UserRoleVO (com.fanap.podchat.mainmodel.UserRoleVO)2 RequestSetAdmin (com.fanap.podchat.requestobject.RequestSetAdmin)2 RequestSetAuditor (com.fanap.podchat.requestobject.RequestSetAuditor)2