isCreateGroupCustomMessage static method

bool isCreateGroupCustomMessage(
  1. V2TimMessage v2timMessage
)

Implementation

static bool isCreateGroupCustomMessage(V2TimMessage v2timMessage) {
  if (v2timMessage.elemType != MessageElemType.V2TIM_ELEM_TYPE_CUSTOM) {
    return false;
  }

  final customElem = v2timMessage!.customElem;
  try {
    if (customElem?.data != null) {
      final customMessage = jsonDecode(customElem!.data!);
      MessageCustom messageCustom = MessageCustom.fromJson(customMessage);
      if (messageCustom.businessID == MessageCustom.businessIDGroupCreate) {
        return true;
      }
    }

    return false;
  } catch (e) {
    return false;
  }
}