getCustomGroupCreatedOrDismissedString static method

String getCustomGroupCreatedOrDismissedString(
  1. V2TimMessage message
)

Implementation

static String getCustomGroupCreatedOrDismissedString(V2TimMessage message) {
  try {
    final isGroup = message.groupID != null;
    final isCustomMessage = message.elemType == MessageElemType.V2TIM_ELEM_TYPE_CUSTOM;
    if (isCustomMessage && isGroup) {
      final data = message.customElem?.data ?? "";
      Map<String, dynamic> customMap = jsonDecode(data);
      if (customMap.containsKey('businessID') && customMap['businessID'] == "group_create") {
        final content = "${customMap['opUser']}${customMap['content']}";
        return content;
      }
      return "";
    }
    return "";
  } catch (e) {
    outputLogger.i("getCustomGroupCreatedOrDismissedString json parse error");
    return "";
  }
}