convertGroupResultFromWebToDart static method

Map<String, dynamic> convertGroupResultFromWebToDart(
  1. Map<String, dynamic> params
)

Implementation

static Map<String, dynamic> convertGroupResultFromWebToDart(
    Map<String, dynamic> params) {
  return {
    'groupID': params["groupID"],
    'groupType': GroupTypeWeb.convertGroupType(params["type"]),
    'groupName': params["name"],
    'faceUrl': params["avatar"],
    'notification': params['notification'],
    'introduction': params['introduction'],
    'createTime': params['createTime'] == '' ? 0 : params['createTime'],
    'isSupportTopic': params['isSupportTopic'] ?? false,
    'groupAddOpt':
        GroupAddOptWeb.convertGroupAddOpt(params['joinOption']) ?? 0,
    'isAllMuted': _getGroupAllMemberMutes(params['muteAllMembers']),
    'joinTime': jsToMap(params['selfInfo'])['joinTime'] == ''
        ? 0
        : jsToMap(params['selfInfo'])['joinTime'],
    'lastInfoTime': params['lastInfoTime'] == '' ? 0 : params['lastInfoTime'],
    'lastMessageTime': jsToMap(params['lastMessage'])['lastTime'] == ''
        ? 0
        : jsToMap(params['lastMessage'])['lastTime'],
    'memberCount': params['memberCount'] == '' ? 0 : params['memberCount'],
    'onlineCount': 0, // web 不支持onlineCount
    'owner': params['ownerID'],
    'recvOpt': GroupRecvMsgOpt.convertMsgRecvOpt(
        jsToMap(params['selfInfo'])['messageRemindType']), // need to do
    'role': GroupMemberRoleWeb.convertGroupMemberRole(
        jsToMap(params['selfInfo'])['role']),
    'customInfo':
        convertGroupCustomInfoFromWebToDart(params['groupCustomField']),
  };
}